Hello,

I am facing a problem when I try to mesh by using mesh element size. In
the attached script, I define a rectangle. I compute the element size,
and, based on that, I determine the number of elements to apply on the
edge (in this particular case, it is 6).
When I run the script like this, I just retrieve 5 elements instead of 6
(see attached picture). But if I define explicitly "nb_elem_x = 6;",
everything is working fine.

Could you please tell me what is wrong in my script ?

Thanks a lot in advance for your help,

Jean-Pierre.

-- 
Jean-Pierre LEFEBVRE
Cenaero France SASu
462 Rue Benjamin Delessert, BP 83
Z.I. de Moissy-Cramayel
F-77554 Moissy-Cramayel
France
Tél: + 33 (0)1 64 13 54 29
[email protected]

+-+-+- Disclaimer +-+-+-
www.cenaero.be/disclaimer


x_max = 1.2;
y_max = 5.;

Point(1) = {0.0, 0.0, 0.0};
Point(2) = {x_max, 0.0, 0.0};
Point(3) = {x_max, y_max, 0.0 };
Point(4) = {0.0,  y_max, 0.0};

Line(1) = {1, 2};
Line(2) = {2, 3};
Line(3) = {3, 4};
Line(4) = {4, 1};

Line Loop(1) = {1,2,3,4};
Plane Surface(1)={1};

// -- Calcul taille maille 
x_elm_size = 0.2;
y_elm_size = 1.5;

// -- Calcul nb elements sur chaque edge
nb_elem_x = x_max/x_elm_size; // = 1.2 / 0.2 = 6 Elements
nb_elem_y = y_max/y_elm_size;
// nb_elem_x = 6;
//
// --- Calculs nb noeuds
nb_nodes_x = nb_elem_x +1; // = 6 + 1 = 7 noeuds
nb_nodes_y = nb_elem_y +1;
// nb_nodes_x = 7;


Transfinite Line{1, -3} = nb_nodes_x;
Transfinite Line{2, 4} = nb_nodes_y ;
Transfinite Surface{1};
Recombine Surface{1};
//

<<inline: Mesh_generated_by_script.png>>

_______________________________________________
gmsh mailing list
[email protected]
http://www.geuz.org/mailman/listinfo/gmsh

Reply via email to