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] Convert a 3D mesh into a 2D mesh (https://www.cfd-online.com/Forums/openfoam-meshing/230732-convert-3d-mesh-into-2d-mesh.html)

AKRES October 3, 2020 12:27

Convert a 3D mesh into a 2D mesh
 
Hello everyone :):)


I have to solve a 2D case of a Numerical Wave Flume. However, I had to build the mesh in 3D using SnappyHexMeh due to some refinement around the free surface and above an obstacle in the center of the channel.


To be able to use Snappy I set as "patch" the regions that should have been "empty", ie the "front" and "back" regions. In order to transform the case from 3D to 2D I used "extrudeMesh", in order to have only one cell in the direction transverse to the fluid motion.


I then manually modified the "boundary" file in the "polymesh" folder, bringing the "front" and "back" faces that were initially set as "patch" to the "empty" condition.

I have already set, in the "0" folder, all conditions on the "front" and "back" regions as "empty" in order to simulate the 2D case.

The setFields command runs successfully, but the "interFoam" solver crashes immediately. Do any further changes need to be made to other files to properly start the case in 2D from a 3D mesh made with SnappyHexMesh?


Thank you all:):)

Marpole October 3, 2020 19:23

Your procedure seems correct. We usually follow these 3 steps: 3D snappyHexMesh, 2D extrusion, and rewrite boundary conditions. What's the error message if there is any? As you are using interFoam, this is multi-phase solver and needs to be more careful on setting up boundary and initial condition. Can you first test your mesh using simpleFoam, which at least remove one uncertainty, i.e. multi-phase.

AKRES October 4, 2020 06:14

1 Attachment(s)
Dear Marpole,



Thank you for your time.



Unfortunately the "Foam Fatal Error" does not provide any explanation regarding the interruption of interFoam execution.
Because of this, I don't understand what mistakes I'm making.


Do you have any idea why no explanation is given for the error?


I will certainly follow your advice using simpleFoam.



Thanks again for your time.

Marpole October 4, 2020 10:59

I see the model has a few more features: dynamic mesh and wave. The failure could be caused by many factors. Meshing is one of them and may not be the cause. To isolate the problem, can you run one feature at one time, i.e. deactivate other features and focus on interfoam and mesh? Also you may want to check setField result by using paraFoam after command setField and before command interFoam?

otaolafr October 7, 2020 04:43

hello,
sorry to bother but seeing that you are working in something similar, i thought about giving a chance and ask,
I want to do a 2D case, from a 3D mesh too so,
1.I create the different boundaries in salome in the 3D model
2.I use snappyHex (with the creation of the background mesh with blockMesh)
-----up to here is what i know how to do correctly-----
3. I should use extrudeMesh? from the doc i could not find a lot of info http://cpp.openfoam.org/v8/extrudeMesh_8C.html
4. add the new patches? as the patch that is going to keep extrudedMesh is one of the empty faces, the patches then are added by topoSet? or you use another tool for this?
thanks

Marpole October 7, 2020 13:36

Yes, after finishing snappyHexMesh, you should use extrudeMesh.



In order to use extrudeMesh, you'll need to write your own extrudeMeshDict and place it in folder system. Some example of extrudeMeshDict can be found in https://github.com/OpenFOAM/OpenFOAM...xtrudeMeshDict .



In the extrudeMeshDict, you will define a new name for the new patch, which you will change the patch type to "empty" for 2D model. You don't need to use topoSet for this change.

Konrad95 December 4, 2020 04:53

Hello Marpole,


how do I define a new name for the new patch and change the patch type to "empty" in the ExtrudeMeshDict?



Thank you very much in advance.

Marpole December 4, 2020 11:24

Hi Konrad,

If the model is not too complex, you can simply modify the patch type in file boundary in folder constant/polymesh. Hope this is a quick fix.


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