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] snappyHexMesh in parallel (https://www.cfd-online.com/Forums/openfoam-meshing/102126-snappyhexmesh-parallel.html)

shailesh.nitk May 23, 2012 01:37

snappyHexMesh in parallel
 
Hi,

I can run SnappyHexMesh in serial. I would like to know how to run snappyHexMesh in parallel.

I have gone through the docs http://www.openfoam.org/docs/user/ru...s-parallel.php. If I have mesh that can be broken broken into pieces and allocated to separate processors for solution using with decomposePar then we can run mpi to solve the solution.

If I want to generate SnappyHexMesh in parallel. Could you please tell me What steps I need to follow to run snappyHexMesh in parallel.

Best regards,
Shailesh

Rider May 23, 2012 02:37

Hi,

I don't know your study but I think that you can do these steps :

- decomposePar
- foamJob -parallel -screen snappyHexMesh
- reconstructParMesh -time 1 (it reconstructs the "castellatedMesh" step)
- reconstructParMesh -time 2 (it reconstructs the "snap" step)
- reconstructParMesh -time 3 (it reconstructs the "addLayers" step)

To know how many "time" file you should reconstruct, you can open the file "processor0" in your case and see how many "time" file you have.

May be it's not the best solution, but it works for me.

shailesh.nitk May 24, 2012 02:22

Dear Rider,

I would like to thank you for your reply.
I am able to run snappyHexMesh in parallel. I am using -latestTime to know how many "time" file should reconstruct.

reconstructParMesh -latestTime -mergeTol 1E-06 -noZero

I think this will help to re construct mesh. Thank you again for your help:).

Best regards,
Shailesh

Rider May 24, 2012 03:01

Your welcome.

Yes, I use latestTime too. But, I tell you to look how may "time's files" you have to understand how the command ligne works ;).

Best regards,
Rider.

shailesh.nitk May 25, 2012 06:02

mpirun app, foamJob script and RunParallel function
 
We can run snappyHexMesh in parallel using with mpirun app or foamJob script or RunParallel function. I would like to know the difference between mpirun app, foamJob script and RunParallel function and which one would be better option to run SHM in parallel.

Rider May 29, 2012 05:50

Sorry, but I don't know the real reason. I only use foamJob with snappyHexMesh and with simpleFoam solver.

shailesh.nitk May 29, 2012 06:17

Thank you Rider for your reply.

I have tried with mpirun and foamJob to run SHM in parallel. i could not able to find the difference between them. I was using only np #2 in my machine only.

I want to run solver in parallel with decomposed mesh. I need to reconstruct mesh and again decompose to run for solver.

Can I run directly on the decomposed mesh ? How can I assign fields to the decomposed meshes that I have generated with snappyhexmesh in parallel?

Rider May 29, 2012 06:24

I'm in the same case, I need to reconstruct mesh and again decompose to run for solver :(.

Currenlty, I don't find a solution to this porblem. But I did the different step with a script, it's less boring ...

shailesh.nitk May 29, 2012 06:36

How did you run the solver after parallel meshing ?

Rider May 29, 2012 06:43

I use this method :

- blockMesh
- decomposePar
- foamJob -parallel -screen snappyHexMesh
- reconstructParMesh -latestTime
- "I use linux command lines to copy my boundary condition in the latestTime's file"
- decoposePar
- foamJob -parallel -screen simpleFoam
- reconstructParMesh -latestTime

lovecraft22 May 29, 2012 08:58

Quote:

Originally Posted by Rider (Post 363548)
- "I use linux command lines to copy my boundary condition in the latestTime's file"

Does that mean that you copy your U, P, k, Omega/epsilon/whatever files from the original 0 folder to the latest folder you get after reconstructParMesh?

Thank you for your help!

Rider May 29, 2012 09:04

Quote:

Originally Posted by lovecraft22 (Post 363576)
Does that mean that you copy your U, P, k, Omega/epsilon/whatever files from the original 0 folder to the latest folder you get after reconstructParMesh?

Thank you for your help!

Yes, exactly ;)

case November 30, 2012 07:48

try using the command

snappyHexMesh -overwrite

in order to not have to copy the files from the last time folder back to the original "0" folder.

frag_mo September 17, 2013 05:48

snappyHexMesh in parallel
 
Hi everyone,

