Personal tools
You are here: Home Forum Use 2D mesh to OpenFOAM

2D mesh to OpenFOAM

Up to Use

2D mesh to OpenFOAM

Posted by Arsenis Chatzimichailidis at November 25. 2014

Hello,

I am using salome 740 to create a 2D mesh for an Openfoam simulation. As you most surely know, 2D simulation in openfoam use a 3D mesh and the "third" direction has one cell width. 

I haven't used the "traditional" approach (mesh: 3D extrusion, sub-meshes: 2D mesh front face, 2D projection to the back, 1D elements in the third direction).

Instead I used a compound shape for a face, to create a more complicated mesh in sub-meshes, in sub-shapes of the face. This resulted in a strictly 2D mesh, created on a "compound" geometry. 

How can I extrude this strlictly 2D mesh to a 3D mesh with on cell width in the third direction, to import it to Openfoam?

I tried to "extrude" the mesh (successfully I think), but the "create boundary elements" utility didn't work.

I tried also to copy and paste the 2D mesh in a new 3D mesh, but the "import 1d 2d elements from another mesh" asks for a source-face and doesn't accept the compound face on which all the mesh was built.

Any ideas?

Arsenis

Re: 2D mesh to OpenFOAM

Posted by Saint Michael at November 25. 2014

Hi Arsenis

I think your approach is better than 3D geometry etc.

I tried to "extrude" the mesh (successfully I think), but the "create boundary elements" utility didn't work.

What was wrong with "create boundary elements"? 

I suppose "create boundary elements" is not needed at all since "Extrusion" creates boundary 1D and 2D elements in addition to 3D elements.

St.Michael

Re: 2D mesh to OpenFOAM

Posted by Arsenis Chatzimichailidis at November 26. 2014

Thank you for your interest and your time!

After the extrusion to a distance (0 1 0), the utility "create boundary elements" replies that "0 boundary elements have been added".  In my case extrusion hasn't produced any group of boundary elements.
I also tried to create a mesh with the "3D geometry etc" way with a little more success. The new mesh uses the compound mesh for the front and etc etc, the only problem is the error "No nodes found above node 53642". Is there any threshold to the size of the mesh or is it caused by other reasons?
Any ideas?

Re: 2D mesh to OpenFOAM

Posted by Bernhard Linseisen at November 26. 2014

It is strange to me that you did not succeed. It worked like a charm for me just recently...

 

One of the important things: You will have to create the groups for the 2D-Mesh before the extrusion! If I remember correctly, afterwards I had the different groups (i.e. boundary elements) afterwards with a name extension "extruded".

You might also try to extrude the meshed group of the 2D surface instead of the mesh.

 

I will check again how I did this, unfortunately I am on another computer at the moment...

Re: 2D mesh to OpenFOAM

Posted by Saint Michael at November 26. 2014

Bernhard is right.

To get groups of boundary faces, before Extrusion you have to create groups of mesh edges that will be extruded into groups of faces and a group of faces that will be extruded into a group of "top" faces.

St.Michael

Re: 2D mesh to OpenFOAM

Posted by Arsenis Chatzimichailidis at November 27. 2014
Thank you very much for your help, time and cooperation!
 
It worked when I held in groups of faces the extruded boundary elements and the face of the 2D mesh.
 
For anyone may be interested, the whole process I used is described as:
1) create the vertices, then lines, then wires (edges) and finally faces that constitute the 2D mesh
2) build the faces in compound face and then explode it in faces and edges
3) build the compound mesh with generic arguments and then specify the parts of the mesh with submeshes on each shape or edge
4) create 1D boundary elements for the perimeter of the mesh and 2D for the compound face
5) transfer the boundaries from geometry to mesh (Create Groups from Geometry) and extrude the mesh. The 1D edge elements will become 2D shape elements and the 2D for shape will become 3D for volume. Delete the edge and volume boundaries and export the mesh.
 
