Closed cwsmith closed 6 years ago
Yea, the first and last points need to be the exact same object in order for it to be topologically closed (otherwise its endpoints just happen to be at the same location, but its not topologically closed). Just add some logic to your loop so that the last point you add to the spline is the same object as the first point. Probably just store the first point in a variable for later use. Also I think you will get a different spline shape if you repeat the last point, so you may want to ignore the last point in your data file (or just assert that its the same as the first but don't create an object from it).
Success! Thank you. https://gist.github.com/cwsmith/99c95f1ec78389375ce3d32b3e234661/revisions
The next step is extruding. Adding the following call:
auto r = gmod::extrude_face(sq, gmod::Vector{0,0,.3}).middle;
produces
Attempting to generate a 2D mesh results in the following mesh without triangles on the airfoil surface:
and the following error:
Info : Meshing 2D...
Info : Meshing surface 110 (Plane, Delaunay)
Info : Meshing surface 221 (Ruled surface, MeshAdapt)
Error : Unable to recover the edge 84492 (21/21) on GEdge 100 (on GFace 221)
Warning : Surface 221 consists of no elements
Info : Meshing surface 224 (Plane, Delaunay)
Info : Meshing surface 227 (Plane, Delaunay)
Info : Meshing surface 230 (Plane, Delaunay)
Info : Meshing surface 233 (Plane, Delaunay)
Info : Meshing surface 234 (Plane, Delaunay)
Info : Done meshing 2D (0.035129 s)
Info : 991 vertices 1927 elements
Error : ------------------------------
Error : Mesh generation error summary
Error : 1 warning
Error : 1 error
Error : Check the full log for details
Error : ------------------------------
Info : Writing '/home/cwsmith/develop/build-gmodel/tests/gmsh2d.log'...
The only way I've found to extrude the surface with the airfoil cut out and mesh the resulting volume is by using the Geometry->Elementary entities->Extrude->Translate
tool in Gmsh as follows:
Which creates the following model:
Note, the .geo
files produced this way relies on the extrude
command(?) where it appears gmodel forms the volume by copying the source surface and connecting the two copies. I assume this is an important difference.
Below is the 3D mesh produced of the manually extruded model; it is simply an extrusion of the 2D surface mesh:
When the manual Gmsh extrusion is created without the 'extrude mesh' box selected, and the 2D mesher is executed, it produces what appears to be an identical error as seen with the gmodel:
Info : Meshing 2D...
Info : Meshing surface 110 (Plane, Delaunay)
Info : Meshing surface 120 (Ruled surface, MeshAdapt)
Info : Meshing surface 124 (Ruled surface, MeshAdapt)
Info : Meshing surface 128 (Ruled surface, MeshAdapt)
Info : Meshing surface 132 (Ruled surface, MeshAdapt)
Info : Meshing surface 136 (Ruled surface, MeshAdapt)
Error : Unable to recover the edge 39001 (1/21) on GEdge 100 (on GFace 136)
Warning : Surface 136 consists of no elements
Info : Meshing surface 137 (Plane, Delaunay)
Info : Done meshing 2D (0.181625 s)
Info : 1524 vertices 3016 elements
Error : ------------------------------
Error : Mesh generation error summary
Error : 1 warning
Error : 1 error
Error : Check the full log for details
Error : ------------------------------
Info : Writing '/home/cwsmith/develop/build-gmodel/tests/gmsh2d.log'...
Do you know if Gmsh supports generating a fully unstructured mesh of this model?
It should. Possibilities are: the edge is in the "wrong" direction, or Gmsh doesn't support loops with just one edge. I think the latter is more likely. If you can separate the spline into two that might help. You can also open Gmsh issues here and get feedback from their developers:
I was wondering about splitting the spline. I'll give that a shot.
Thanks for the pointer to gmsh support.
Success!
model:
3D unstructured tet mesh:
The code is here: https://github.com/cwsmith/gmodel/commits/airfoil
Should I create a PR to add this example, and the input data file?
Sure, thank you!
merged #8
I'm trying to create an airfoil geometric model using gmodel. I first create a loop, add a spline from the points defining the airfoil to the loop, create a square, then remove the loop from the square.
The source code and input set of airfoil points are here: https://gist.github.com/cwsmith/99c95f1ec78389375ce3d32b3e234661
Running it as:
airfoil e625.dat e625
produces the
.geo
and.dmg
as expected. When the.geo
is loaded into Gmsh and 2D meshing is executed the following error appears:If I manually edit the
e625.geo
file and add point 0 to the spline as follows:2D meshing executes successfully (screenshot attached).
Is there a quick fix for this? It seems like I'm somehow not closing the spline, in a way gmsh likes, in gmodel.
Thank-you, Cameron