[Gmsh] Imported stl mesh size control

look mlook at me.com
Tue Jul 14 10:10:58 CEST 2015


Hello everybody,

very recently I found the following post from Prof. Geuzaine:

Ashton Peters wrote:
> Hi,
> 
> I have an stl file generated in another program that I want to use as input, and create a 3D tetrahedral mesh with Gmsh. I can import the stl by opening a .geo file with the following contents into Gmsh:
> 
> Merge "surf.stl";
> Surface Loop (1)= {1};
> Volume (1)= {1};
> Recombine Surface {1};
> 
> ... here obviously my stl file is called "surf.stl".
> 
> After importing the stl I can generate a 3D mesh easily.
> 
> The problem is that I have no idea how to impose any kind of size control on the 3D elements Gmsh creates. All I want to do is control mesh size using a single number that represents an average element edge length (or similar) across the entire mesh. Characteristic lengths don't seem to work, as my stl import has no points associated with it that I can assign a characteristic length. I've tried Fields, but nothing I try seems to have any effect on the size of the final mesh - it always ends up with the same size elements!
> 
> I'm sure Gmsh can do this (very simple) task, but I am getting lost amongst a lot of very flexible, complicated, and sparsely-documented controls, and I'm now stuck.
> 
> Can someone please tell me what I need to do to impose a constant size control on an imported stl file when meshing with simple tetrahedral elements? Ideally I want Gmsh to re-mesh the surface with the new element size before meshing the internal volume.
> 
> Thanks in advance for any help. I'm using Gmsh 2.2.0 on Windows, ideally in non-interactive mode.

Hi Ashton - The case of STL files is a bit special: since there is no 
CAD, Gmsh infers the size of the elements inside from the size of the 
elements on the boundary. To disable this, use

Mesh.CharacteristicLengthExtendFromBoundary = 0;

Then you can fix the size inside using the usual options, e.g.:

Mesh.CharacteristicLengthMax = the_max_elem_size_you_want;



> 
> Ashton
> 


-- 
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science
http://www.montefiore.ulg.ac.be/~geuzaine <http://www.montefiore.ulg.ac.be/~geuzaine>
Since I am experiencing the very same problem at the moment, I created the following *.geo file, strongly influenced by the above post:

——————————————————————————————————————————

Merge "geometry.stl“; // My *.stl consists of 7 patches
Surface Loop (1) = {1, 2, 3, 5, 6, 7}; // Theses 6 patches indicate the 6 walls of my wind tunnel; patches „front“ and „back“ have each a hole in it (see next line).
Surface Loop (2) = {4}; // Patch 4 is the surface of my geometry of interest. It spans from „front“ to „back“ and hence closes my overall geometry again. It can be imagined as a pipe. 
Volume (1) = {1, 2}; // Surface Loop defines my external boundary, Surface Loop 2 defines a hole in my Volume
Recombine Surface {1};

Mesh.CharacteristicLengthExtendFromBoundary = 0;
Mesh.CharacteristicLengthMax = 1;

——————————————————————————————————————————

Unfortunately my internal element sizes are huge and somehow they don’t change no matter what I enter for Mesh.CharacteristicLengthMax. Any comments on the above procedure are welcome. 

Thanks in advance and best regards,

Kate


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20150714/4031db58/attachment.html>


More information about the gmsh mailing list