A last (I hope) problem: when I use ideasUnvToFoam to convert to Openfoam mesh, there is an error "Found 40 undefined faces in mesh; adding to default patch"
Is it by any  chance a well-known error, a problem of the described process or anything else?
 
Thank you very much,
Arsenis

Re: 2D mesh to OpenFOAM

Posted by Arsenis Chatzimichailidis at November 28. 2014

I found the problem: in a case of tangent shapes, they had overlapping edges instead of sharing the same. That's why the extra boundary patches were created.

Again thank you for your help and your time!

Arsenis

Re: 2D mesh to OpenFOAM

Posted by Lee at March 18. 2016
i have had the same problem with undefined faces.
 
How did you troubleshoot this?  Did you run some special function in salome?  
 
Personally i really don't like using the GUI for my salome builds is there a way to do the troubleshooting from the TUI?
 
 

Re: 2D mesh to OpenFOAM

Posted by Saint Michael at March 18. 2016

Hi Lee

As far as I remember this error appears if there are non-conformal contacts between mesh domains. This can be healed by applying geompy.Partition() to the model before meshing. (Sometimes increasing tolerance geompy.LimitTolerance() maybe necessary before Partition).

In the case if nodes of the mesh domains are almost coincident, it's possible to heal the mesh by applying mesh.MergeNodes( mesh.FindCoincidentNodes( 1e-3) ), instead of partitioning the geometry model.

St.Michael

Re: 2D mesh to OpenFOAM

Posted by Bill Wang at January 22. 2017

Dear All,

i wonder if you guys could send me a salome file on how to draw finer mesh for a 2D complex geometry.

Thank you in advance.

Best Regards,

Bill

Re: 2D mesh to OpenFOAM

Posted by bullmut at April 15. 2018

Hi All

 

I stumbled across this thread as it is very relevaent to my current problem. I made a face in the geometry modeule and meshed in 2D. I am now trying to extrude the mesh to use ion openfoam. However when i extrude, i am getting face only on the groups i defined previously. Its not extruding my interal meshed zone.

I am at a loss.

I follwed the steps below in creating groups but its not working as expected i think i am stuck on step4/5

If anyone could help i would be grateful

Attached is an image of my current setup.

Previously Arsenis Chatzimichailidis wrote:

Thank you very much for your help, time and cooperation!
 
It worked when I held in groups of faces the extruded boundary elements and the face of the 2D mesh.
 
For anyone may be interested, the whole process I used is described as:
1) create the vertices, then lines, then wires (edges) and finally faces that constitute the 2D mesh
2) build the faces in compound face and then explode it in faces and edges
3) build the compound mesh with generic arguments and then specify the parts of the mesh with submeshes on each shape or edge
4) create 1D boundary elements for the perimeter of the mesh and 2D for the compound face
5) transfer the boundaries from geometry to mesh (Create Groups from Geometry) and extrude the mesh. The 1D edge elements will become 2D shape elements and the 2D for shape will become 3D for volume. Delete the edge and volume boundaries and export the mesh.
 
A last (I hope) problem: when I use ideasUnvToFoam to convert to Openfoam mesh, there is an error "Found 40 undefined faces in mesh; adding to default patch"
Is it by any  chance a well-known error, a problem of the described process or anything else?
 
Thank you very much,
Arsenis

 

Attachments

Re: 2D mesh to OpenFOAM

Posted by Saint Michael at April 16. 2018

Hi 

I could help. Provide a detailed description of your problem. Sharing your data would be very useful.

St.Michael

 

Re: 2D mesh to OpenFOAM

Posted by bullmut at April 16. 2018

Hi St Michael

Thanks for the reply, i managed to finally extrude a single face mesh. But the problems only really started after that

I am doing a 2d airfoil simulation. I have been dumping the study as i progress and now have a python script to generate the foil and mesh on a single face. I then group the edges from the geometry, and the face into another group. I have managed to perform extrusion by distance or by vector - ExtrusionSweepObjects() - Its around this part that i get lost.

