CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   mesh storage in another directory (https://www.cfd-online.com/Forums/openfoam-solving/143015-mesh-storage-another-directory.html)

K62 October 14, 2014 10:41

mesh storage in another directory
 
Dear all,

I study the turbulence models implemented in OpenFOAM. For this I need to run a bunch of different simulations for a test case with different settings (e.g. different coefficients), which requires a case folder structure for each simulations (0/ constant/ system/). However, the mesh is kept the same for all simulations and I don't wanna copy or rebuild it for each simulation, because it is rather expensive to do. Thus, I would like to know if you guys know a way, how to store the mesh in a something like a parent folder and link it to the folder structure of each simulation?

It should look similar to this kind of generic structure:

Simulation1/{0/ constant/ system/}
Simulation2/{0/ constant/ system/}
Simulation3/{0/ constant/ system/}
...
folder-containing-the-mesh-for-each-simulation/


Any help is appreciated!

tomf October 21, 2014 14:57

Hi,

You could just use soft-links, either via the terminal or some file manager. So make the mesh once (polyMesh folder) and create soft links in all constant folders to this polyMesh folder.

Regards,
Tom

K62 October 22, 2014 04:28

Hi Tom,


Thanks for your reply. I already figured that out, but haven't posted it yet - I am sorry!


For everybody who runs into the same problem my detailed workaround is as follows:


0. Make a backup copy of your <case> (you never know...):
cp -r <case> bu.<case>


1. Copy your <case> containing 0/ constant/ system/ and name the copy e.g. parent_mesh_case:
cp -r <case> parent_mesh_case


2. Go to parent_mesh_case and create the mesh, e.g. by running blockMesh
cd parent_mesh_case
blockMesh


3. Now go back to your <case> and delete or rename the polyMesh folder, e.g.
cd ../<case>/constant
mv polyMesh bu.polyMesh (just in case you gonna need it in the future)


4. Create a symbolic link referring to the mesh directory in parent_mesh_case
ln -s ../../parent_mesh_case/constant/polyMesh .


5. Now if you copy your <case> also the symbolic link will be copied. So you don't copy your mesh, which might be expensive, but only the symbolic link, which is cheap.
cp <case> new_case
cp -a <case> new_case (on mac)



Now, everything what you change in parent_mesh_case/constant/polyMesh is also changed in <case>/constant/polyMesh


Again thanks to Tom for reminding me posting that.


Cheers!


All times are GMT -4. The time now is 12:26.