[Gmsh] uniform mesh refinement
Christophe Geuzaine
cgeuzaine at ulg.ac.be
Sat Feb 22 12:25:55 CET 2014
On 22 Feb 2014, at 12:01, Jaensson, N.O. <n.o.jaensson at tue.nl> wrote:
> Dear Gmsh users,
>
> I use Gmsh to generate quite simple 2nd-order 2D meshes, where one of the boundaries is part of a circle. I would like to perform a mesh convergence study of my FEM code, so I would like to be able to start with a coarse mesh, which is subsequently uniformly refined a number of times. If I load my .geo file into the GUI, I generate the coarsest mesh by subsequently clicking "2D" in the "Mesh" section, and then "Set order 2", this aligns the midpoints of the quadratic elements nicely on the circle. If I now click "Refine by splitting", a first order, refined mesh is created. Clicking "set order 2", converts this into a second order mesh where the midpoints of the quadratic elements align nicely with the circle again. The problem is that I have no idea how to do this using the command line, which I mainly use to generate meshes from within the FEM code.
>
> I am able to uniformly refine my mesh using the command line, by following the suggestions in this thread:
>
> http://www.geuz.org/pipermail/gmsh/2013/008004.html
>
> However, the midpoints of the quadratic elements on the boundary are just inserted between the existing nodes, and not on the circle. I guess since the .msh file is used, the geometric information is lost, and new nodes are just inserted between the existing nodes.
>
> Since the GUI is able to do this, I expect that it is also possible from the command line. Any help would be much appreciated!
>
Hi Nick,
Create a file that contains something like this:
Merge "demos/sphere.geo";
Mesh 2;
SetOrder 2;
Save Sprintf("mesh%03g.msh", 0);
For i In {1:3}
RefineMesh;
SetOrder 2;
Save Sprintf("mesh%03g.msh", i);
EndFor
Then run it from the command line with "gmsh myscript -"
Hope this helps,
Christophe
> Kind regards,
> Nick
>
>
>
> _______________________________________________
> gmsh mailing list
> gmsh at geuz.org
> http://www.geuz.org/mailman/listinfo/gmsh
--
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science
http://www.montefiore.ulg.ac.be/~geuzaine