[Gmsh] 3D structured mesh in a box

Christophe Geuzaine cgeuzaine at ulg.ac.be
Thu Jan 31 18:31:18 CET 2013


On 27 Oct 2012, at 01:33, Oluwaseun Sharomi <oluwaseun.sharomi at usask.ca> wrote:

> Hello,
> 
> I am trying to generate a 3D structured mesh and my code is given below.
> 
> Point(1) = {0, 0, 0, 1e+022};
> Point(2) = {2, 0, 0, 1e+022};
> Point(3) = {0, 0.7, 0, 1e+022};
> Point(4) = {2, 0.7, 0, 1e+022};
> Line(1) = {1,2};
> Line(2) = {2,4};
> Line(3) = {4,3};
> Line(4) = {3,1};
> Line Loop(5) = {1,2,3,4};
> Plane Surface(5) = {5};
> Transfinite Line{1} = 21 Using Progression 1;
> Transfinite Line{2} = 8 Using Progression 1;
> Transfinite Line{3} = 21  Using Progression 1;
> Transfinite Line{4} = 8 Using Progression 1;
> Extrude {0,0,0.3} { Surface{5}; Layers{3}; Recombine;}
> Transfinite Surface{5};
> 
> While there are 21 points in Line(1), the points are not equally spaced. I expected
> 
> 0 0.1 0.2 0.3 0.4 0.5
> 
> but i keep getting
> 
> 0 0.09999999 0.199999999 0.2999999999 0.3999999999 0.499999999999
> 

That's because we use numerical integration to space the points... and machines with finite precision arithmetic :-)

> What can i do to have equally spaced values.
> 
> Sharomi
> 
> 
> 
> _______________________________________________
> 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