After the extrusion i groups for edges, faces and volumes. When i export the unv file openfoam does not like all the extra groups. so i first delete the edge and volume group. Considering my mesh was originally 2D and i extrude a single step of specified distance i am not understanding how i get the errors in the attached file.

non closed cells, Zero or negative face area detected, Zero or negative cell volume detected, Number of non-orthogonality errors, Error in face pyramids etc...

I was successful up to an hour ago ( yes that recent but now all my extruded meshes are failing horribly)

If you need more info i can send my python script. It needs some additional .py files that it calls during execution. But as i said the geometry portion works rather well.

Previously Saint Michael wrote:

Hi 

I could help. Provide a detailed description of your problem. Sharing your data would be very useful.

St.Michael

 

 

Attachments

Re: 2D mesh to OpenFOAM

Posted by bullmut at April 16. 2018

I have attached a zip folder with the python scripts to run.

You can run either file with the word geoAndMesh in the name. The difference only being the airfoil final shape.

Thank in adv

Attachments

Re: 2D mesh to OpenFOAM

Posted by Saint Michael at April 17. 2018

Hi

I extruded the mesh generated by newFOILgeoAndMesh.py and I see no errors in the mesh.  :(

St.Michael

Re: 2D mesh to OpenFOAM

Posted by bullmut at April 17. 2018

Hi

I also had success once :(

When i tried it again, no luck. The file you ran, ended with the creation of groups for the faces, correct?

The very next command:

[ bladeTop_extruded, bladeBot_extruded, inlet_extruded, outlet_extruded, topAndBottom_extruded, internal_extruded, bladeTop_top, bladeBot_top, inlet_top, outlet_top, topAndBottom_top, internal_top ] = FACE_ready_1.ExtrusionSweepObjects( [ FACE_ready_1 ], [ FACE_ready_1 ], [ FACE_ready_1 ], [ 0, 0, 0.1 ], 1, 1 )

which runs, then i delete the additional edges and volumes and export as unv.

I just performed the steps above and using openFOAMs checkMesh utility you can see the errors i get in the file attached. To ease my mind i then viewed the mesh in paraview. Seems only the boundary patches are giving me issues.

Previously Saint Michael wrote:

Hi

I extruded the mesh generated by newFOILgeoAndMesh.py and I see no errors in the mesh.  :(

St.Michael

 

Attachments

Re: 2D mesh to OpenFOAM

Posted by bullmut at April 17. 2018

I am attaching the paraview output visually. I dont understand how the outer boundaries get extruded incorrectly while the foil shape and internal faces seem to have been done correctly.

could it be the unv export function?

I was going to use the script by Nicolas (http://www.salome-platform.org/forum/forum_12/23863165) but i havent figure out how to auto script the deletion of edges and volumes in my python script. and his script needs to be called at the end.

 

Thanks again for taking time to help me with this

Attachments

Re: 2D mesh to OpenFOAM

Posted by bullmut at Tuesday 23:05

UPDATE:

I haven't found the reason behind my problem but i have narrowed it down and found a work around.

 

The script i wrote will do an extrusion from a face. however when i export the unv file openFOAM will see corrupted faces.

Instead i stop my script in the GEOM module and perform the exact mesh instructions through the gui.

 

I cant say why this works but its the only way i have been successful to date.

Re: 2D mesh to OpenFOAM

Posted by bullmut at Wednesday 16:46

New update, i have an image as to why my mesh is not working. I have no idea why it happens but i know whats wrong.

I extrude an edge by 1 step. for some reason the nodes on the extrude surface dont line up. See attached image.

Instead of a quad face, i have triangles.

I am so far down the rabbit hole i cant claim to see a way out.

Any help is appreciated. the issue is now solely with the extrusion function :(

Attachments
Powered by Ploneboard
Document Actions