<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hello everybody,<div class=""><br class=""></div><div class="">very recently I found the following post from Prof. Geuzaine:</div><div class=""><br class=""></div><div class=""><pre style="line-height: 1.2em; font-size: 11px; padding: 1em; border: 1px dashed rgb(47, 111, 171); background-color: rgb(243, 247, 255);" class="">Ashton Peters wrote:
><i style="line-height: 1.35;" class=""> Hi,
</i>><i style="line-height: 1.35;" class="">
</i>><i style="line-height: 1.35;" class=""> 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:
</i>><i style="line-height: 1.35;" class="">
</i>><i style="line-height: 1.35;" class=""> Merge "surf.stl";
</i>><i style="line-height: 1.35;" class=""> Surface Loop (1)= {1};
</i>><i style="line-height: 1.35;" class=""> Volume (1)= {1};
</i>><i style="line-height: 1.35;" class=""> Recombine Surface {1};
</i>><i style="line-height: 1.35;" class="">
</i>><i style="line-height: 1.35;" class=""> ... here obviously my stl file is called "surf.stl".
</i>><i style="line-height: 1.35;" class="">
</i>><i style="line-height: 1.35;" class=""> After importing the stl I can generate a 3D mesh easily.
</i>><i style="line-height: 1.35;" class="">
</i>><i style="line-height: 1.35;" class=""> 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>><i style="line-height: 1.35;" class="">
</i>><i style="line-height: 1.35;" class=""> 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.
</i>><i style="line-height: 1.35;" class="">
</i>><i style="line-height: 1.35;" class=""> 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.
</i>><i style="line-height: 1.35;" class="">
</i>><i style="line-height: 1.35;" class=""> Thanks in advance for any help. I'm using Gmsh 2.2.0 on Windows, ideally in non-interactive mode.
</i>
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;
><i style="line-height: 1.35;" class="">
</i>><i style="line-height: 1.35;" class=""> Ashton
</i>><i style="line-height: 1.35;" class="">
</i>
--
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science
<a href="http://www.montefiore.ulg.ac.be/~geuzaine" style="line-height: 1.35; text-decoration: none; color: rgb(11, 0, 128); background-image: none; background-position: initial initial; background-repeat: initial initial;" class="">http://www.montefiore.ulg.ac.be/~geuzaine</a></pre><div class="">Since I am experiencing the very same problem at the moment, I created the following *.geo file, strongly influenced by the above post:</div></div><div class=""><br class=""></div><div class="">——————————————————————————————————————————</div><div class=""><br class=""></div><div class=""><div class="">Merge "geometry.stl“; // My *.stl consists of 7 patches</div><div class="">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).</div><div class="">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. </div><div class="">Volume (1) = {1, 2}; // Surface Loop defines my external boundary, Surface Loop 2 defines a hole in my Volume</div><div class="">Recombine Surface {1};</div><div class=""><br class=""></div><div class="">Mesh.CharacteristicLengthExtendFromBoundary = 0;</div><div class="">Mesh.CharacteristicLengthMax = 1;</div></div><div class=""><br class=""></div><div class="">——————————————————————————————————————————</div><div class=""><br class=""></div><div class="">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. </div><div class=""><br class=""></div><div class="">Thanks in advance and best regards,</div><div class=""><br class=""></div><div class="">Kate</div><div class=""><br class=""></div><div class=""><br class=""></div></body></html>