CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Pre-Processing (
-   -   Parallel case setup boundry conditions snappyhexmesh (

oskar March 8, 2009 19:39

I've probably been going at th
I've probably been going at this the wrong way, but haven't been able to find the correct way to to setup a parallel case.

What I've been doing:
1. blockMesh
2. snappyHexMesh
3. manually define boundary conditions
4. decomposePar
5. mpirun case

I would prefer to run snappyHexMesh in parallel because:
a) running out of memory on single computer
b) running on one core is very slow

What I've tried:
1. manually setup boundary condition for time 0
2. decomposeParDict: method metis
3. blockMesh
4. decomposePar
5. decomposeParDict: method parMetis
6. mpirun snappyHexMesh

This results in a good mesh, but the problem is I can't figure out how to get the boundary conditions to follow the mesh generation to timestep 3. Snappyhexmesh does insert the stl-wall boundary correctly, but doesn't touch the p, U etc. files.

Could some knowledgeable FOAMer point me in the right direction?

oskar April 15, 2009 14:04

Surely someone must have a elegant way to setup the initial field for parallel cases while using snappyHexMesh in parallel?
How do you do it?

I tried using mapFields, but I couldn't figure out a way to setup the case using the "-consistent" flag (since the stl-surface isn't there before running snappyHexMesh). Without the -consistent flag mapFields requires the "destination" case to already have the field variables set to something. Creating the field variable in the first place is what I'm trying to do!

Manually setting the initial field variables isn't very efficient since a lot of files need to be created (or copied and tweaked individually). Especially if batch runs with small adjustments need to be run this is impossible to do without a tool.

Using a CFD program with no user interface seems to be very difficult.

fra76 April 16, 2009 11:23

I don't know if it works for parallel cases as well, but have you tried pyFoam? Search the forum for it.


oskar April 17, 2009 07:34

Thanks for the tip fra76!

I found some documentation to pyFoam on, looks to have useful tools.
I also stumbled across funkySetFields, tried that out and it's somewhat capable of doing what I what with a single command. (for parallel case setups needs to be run with the same processor amount as the case is decomposed to though)

mpirun -hostfile ~/foamHosts funkySetFields -create -field U -expression 'vector(60,0,0)' -time 3 -parallel

I'll probably have to learn how to make the hideously cryptic bash scripts, but funkySetFields seems to be able to do most of what I what so hopefully I wont need to figure that much out.

andersking September 9, 2009 06:20

Hi Oscar,


I have a feeling this may work (testing at the moment)


albcem September 11, 2009 01:12

I had the exact same problem as the original poster. I have not found an elegant way, but use a rather convenient work around:
  1. Reconstruct your decomposed mesh output by snappyhexmesh
  2. Transfer the reconstructed mesh to the appropriate location in constant/ directory
  3. Set fields serially
  4. Re-decompose
Note that none of the above steps seem to consume the memory associated with the whole mesh, so you should be able to build your case without problems.

All times are GMT -4. The time now is 23:36.