CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   Change mesh location on drive.. (

MarkHerskind November 4, 2010 06:51

Change mesh location on drive..

I have a mesh, which is want to do 12 simulations on (changing inflow direction).. The mesh I have right now is app 7.5m cells, which is about 1.5GB of data..

If I want to run these simultanious, I will need to generate 12 cases, each with a copy of the mesh.. It'll take up a lot of space copying the grid to each sector (14.5GB of duplicate data), but worse, it takes time..

I was wondering if there's a way of changing the reference to the mesh location, so that the simulations can share the same mesh..

Mark Herskind

wyldckat November 4, 2010 19:04

Greetings Mark,

It depends on where the mesh is kept at. For example, when we run "blockMesh", the mesh is kept in the folder "constant/polyMesh". The same happens when we run "snappyHexMesh -overwrite", which will overwrite the latest mesh (which is usually the initial mesh by blockMesh).

So, if you can keep the mesh in the folder "constant/polyMesh" then you can use symbolic links for sharing the mesh between cases. For example, if we have 3 case folders: "case1 case2 case3".
Generate the mesh in case1. Then step back into the previous folder and run:

rm -rf case2/constant/polyMesh
rm -rf case3/constant/polyMesh
ls -s ../../case1/constant/polyMesh case2/constant/polyMesh
ls -s ../../case1/constant/polyMesh case3/constant/polyMesh

Now, I haven't tested this yet, but at least in theory it should work. If you run the following commands:

cd case3/constant
ls -l polyMesh/

It should show the contents of the case1's polyMesh folder.

But the best method would be to use absolute folders, as long as you run always on the same path:

ls -s $PWD/case1/constant/polyMesh case2/constant/polyMesh
ls -s $PWD/case1/constant/polyMesh case3/constant/polyMesh

The variable $PWD holds the path of the current folder. If you don't believe me ;) run:

echo $PWD
Best regards and good luck!

All times are GMT -4. The time now is 20:50.