[Gmsh] Apply background mesh to a portion of the geometry

Guangran Kevin Zhu sket16 at gmail.com
Tue Nov 6 16:59:34 CET 2007


Hello Folks,

I am working on a problem, in which I need to apply to apply a
background mesh to a portion of a 2D geometry. GMSH could properly
generate a non-uniform mesh over the region where the background mesh
is applied. However, in the region which does not have a background
mesh, triangular elements with accute angles are generated. These
elements will introduce errors when I solve the wave equation.

I also tried to insert some "dummy" geometrical entities over the
regions without the background mesh. The problem is not alleviated. Is
this a limitation of GMSH when handling this kind of problem? Is there
a workaround?

I have modified t7.geo from the tutorial to illustrate my point below.
When you generate the mesh, you will see some ill-shaped elements in
the outer layer.

=================================================
// Merge the first tutorial
Merge "t1.geo";

// Merge a post-processing view containing the target mesh sizes
Merge "bgmesh.pos";

// Apply the view as the current background mesh
Background Mesh View[0];

Point(5) = {-0.1,-0.1,0,0.01};
Point(6) = {0.2,-0.1,0,0.01};
Point(7) = {0.2,0.4,0,0.01};
Point(8) = {-0.1,0.4,0,0.01};
Line(101) = {8,5};
Line(102) = {5,6};
Line(103) = {6,7};
Line(104) = {7,8};
Line Loop(105) = {104,101,102,103};
Plane Surface(106) = {105,5};

Point(11) = {-0.2, -0.2,0, 0.03};
Point(12) = {0.3, -0.2, 0, 0.03};
Point(13) = {0.3, 0.5, 0, 0.03};
Point(14) = {-0.2, 0.5, 0, 0.03};


Line(107) = {14,13};
Line(108) = {13,12};
Line(109) = {12,11};
Line(110) = {11,14};
Line Loop(111) = {108,109,110,107};
Plane Surface(112) = {105,111};

================================================