Im currently running sHM in parallel for rather large meshes. If I want to actually use the generated mesh for a simulation, I have to reconstructParMesh the latest mesh and then decompose it again for the actual run (so that initial fields etc are correctly assigned). Is there anyway around these two steps (i.e. reconstructParMesh and decomposePar)? Since the mesh is already decomposed for sHM I figure it should be possible to use this decomposition for the actual run as well without doing the lengthy reconstruction followed by lengthy decomposition.

I have seen Rider etc having the same question on a previous thread, but no solution was yet given.

Thanks a lot for any suggestions....

laurent98 December 23, 2013 00:38

allrun in parallel
 
hi
i'am back on openFoam after flew months break.
here to give a example of my "allrun_in_parallel" script:
Quote:

runApplication blockMesh
# run parallel
runApplication decomposePar
runParallel snappyHexMesh 8 -overwrite
runApplication reconstructParMesh -constant

mv log.decomposePar log.decomposePar1
mv log.reconstructParMesh log.reconstructParMesh1
mkdir 0
cp -r 0.org/* 0
runApplication setFields

#-delete processor directory
ls -d processor* | xargs -i rm -rf ./{} $1
runApplication decomposePar
runParallel potentialFoam 8 -noFunctionObjects -writep
runParallel `getApplication` 8

runApplication reconstructParMesh -constant
runApplication reconstructPar -latestTime
it s run ok, but at time 0 in paraFoam the apha1 field is not correct, wonder why???
i hope it's help Laurent

Abracurcix January 5, 2014 22:26

parallel snappyHexMesh
 
Hello All,
Pardon me for the slightly different question:

I have tried the LTSInterFoam wigleyHull example on a single processor and it works. I then tried doing the same run in parallel. Here are the steps I followed:

[1.] ran blockMesh
[2.] copied 0/alpha1.org to 0/alpha1
[3.] changed system/decomposeParDict by commenting "method simple;" and adding the line "method scotch;" I then ran decomposePar to get the four partitions.
[4.] I commented "method scotch;" in decomposeParDict and replaced it with "method ptscotch;" I then ran snappyHexMesh -parallel -overwrite on 4 processors.
[5.] I then ran setFields -parallel on 4 processors.

I saw the following problem in step [5.]:

[0] --> FOAM FATAL IO ERROR:
[0] Cannot find patchField entry for hull_wall
[1] [0]

I then checked the processor{0,1,2,3}/0/alpha1.gz files and I found that these files do not have the hull_wall entry

hull_wall
{
type zeroGradient;
}

that is present in the original (before mesh partition) 0/alpha1 file!

It is very likely that I am missing something in going from sequential to parallel. Could any of you please let me know where I am going wrong?

Cheers,
Albert

laurent98 January 6, 2014 03:08

1 Attachment(s)
hi Albert,
i am not a specialist, but may be you should reconstruct before doing setFields
here my allrun files
hope this will help you
cheers LL

Abracurcix January 6, 2014 03:37

Quote:

Originally Posted by laurent98 (Post 468797)
hi Albert,
i am not a specialist, but may be you should reconstruct before doing setFields
here my allrun files
hope this will help you
cheers LL

Thanks, Laurent! I'll try out what you have suggested. However, the incompressible/pisoFoam/les/motorBike/motorBike example suggests that we can do all the steps, from snappyHexMesh onwards, without having to go through the reconstructPar step. Also, it becomes a bit impractical for very large meshes is one has to do a reconstructPar followed by decomposePar, before running the solver.

Cheers,
Albert

laurent98 January 6, 2014 06:13

hi Albert,
no pb happy to help if i can. just if i didn t make mistake, in motobike there is no need of setFields because there is no alpha1 variable. with air and water you must set the value of alpha, i thought it could be done even on a decomposed case but i didn't find how... so since now between shm and the solver i reconstruct, setfields and decompose...
a+ LL

SAI_ November 25, 2018 08:32

2 Attachment(s)
Hello,

I am able to run snappyhexmesh in serial without problems, but when I try running in parallel, it fails to snap to edges and doesn't add layers. Does someone what the problem could be?
I attached the mesh that resulted from the serial and parallel runs, the snappyhexmeshDict which was the same for both and the log from the parallel run.

I am counting on you, forum:)

Thanks very much in advance!

EDIT: Nevermind, changing the type of the front and back planes from empty to patch fixed it!


All times are GMT -4. The time now is 11:53.