CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   How to add a wall momentum source to a solver (https://www.cfd-online.com/Forums/openfoam-programming-development/112877-how-add-wall-momentum-source-solver.html)

boeleman February 6, 2013 18: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?

Thanks,

Arnout

boeleman February 6, 2013 19: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 00:30.