[Gmsh] unusable mesh for small "Characteristic Length"

Winfried Boxleitner winfried.boxleitner at ait.ac.at
Mon Dec 3 12:28:02 CET 2012


hello,

for small mesh sizes the attached geo-file produces a "chaotic" mesh,
i.e. the elements intersect, there is no defined outer surface spanned
by element faces etc.

if the "Characteristic Length" parameter for the mesh size is >= the
shorter length of the cuboid, all seems ok. however if I want a finer
mesh, the result of the meshing process is unusable, as described above.

I tested the script with:
   gmsh 2.6.2-svn (Build date: 20121120)
   gmsh 2.6.2-svn (Build date: 20121130)
   gmsh 2.6.2 (rev. 13442 (Build date: 20121003)
all gave the same result.

perhaps someone can tell what is wrong with the script?

thanks
winfried

-------------- next part --------------
//
// tested with:
// gmsh 2.6.2-svn (Build date: 20121120)
// gmsh 2.6.2-svn (Build date: 20121130)
// gmsh 2.6.2 (rev. 13442 (Build date: 20121003)
//
lc = 0.48; // set scaling parameter for meshing:
//
// WARNING: for lc < ledge/2 (smaller length in cuboid), the mesh calculated
// is "chaotic", i.e. the elements intersect, there is no defined outer surface
// spanned by element faces etc.
//
// define points of the cuboid (#1) without upper surface
//
ledge = 1.00;	// lenght parameter of cuboid edges
p1  =  newp;  Point(p1)  =  {  0,      0,      0       };
p2  =  newp;  Point(p2)  =  {  ledge,  0,      0       };
p3  =  newp;  Point(p3)  =  {  ledge,  ledge,  0       };
p4  =  newp;  Point(p4)  =  {  0,      ledge,  0       };
p5  =  newp;  Point(p5)  =  {  0,      0,      ledge/2 };
p6  =  newp;  Point(p6)  =  {  ledge,  0,      ledge/2 };
p7  =  newp;  Point(p7)  =  {  ledge,  ledge,  ledge/2 };
p8  =  newp;  Point(p8)  =  {  0,      ledge,  ledge/2 };
//
Characteristic Length { p1, p2, p3, p4, p5, p6, p7, p8 } = lc;
//
// define lines between these points,
//
l01  = newl;  Line(l01)  =  { p1, p4 };	//  e_y
l02  = newl;  Line(l02)  =  { p4, p3 };	//  e_x
l03  = newl;  Line(l03)  =  { p3, p2 };	// -e_y
l04  = newl;  Line(l04)  =  { p2, p1 };	// -e_x
l05  = newl;  Line(l05)  =  { p5, p6 };	//  e_x
l06  = newl;  Line(l06)  =  { p6, p7 };	//  e_y
l07  = newl;  Line(l07)  =  { p7, p8 };	// -e_x
l08  = newl;  Line(l08)  =  { p8, p5 };	// -e_y
l09  = newl;  Line(l09)  =  { p1, p5 };	//  e_z
l10  = newl;  Line(l10)  =  { p2, p6 };	//  e_z
l11  = newl;  Line(l11)  =  { p3, p7 };	//  e_z
l12  = newl;  Line(l12)  =  { p4, p8 };	//  e_z
//
// the "line loops" give the faces of the cuboid
// orientation: positive seen from outside
//
llx0  =  newll;  Line  Loop(llx0) = {  l01,  l12,  l08, -l09 }; // n = -e_x
llx1  =  newll;  Line  Loop(llx1) = {  l03, -l11,  l06,  l10 }; // n =  e_x
lly0  =  newll;  Line  Loop(lly0) = { -l04,  l10, -l05, -l09 }; // n = -e_y
lly1  =  newll;  Line  Loop(lly1) = { -l02, -l11, -l07,  l12 }; // n =  e_y
llz0  =  newll;  Line  Loop(llz0) = {  l01,  l02,  l03,  l04 }; // n = -e_z
llz1  =  newll;  Line  Loop(llz1) = {  l08,  l07,  l06,  l05 }; // n =  e_z

// define the faces:
//
sx00 =  news;  Plane Surface(sx00) = { llx0 };
sx10 =  news;  Plane Surface(sx10) = { llx1 };
sy00 =  news;  Plane Surface(sy00) = { lly0 };
sy10 =  news;  Plane Surface(sy10) = { lly1 };
sz00 =  news;  Plane Surface(sz00) = { llz0 };
//sz10 =  news;  Plane Surface(sz10) = { llz1 }; // => omit this surface

//
// define points of the cuboid (#2)
//
p1  = p5;
p2  = p6;
p3  = p7;
p4  = p8;
p5  =  newp;  Point(p5)  =  {  0,      0,      ledge   };
p6  =  newp;  Point(p6)  =  {  ledge,  0,      ledge   };
p7  =  newp;  Point(p7)  =  {  ledge,  ledge,  ledge   };
p8  =  newp;  Point(p8)  =  {  0,      ledge,  ledge   };
//
Characteristic Length { p1, p2, p3, p4, p5, p6, p7, p8 } = lc;
//
// define lines between these points,
//
l01  = newl;  Line(l01)  =  { p1, p4 };	//  e_y
l02  = newl;  Line(l02)  =  { p4, p3 };	//  e_x
l03  = newl;  Line(l03)  =  { p3, p2 };	// -e_y
l04  = newl;  Line(l04)  =  { p2, p1 };	// -e_x
l05  = newl;  Line(l05)  =  { p5, p6 };	//  e_x
l06  = newl;  Line(l06)  =  { p6, p7 };	//  e_y
l07  = newl;  Line(l07)  =  { p7, p8 };	// -e_x
l08  = newl;  Line(l08)  =  { p8, p5 };	// -e_y
l09  = newl;  Line(l09)  =  { p1, p5 };	//  e_z
l10  = newl;  Line(l10)  =  { p2, p6 };	//  e_z
l11  = newl;  Line(l11)  =  { p3, p7 };	//  e_z
l12  = newl;  Line(l12)  =  { p4, p8 };	//  e_z
//
// the "line loops" give the faces of the cuboid
// orientation: positive seen from outside
//
llx0  =  newll;  Line  Loop(llx0) = {  l01,  l12,  l08, -l09 }; // n = -e_x
llx1  =  newll;  Line  Loop(llx1) = {  l03, -l11,  l06,  l10 }; // n =  e_x
lly0  =  newll;  Line  Loop(lly0) = { -l04,  l10, -l05, -l09 }; // n = -e_y
lly1  =  newll;  Line  Loop(lly1) = { -l02, -l11, -l07,  l12 }; // n =  e_y
llz0  =  newll;  Line  Loop(llz0) = {  l01,  l02,  l03,  l04 }; // n = -e_z
llz1  =  newll;  Line  Loop(llz1) = {  l08,  l07,  l06,  l05 }; // n =  e_z

// define faces:
sx01 =  news;  Plane Surface(sx01) = { llx0 };
sx11 =  news;  Plane Surface(sx11) = { llx1 };
sy01 =  news;  Plane Surface(sy01) = { lly0 };
sy11 =  news;  Plane Surface(sy11) = { lly1 };
sz01 =  news;  Plane Surface(sz01) = { llz0 };
sz11 =  news;  Plane Surface(sz11) = { llz1 };

//
// build cuboid (#1)
//
surface[] = { sx00, sx10, sy00, sy10, sz00, sz01 };
outside = newsl; Surface Loop(outside) =  surface[];
vol = newv; Volume (vol) =  outside;

//
// build cuboid (#2)
//
surface[] = { sx01, sx11, sy01, sy11, sz01, sz11 };
outside = newsl; Surface Loop(outside) =  surface[];
vol = newv; Volume (vol) =  outside;

//
// build total cuboid
//
surface[] = { sx00, sx10, sy00, sy10, sx01, sx11, sy01, sy11, sz00, sz11 };
outside = newsl; Surface Loop(outside) =  surface[];
vol = newv; Volume (vol) =  outside;

Show "*";