[Gmsh] STL meshing problem.

Martin Vymazal martin.vymazal at vki.ac.be
Mon Dec 5 10:59:48 CET 2011


Hi Jie,

 first, I'd break the surface of the object into several separate sub-surfaces 
(which then should be easier to mesh). Open model.stl in gmsh (with gui) and 
do the following:

click on Mesh->Reclassify 2D

a new dialog window ('Reclassify 2D') pops up. The dialog window has steps 
1,2, and 3. Click on 'All' in step 1 and on 'All' in step 3. Then click on 
'Reclassify'. 

Save the reclassified mesh as a new msh file (which I call 
reclassified_model.msh). When you open this new file and you go to visibility 
(Tools->Visibility) you should see several distinct surfaces (in my machine, 
they're numbered 2,3,4,5 and 6).

Then you can write a new file (remesh.geo), with the following contents:

==================================

Mesh.RemeshAlgorithm=1;
CharacteristicLengthFactor = 0.5;

Merge "reclassified_model.msh";

CreateTopology;

Compound Surface(12) = {2};
Compound Surface(13) = {3};
Compound Surface(14) = {4};
Compound Surface(15) = {5};
Compound Surface(16) = {6};

==================================

The 'Compound Surface' statement tells gmsh to take an existing surface(s) and 
remesh it.

Finally, you run 

gmsh -2 remesh.geo

To create a volume, you'll need a surface loop (see gmsh manual and tutorials)

P.S. The stl file that you sent has really a poor surface representation and 
gmsh struggles with it (I actually tried to remesh your surface, gmsh does 
something, but saves an invalid mesh). If you can, start your remeshing with 
something better.

I'm not a gmsh expert, maybe there's a better way to do this. Check also gmsh 
wiki:

https://geuz.org/trac/gmsh/wiki/STLRemeshing

user name and passwd is 'gmsh'

Best regards,

  Martin Vymazal


On Friday 02 December 2011 14:50:54 Jie Chen wrote:
> Hi,
> 
> I am new to gmsh. I want to mesh some geometry like this stl model.
> The first thing I want to do is remesh the surface mesh then generate
> the volume mesh. Later on, I would like to remesh it with some
> boundary layers from the cylinder. I tried a few times. However, I
> failed. Is there any tutorial to similar problem? Or could someone
> please to help me?
> 
> Thanks,
> 
> Jie