Professional Documents
Culture Documents
A Look Inside Icofoam: H Akan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 186
A Look Inside Icofoam: H Akan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 186
The Make directory contains instructions for the wmake compilation command. icoFoam.C is the main le, and createFields.H is an inclusion le, which is included in icoFoam.C. In the header of icoFoam.C we include fvCFD.H, which contains all class denitions that are needed for icoFoam. fvCFD.H is included from (see Make/options): $WM_PROJECT_DIR/src/finiteVolume/lnInclude, but that is actually only a link to $WM_PROJECT_DIR/src/finiteVolume/cfdTools/general/include/fvCFD.H. fvCFD.H in turn only includes other les that are needed (see next slide). Hint: Use find PATH -iname "*LETTERSINFILENAME*" to nd where in PATH a le with a le name containing LETTERSINFILENAME in its le name is located. In this case: find $WM_PROJECT_DIR -iname "*fvCFD.H*" Hint: Use locate fvCFD.H to nd all les with fvCFD.H in their names. Note that locate is much faster than find, but is not frequently updated when les are added and removed!
186
187
where all inclusion les except createFields.H are included from src/OpenFOAM/lnInclude and src/finiteVolume/lnInclude. Have a look at them yourself. (nd them using the find or locate commands) createFields.H is located in the icoFoam directory. It initializes all the variables used in icoFoam. Have a look inside it and see how the variables are created from les.
188
We will now discuss the PISO algorithm used in icoFoam, in words, equations and code lines.
189
190
191
au uN = r p N
au uN N
so that: au uP = H(u) p P uP = (au )1 (H(u) p) P Substitute this in the incompressible continuity equation ( u = 0) to get a pressure equation for incompressible ow: (au )1p = (au )1H(u) P P
192
193
194
sf u =
f
where F is the face ux, F = sf u. Substitute the expression for the velocity in PISO slide (3/7) (uP = (au )1(H(u) p)), P yielding F = (au )1sf p + (au )1sf H(u) P P A part of the above appears during the discretization of the pressure Laplacian, for each face: |sf | (au )1sf p = (au )1 (pN pP ) = aP (pN pP ) P P N |d|
f where |d| is the distance between the owner and neighbour cell centers, and aP = (au )1 |d| N P is the off-diagonal matrix coefcient in the pressure Laplacian. For the uxes to be fully conservative, they must be completely consistent with the assembly of the pressure equation (e.g. non-orthogonal correction).
|s |
195
196
197
198