CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Native Meshers: snappyHexMesh and Others (
-   -   trouble with snappyhex (

arapuraz January 3, 2014 15:24

trouble with snappyhex
I am currently trying to run the motorbike tutorial in OpenFoam. The tutorial was previously set up for a 8 core computer, I only have a quad core computer. I tried to play around with the decomposePardict and finally found one that works. I am now however struggling to get the snappyhex running in parallel. I used the following code

snappyHexMesh 4 -overwrite

but I get the follwoing error when running

Usage: snappyHexMesh [OPTIONS]
-case <dir> specify alternate case directory, default is the cwd
-checkGeometry check all surface geometry for quality
do not execute functionObjects
-overwrite overwrite existing mesh/results files
-parallel run in parallel
-roots <(dir1 .. dirN)>
slave root directories for distributed running
-writeLevel write pointLevel and cellLevel postprocessing files
-srcDoc display source code in browser
-doc display application documentation in browser
-help print the usage

Using: OpenFOAM-2.2.2 (see
Build: 2.2.2

Wrong number of arguments, expected 0 found 1

FOAM exiting

I was wondering if anyone knew why I am getting this problem and how to overcome it.


lovecraft22 January 3, 2014 18:02

Try with
runParallel snappyHexMesh 4 -overwrite

arapuraz January 4, 2014 07:20

hi there I tried the command and it unfortunately did not work, it said the following error
runParallel snappyHexMesh 4 -overwrite

bash: runParallel: command not found...

I think the main problem is with the snappyHexMeshDict, I might be wrong.

lovecraft22 January 4, 2014 09:52

Try this then:

mpirun -np 8 snappyHexMesh -overwrite -parallel

Of course you need to run decomposePar first.

arapuraz January 4, 2014 10:05


Thank you for your help, was stuck on this for weeks.

arapuraz January 4, 2014 11:23

I was following the script file that came with the motorbike tutorial. Once again i am stuck so here is the full script

cd ${0%/*} || exit 1 # run from this directory

# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions

# copy motorbike surface from resources folder
cp $FOAM_TUTORIALS/resources/geometry/motorBike.obj.gz constant/triSurface/
runApplication surfaceFeatureExtract

runApplication blockMesh

runApplication decomposePar
runParallel snappyHexMesh 6 -overwrite

#- For non-parallel running
#cp -r 0 > /dev/null 2>&1

#- For parallel running
ls -d processor* | xargs -i rm -rf ./{}/0 $1
ls -d processor* | xargs -i cp -r ./{}/0 $1

runParallel patchSummary 6
runParallel potentialFoam 6 -noFunctionObjects -writep
runParallel $(getApplication) 6

runApplication reconstructParMesh -constant
runApplication reconstructPar -latestTime

# ----------------------------------------------------------------- end-of-file

I am stuck again on the
runParallel $(getApplication) 6

I tried to change the code the following code
mpirun -np 4 $(getApplication) 4 -parallel

the mpirunb ti and the rest of the line worked fine befor the only part causing problems is the

$(getApplication) 4

thank you

lovecraft22 January 6, 2014 17:05

That is a variable you have to set somewhere, which indicates the solver you want to use.

If you want to use simpleFoam, just type

mpirun -np 4 simpleFoam -parallel

instead and you should be able to walk around it.

arapuraz January 6, 2014 17:18

Ofcourse :o .... Thank you once again

Tobi January 8, 2014 03:17


just one hint.
You said that you used the scripts but I think you typ in the commands by yourself, arenīt you?

If you do this you have to be sure the aliases are loaded in your terminal:

. $WM_PROJECT_DIR/bin/tools/RunFunctions
in that file you find the alias


If you did not load that file you can not use that keywords.
I think that is your Problem. Hence you just able to work with the official Linux commands:

mpirun -np 20 snappyHexMesh -parallel  // example


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