CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Open Source Meshers: Gmsh, Netgen, CGNS, ... (http://www.cfd-online.com/Forums/openfoam-meshing-open/)
-   -   Axisymmetric model from STEP in GMSH (http://www.cfd-online.com/Forums/openfoam-meshing-open/94153-axisymmetric-model-step-gmsh.html)

eric.m.tridas November 7, 2011 14:43

Axisymmetric model from STEP in GMSH
 
Hey Foamers,

I'm trying to create an axisymmetric model in GMSH for OpenFOAM using complex geometry created with SolidWorks and saved as a STEP file. I am able to import everything successfully to GMSH unfortunately I seem to be stuck trying to figure out how to generate a single cell thick mesh.

I've made several axisymmetric models using the CAD functions in GMSH (and thanks to the tutorial I found on this site) but the geometry I am working with now is too complex to create directly. I am assuming there is some function within GMSH to create a mirrored mesh on either side of the "wedge" and use the "recombine" and "layers{1}" commands to make the model 1 element thick.

If anyone has any ideas how to do this it'd be greatly appreciated! Thanks in advance.

-Eric

gschaider November 8, 2011 05:39

Quote:

Originally Posted by eric.m.tridas (Post 331085)
Hey Foamers,

I'm trying to create an axisymmetric model in GMSH for OpenFOAM using complex geometry created with SolidWorks and saved as a STEP file. I am able to import everything successfully to GMSH unfortunately I seem to be stuck trying to figure out how to generate a single cell thick mesh.

I've made several axisymmetric models using the CAD functions in GMSH (and thanks to the tutorial I found on this site) but the geometry I am working with now is too complex to create directly. I am assuming there is some function within GMSH to create a mirrored mesh on either side of the "wedge" and use the "recombine" and "layers{1}" commands to make the model 1 element thick.

If anyone has any ideas how to do this it'd be greatly appreciated! Thanks in advance.

-Eric

Maybe this is a typical instance of "if you have a hammer, every problem looks like a nail" on my side, but if I understand you correctly it would be sufficient for you to generate the axial mesh from a 2D-cut through the geometry. Just generate a 2D-polyMesh (which is one cell thick) using the mesh-converter of your choice (I think there is one for gmsh). Then use one of these 2 utilities:
  1. extrudeMesh (which comes with OF) allows you to generate a mesh with more than one layer using one of the boundary patches. If I remember it correctly it can do rotational
  2. makeAxialMesh (look for it on the openfoamwiki) which generates an axial mesh from a 2D-mesh.

Bernhard

eric.m.tridas November 8, 2011 10:31

Hey Bernhard,

Thanks for your quick response.

I was thinking the same thing that you suggested. My problem now is getting the 2D mesh out of SolidWorks. I've reduced the geometry to a single 2D sketch but when I attempt to save this as any of the formats GMSH accepts (STL, IGS, STEP) it tells me I do not have any 3D data to export.

So, I'm thinking I don't I quite understand your statement:

Quote:

Just generate a 2D-polyMesh (which is one cell thick) using the mesh-converter of your choice (I think there is one for gmsh)
If you could elaborate a little more on this I would appreciate it. Thanks again!

-Eric

gschaider November 9, 2011 13:37

Quote:

Originally Posted by eric.m.tridas (Post 331199)
Hey Bernhard,

Thanks for your quick response.

I was thinking the same thing that you suggested. My problem now is getting the 2D mesh out of SolidWorks. I've reduced the geometry to a single 2D sketch but when I attempt to save this as any of the formats GMSH accepts (STL, IGS, STEP) it tells me I do not have any 3D data to export.

So, I'm thinking I don't I quite understand your statement:



If you could elaborate a little more on this I would appreciate it. Thanks again!

-Eric

Sorry. I'm not really mesher and I havn't worked with the tools you mention. My best guess would be to extrude the 2D-Sketch to a thin "board" export that to Gmsh. Either mesh it there with prisms or get rid of everything except one side of the board, mesh that patch in 2D and extrude the mesh to a prism mesh (don't know if that is possible in Gmsh). That's as far as I can help you here

eric.m.tridas November 10, 2011 14:00

Hey Bernhard,

I was actually able to figure my problem out.

The first issue I was having with exporting a 2D sketch from SolidWorks was resolved when I changed some of the export settings. I disabled the export of surfaces and instead exported only 3D curves which worked "fine".

After doing this another problem arose where I was not able to define a plane out of this imported 2D sketch. I merged the STEP file in GMSh and re-saved it as a *.geo file. After examining the points within the file I realized that none of my points were in the same plane. Each point was at a different depth in the z-axis (although very close to zero, ~+-1e-16) as well as many duplicate points.

I manually went in and changed each z coordinate to 0 and put the "Coherence" command in the *.geo file to remove any duplicate points. I then redrew all of the lines, defined my plane, rotated and extruded and finally meshed.

Although I was able to solve the problem it was by no means elegant and was very time consuming. I'm sure that there is some easier way to fix this (or maybe there isn't and SolidWorks just isn't good when it comes to exporting STEP files.)

I don't think this will be the last complex axisymmetric geometry I'll work with so if there is some way that you (or anyone else) knows how to remove these extra points and get them all in plane easily in GMSH I'd really like to know. Thanks for your help thus far!

-Eric

gschaider November 10, 2011 20:46

Quote:

Originally Posted by eric.m.tridas (Post 331616)
Hey Bernhard,

I was actually able to figure my problem out.

The first issue I was having with exporting a 2D sketch from SolidWorks was resolved when I changed some of the export settings. I disabled the export of surfaces and instead exported only 3D curves which worked "fine".

After doing this another problem arose where I was not able to define a plane out of this imported 2D sketch. I merged the STEP file in GMSh and re-saved it as a *.geo file. After examining the points within the file I realized that none of my points were in the same plane. Each point was at a different depth in the z-axis (although very close to zero, ~+-1e-16) as well as many duplicate points.

I manually went in and changed each z coordinate to 0 and put the "Coherence" command in the *.geo file to remove any duplicate points. I then redrew all of the lines, defined my plane, rotated and extruded and finally meshed.

Although I was able to solve the problem it was by no means elegant and was very time consuming. I'm sure that there is some easier way to fix this (or maybe there isn't and SolidWorks just isn't good when it comes to exporting STEP files.)

I don't think this will be the last complex axisymmetric geometry I'll work with so if there is some way that you (or anyone else) knows how to remove these extra points and get them all in plane easily in GMSH I'd really like to know. Thanks for your help thus far!

-Eric

As I said: meshing is not my strong foot. Just one idea: did you try to NOT edit the 1e-16-coordinates away. Because they are basically zero and in a lot of programs they will be treated as 0. And even if these "amost 0"-values propagate to OpenFOAM OF won't care

Punit Walia September 20, 2013 07:47

2 Attachment(s)
Hi,
I created an axisymmetric cd-nozzle geometry in Gmsh using this technique:-
1. Make a 2D sketch of your problem
2. Rotate the sketch -2.5 in radian (-0.04363323129985824)
3. Extrude (revolve) 5 in radian (0.08726646259971647)
4. save mesh
5. Type
$ gmshToFoam yormesh.msh

CheckMesh is okay when i have not changed the original boundary file generated after giving gmshToFoam command. But all the boundary surfaces in the original file are type "patch". So, when i am changing the front and back faces to type "wedge", it shows this error on checkMesh:-
Create polyMesh for time = 0

Time = 0

Mesh stats
points: 16996
faces: 67960
internal faces: 45032
cells: 22816
faces per cell: 4.95231
boundary patches: 5
point zones: 0
face zones: 0
cell zones: 1

Overall number of cells of each type:
hexahedra: 0
prisms: 21440
wedges: 0
pyramids: 288
tet wedges: 0
tetrahedra: 1088
polyhedra: 0

Checking topology...
Boundary definition OK.
Cell to face addressing OK.
Point usage OK.
Upper triangular ordering OK.
Face vertices OK.
Number of regions: 1 (OK).

Checking patch topology for multiply connected surfaces...
Patch Faces Points Surface topology
back 11264 5797 ok (non-closed singly connected)
outlet 96 144 ok (non-closed singly connected)
inlet 24 36 ok (non-closed singly connected)
front 11264 5797 ok (non-closed singly connected)
top 280 423 ok (non-closed singly connected)

Checking geometry...
Overall domain bounding box (-0.7438 0 -0.218097) (12.1005 5 0.218097)
Mesh (non-empty, non-wedge) directions (1 1 0)
Mesh (non-empty) directions (1 1 1)
Wedge back with angle 2.50001 degrees
***Wedge patch back not planar. Point (2.56934 0.241647 -0.0105505) is not in patch plane by 6.36005e-08 meter.
Boundary openness (-5.60725e-17 1.39206e-16 2.691e-15) OK.
Max cell openness = 3.01524e-16 OK.
Max aspect ratio = 3.0152 OK.
Minimum face area = 0.000175677. Maximum face area = 0.0287618. Face area magnitudes OK.
Min volume = 4.15765e-06. Max volume = 0.00113603. Total volume = 6.86392. Cell volumes OK.
Mesh non-orthogonality Max: 84.3209 average: 13.3594
*Number of severely non-orthogonal faces: 832.
Non-orthogonality check OK.
<<Writing 832 non-orthogonal faces to set nonOrthoFaces
Face pyramids OK.
Max skewness = 0.505184 OK.
Coupled point location match (average 0) OK.

Failed 1 mesh checks.

----------------------------------------------------------------------------------
Please someone help me out with this problem.
Thanks


All times are GMT -4. The time now is 05:01.