CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   How to add a wall momentum source to a solver (

boeleman February 6, 2013 19:43

How to add a wall momentum source to a solver
Dear Foamers,

I am trying to modify interDyMFoam by adding a momentum source which is defined on a wall.

force_.boundaryField()[patchi] = someValue;

where force is a volVectorField.

I have tried to add the term

forcef_ = fvc::interpolate( force_ ) & mesh.Sf()/mag(mesh.Sf());

to pEqn.H and UEqn.H but there is no effect in my simulation. Does anyone know how to do this correctly? Should I convert my boundaryField to an internalField?



boeleman February 6, 2013 20:32

I think I found an answer:

force is a vectorField
force_ is a volVectorField
forcef_ is a surfaceScalarField (and can thus be added in UEqn.H and pEqn.H)

const labelUList& faceCells = boundary[patchi].faceCells();

scalarField b2(force.size());

forAll(b2, facei)
force_[faceCells[facei]] = force[facei];

forcef_ = fvc::interpolate( force_ ) & mesh.Sf()/mag(mesh.Sf());

All times are GMT -4. The time now is 16:34.