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

Christophe Geuzaine cgeuzaine at ulg.ac.be
Fri Nov 9 15:38:38 CET 2007


Guangran Kevin Zhu wrote:
> 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.
> 


Hi - It's not documented yet, but with the latest nightly snapshot 
(http://geuz.org/gmsh/src/) you can do the following:


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

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

PostView Field(1) = 0; // first lc field is View[0]
Function Field(2) = "0.03"; // second field is constant
Characteristic Length Field {1,2}; // lc field is combination (min) of both

...


This will lead to much nicer meshes.






> =================================================
> // 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};
> 
> ================================================
> 
> _______________________________________________
> 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