CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   coding of antal lubrication force (

enoch May 15, 2012 17:06

coding of antal lubrication force

nw is the unit normal pointing away from the wall.
v1-v2 is is the relative velocity difference between phases, in the plane of the nearby wall surface (that is, orthogonal to nw).
yw is the distance to the nearest wall.

magUr = mag(Ur);
sqrmagUr = sqr(magUr);
volScalarField Cwl = max(0.0, (Cw1/da)+(Cw2/postion.y);
volVectorField wallLubForce = Cwl*alpha*rhob*sqrmagUr*position.y.normal

postion.y is yw.
position.y.normal is nw.

How can I express yw and nw in the foam?

Bernhard May 16, 2012 01:57

You can use the files that are located in src/finiteVolume/fvMesh/wallDist . I think you can get wall distance and normal vectors from these files.

For synthax you can have a look at LES turbulence model vanDriestDelta, where the wall distance is used. For the normal vectors I don't know an example, but the reflectionVectors files seem to be what you need.

l_r_mcglashan May 17, 2012 03:38

Never tested them but you can find the Antal/Frank models here:

enoch May 18, 2012 13:52

I'm sorry for my repeating question. I'm still not not sure how I can get a normal distance and a wall normal unit vector. Here is what I did.

I Included two header files in the main code.

#include "wallDistReflection.H"
#include "wallDist.H"
I updated option.

-I$(LIB_SRC)/finiteVolume/lnInclude \

-lfiniteVolume \

In the code,

// Distance to nearest wall: wallDist.H
volScalarField yDist = y.n();

// Wall normal unit vector: wallDistReflection.H

volScalarField Cwl = myScalar/yDist;
Info << "Cwl= " << Cwl;

But I've got compilation errors shown below. How can get a yDist and a normal unit vector?

Making dependency list for source file icoFoamMod.C
SOURCE=icoFoamMod.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/home/jeong/OpenFOAM/openfoam210/src/finiteVolume/lnInclude -I/home/jeong/OpenFOAM/openfoam210/src/meshTools/lnInclude -IlnInclude -I. -I/home/jeong/OpenFOAM/openfoam210/src/OpenFOAM/lnInclude -I/home/jeong/OpenFOAM/openfoam210/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/icoFoamMod.o
/home/jeong/OpenFOAM/openfoam210/src/finiteVolume/lnInclude/readPISOControls.H: In function ‘int main(int, char**)’:
/home/jeong/OpenFOAM/openfoam210/src/finiteVolume/lnInclude/readPISOControls.H:3:15: warning: unused variable ‘nOuterCorr’
/home/jeong/OpenFOAM/openfoam210/src/finiteVolume/lnInclude/readPISOControls.H:12:16: warning: unused variable ‘momentumPredictor’
/home/jeong/OpenFOAM/openfoam210/src/finiteVolume/lnInclude/readPISOControls.H:15:16: warning: unused variable ‘transonic’
In file included from icoFoamMod.C:131:0:
exportDataLastTime.H:14:25: error: ‘y’ was not declared in this scope
exportDataLastTime.H:22:38: error: ‘struct Foam::volScalarField’ has no member named ‘n’
make: *** [Make/linux64GccDPOpt/icoFoamMod.o] Error 1

All times are GMT -4. The time now is 11:06.