CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [snappyHexMesh] Running snappyHexMesh in parallel creates new time directories (https://www.cfd-online.com/Forums/openfoam-meshing/207868-running-snappyhexmesh-parallel-creates-new-time-directories.html)

hconel October 4, 2018 13:22

Running snappyHexMesh in parallel creates new time directories
 
I want to run snappyHexMesh in parallel and then pimpleFoam in parallel also. I'm using the following script for mesh preparation:

Code:

blockMesh > log.blockMesh
decomposePar > log.decomposePar.1
mpirun -np $nProc snappyHexMesh -latestTime -parallel > log.snappyHexMesh
reconstructParMesh -latestTime > log.reconstructPar1
renumberMesh -latestTime > renumberMesh.log
rm -rf processor*
topoSet > log.topoSet

and then the following for solving:

Code:

decomposePar > log.decomposePar.2
ls -d processor* | xargs -I {} rm -rf ./{}/0
ls -d processor* | xargs -I {} cp -r 0.org ./{}/0
mpirun -np $nProc pimpleFoam -parallel > log.pimpleFoam
reconstructPar > log.reconstructPar.2

However, snappyHexMesh creates new time directories and I don't want that but to start from 0. How can I do that? Also, is there an "optimized" way to do this by avoiding intermediate decomposition and reconstruction processes?
Thanks.

lebc October 4, 2018 16:59

Try using "mpirun -np $nProc snappyHexMesh -latestTime -parallel -overwrite> log.snappyHexMesh", I use the "-overwrite" option and I don't get new time directories.

What I use to run my cases is a Allrun file:

Code:

#!/bin/sh
cd ${0%/*} || exit 1    # Run from this directory

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

# Make dummy 0 directory
mkdir 0

runApplication blockMesh
cp system/decomposeParDict.hierarchical system/decomposeParDict
runApplication decomposePar

runParallel snappyHexMesh -overwrite

find . -type f -iname "*level*" -exec rm {} \;

ls -d processor* | xargs -I {} cp -r 0.org ./{}/0 $1

runParallel topoSet
runParallel `getApplication`

runApplication reconstructParMesh -constant
runApplication reconstructPar

cp -a 0.org/. 0/

I just addapted the Allrun file from one tutorial, so maybe there are other ways to do it.

hconel October 5, 2018 06:01

Hi Luis,
I do not have runParallel and runApplication commands, I guess they come with another application you have. Also, qsub and pbs scripts does not accept them I guess. Is there a way to do it with mpirun?

lebc October 5, 2018 16:03

Hi,

These commands will be available when you execute the line ". $WM_PROJECT_DIR/bin/tools/RunFunctions", but you can probably use the mpi as well (I never used it, so I can't give you more information about it, sorry!)

When I run "runApplication blockMesh" I get the same result as your "blockMesh > log.blockMesh" command, so probably you can keep it.

I guess you could replace "runParallel" by "mpirun -np $nProc". For example, runParallel topoSet may have the same result as mpirun -np $nProc topoSet > log.topoSet

Also, I don't need to reconstruct my case before running the solver, because topoSet can be run in parallel. It seems to be the same case as yours, you just reconstruct it to run topoSet, and after decompose it again, correct?

Best Regards,
Luis

hconel October 5, 2018 20:40

Hi,
Thanks to you, sourcing that file allowed me to use runApplication and runParallel commands in pbs script job submissions! My idea was to successfully generate the mesh in parallel first error free, then continue on solving without intermediate reconstruction steps. I'm still not sure how to do it with mpirun commands, but runParallel function has taken care of everything smoothly! I'll post the final script when I get on my pc.

bravaiser September 27, 2022 15:20

Can you post your script?
 
do you mind posting your script?


All times are GMT -4. The time now is 14:46.