[Gmsh] generating a sequence of meshes

Christophe Geuzaine cgeuzaine at ulg.ac.be
Tue Jan 10 20:20:28 CET 2017


Or you could also generate the meshes directly from the .geo file: here's how to generate both nested or simply refined meshes (run "gmsh file.geo -"):

lc = 0.5;
Point(1) = {0, 0, 0, lc};     Point(2) = {-0.5, -0, 0, lc};
Point(3) = {0, -0.5, 0, lc}; Point(4) = {0, 0.5, 0, lc};
Point(5) = {0.5, -0, 0, lc};
Circle(1) = {2, 1, 3}; Circle(2) = {3, 1, 5};
Circle(3) = {5, 1, 4}; Circle(4) = {4, 1, 2};
Line Loop(5) = {4, 1, 2, 3};
Plane Surface(6) = {5};
Mesh.Algorithm = 6;
// uncomment this to not put points on actual boundary
// Mesh.SecondOrderLinear = 1;
Mesh 2;
Save "initial.msh";
For i In {1:5}
  RefineMesh;
  Save Sprintf("nested_%g.msh", i);
EndFor
For i In {1:5}
  Mesh.CharacteristicLengthFactor = 1 / 2^i;
  Mesh 1;
  Mesh 2;
  Save Sprintf("refined_%g.msh", i);
EndFor



> On 10 Jan 2017, at 19:42, Jeremy Theler <jeremy at seamplex.com> wrote:
> 
> What about this?
> 
> gtheler at tom:~/run$ cat basic.geo.m4 
> Point(1) = {0, 0, 0, lc};     Point(2) = {-0.5, -0, 0, lc};
> Point(3) = {0, -0.5, 0, lc}; Point(4) = {0, 0.5, 0, lc};
> Point(5) = {0.5, -0, 0, lc};
> 
> Circle(1) = {2, 1, 3}; Circle(2) = {3, 1, 5};
> Circle(3) = {5, 1, 4}; Circle(4) = {4, 1, 2};
> 
> Line Loop(5) = {4, 1, 2, 3};
> Plane Surface(6) = {5};
> gtheler at tom:~/run$ for i in `seq 1 10`; do m4 -Dlc=$i/10 basic.geo >
> basic-$i.geo; gmsh -2 basic-$i.geo; done
> 
> 
> -- 
> Jeremy Theler
> www.seamplex.com
> 
> 
> 
> On Tue, 2017-01-10 at 15:57 +0000, Al wrote:
>> Hi,
>> 
>> 
>> I'd like to have a script that loads the file
>> 
>> "mybasidgeo.geo" and generates (and stores)
>> 
>> a sequence of meshes via uniform refinement.
>> 
>> In Section 3.2 of the manual it is mentioned that something
>> 
>> like this should be possible, but in the second line of Section 6.3
>> 
>> it is written that "The actual mesh “actions ... cannot be specified
>> in the script files"
>> 
>> 
>> This is a bit confusing. Shall I maybe use a makefile? How?
>> 
>> 
>> Many thanks
>> 
>> Alberto
>> 
>> P.s.:
>> 
>> 
>> 
>> The content of "mybasidgeo.geo" could be something like:
>> 
>> Point(1) = {0, 0, 0, 1.0};     Point(2) = {-0.5, -0, 0, 1.0};
>> Point(3) = {0, -0.5, 0, 1.0}; Point(4) = {0, 0.5, 0, 1.0};
>> Point(5) = {0.5, -0, 0, 1.0};
>> 
>> Circle(1) = {2, 1, 3}; Circle(2) = {3, 1, 5};
>> Circle(3) = {5, 1, 4}; Circle(4) = {4, 1, 2};
>> 
>> Line Loop(5) = {4, 1, 2, 3};
>> Plane Surface(6) = {5};
>> _______________________________________________
>> gmsh mailing list
>> gmsh at onelab.info
>> http://onelab.info/mailman/listinfo/gmsh
> 
> 
> _______________________________________________
> gmsh mailing list
> gmsh at onelab.info
> http://onelab.info/mailman/listinfo/gmsh

-- 
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science 
http://www.montefiore.ulg.ac.be/~geuzaine

Free software: http://gmsh.info | http://getdp.info | http://onelab.info




More information about the gmsh mailing list