[Gmsh] Difficulty with generating a volume mesh from a stl file

Geordie McBain gdmcbain at freeshell.org
Tue May 26 02:47:06 CEST 2015


2015-05-26 2:06 GMT+10:00 David Love <dml42 at cam.ac.uk>:
> Dear Sir/Madam,
>
> I have been experiencing difficulties generating a volume mesh (.geo and
> .msh) from a surface mesh (.stl) generated in matlab. The main issue is that
> I end up with zero volume tetrahedra (elements with four collinear points)
> which causes difficulties in subsequent finite element simulations.
>
> I have attached an example of a surface mesh (.stl) that I start off with. I
> then use the procedure outlined in the following link to create the volume
> mesh (.geo and .msh):
> http://fengl.org/2012/05/21/converting-stl-surface-mesh-to-volume-mesh-using-gmsh/
>
> My questions are:
> - Is there a way to avoid zero volume tetrahedra or does the issue originate
> from the matlab generated stl file? Do you have a suggestion to avoid this
> issue?

Hello.  I had a go at your STL surface and it seemed to work here.

I meshed it with the attached, no frills, .geo file.

To check that the mesh was O. K., I solved a Poisson problem on the
volume with uniform forcing and zero Dirichlet conditions using P1
elements in FreeFem++, using the attached .edp script.

It computes the volume as 0.54956, the area as 15.7748, and the
integral of the solution as 0.000286442.
  I don't think that this would work if there were degenerate
elements.  Is it possible that the error is in the solver rather than
the mesh?


> - Is there a possibility of generating a volume mesh in GMSH by defining the
> surface boundary in an equation? For instance if I describe my shape in form
> of a triple sinusoidal (as done in the matlab code) and then tell GMSH to
> mesh the inner volume. If so could you point me towards some examples?

I don't think that this can be done in a .geo file, but your first
approach of generating the STL externally and merging it into Gmsh
should work as you expected.

I'm using gmsh 2.9.4 (compiled under 64-bit Debian from SVN sources),
in case that matters.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Plane111_UnitCellCountXYZ331_VolumeFraction13_NetworkNR1.geo
Type: application/octet-stream
Size: 164 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20150526/de37f460/attachment.geo>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: poisson.edp
Type: application/octet-stream
Size: 308 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20150526/de37f460/attachment.edp>


More information about the gmsh mailing list