CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Pre-Processing (
-   -   Nonuniform initial conditions (

nico January 3, 2006 07:54

Hi I have a body, with a po

I have a body, with a porous and a nonporous region. By using a field for the permeability and specifying appropriate values for certain regions i want to define porous/non-porous-zones. My problem is how to set non-uniform initial conditions. It is described in some other threads, but not enough detailed.

I would be very thankful for some help

hjasak January 3, 2006 08:10

For "easy" cases, use the setF
For "easy" cases, use the setFields utility. You can find an example dictionary in:


For more complex cases, write a little application (top-level code) that will read in the field you wish to set and, set the values and write it out. Good examples could be found in OpenFOAM-1.2/applications/utilities/postProcessing/velocityField or (if you're running an older version) in setGammaDamBreak in the interFoam tutorial (OLD VERSION).



nico January 4, 2006 07:37

I have meshed my geometry with
I have meshed my geometry with gambit and declared two different volumes. After converting the mesh with fluentMeshtoFoam i get a folder named sets in /constant/polyMesh with 2 files in it. The two files (fluid.1 & fluid.2 )each with contain a list of cells which belong to each volume.

I know that i cannot use setFields to set nonuniform initial conditions for the two different volumes, because i think it only works with using blockmesh. I read in another thread that it is possible to change boxtocell with celltocell.

By Mattijs Janssens on Thursday, November 17, 2005 - 03:05 am: Edit Post

to e.g. read cellSet c0 replace the

box (..)(..)

fieldValues ...


set "c0";

fieldValues ...

(or maybe lose the quotes around c0)
Also look at the sample cellSetDict in the cellSet utility.

My question is now, how to read in all cells belong to one file (for example polyMesh/sets/fluid.1). It would be a great help if you told me step by step, what I have to do.

the file fluid.4:

version 2.0;
format ascii;

root "OpenFOAM/nico-1.2/run/tutorials/simpleFoam";
case "test01";
instance ""constant"";
local "polyMesh/sets";

class cellSet;
object fluid.4;

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //




All times are GMT -4. The time now is 17:47.