[Gmsh] Question about mesh refinement with stating of characteristic lengths

Christophe Geuzaine cgeuzaine at ulg.ac.be
Fri Jul 25 17:25:29 CEST 2008


Moritz Nadler wrote:
> Good Day Mr Geuzaine,
> 
> I tried to rebuild the example with slightly different values but I 
> failed. I looked at it a over an hour but I simple cannot find the error.
> 
> The example you sent me works fine when compile with the command:
> gmsh -rand 1.e-8 example.geo -2
> 
> But this example:
> 
> //begin "my example"
> lowPr =   0.1;
> 
> Point(1) = {0,0,0,lowPr};
> Point(2) = {1,0,0,lowPr};
> Point(3) = {1,1,0,lowPr};
> Point(4) = {0,1,0,lowPr};
> Point(5) = {0.5,0.5,0,0};
> 
> Line(1) = {1,2};
> Line(2) = {2,3};
> Line(3) = {3,4};
> Line(4) = {4,1};
> 
> Line Loop(5) = {1,2,3,4};
> Plane Surface(6) = {5};
> 
> Field[1] = Attractor;
> Field[1].NodesList = {5};
> 
> Field[2] = Threshold;
> Field[2].IField = 1;
> Field[2].LcMin = 0.0001;
> Field[2].LcMax = lowPr;
> Field[2].DistMin = 0.005;
> Field[2].DistMax = 0.01;
> 
> Background Field = 2;
> 
> //end "my example"
> 
> compiled with the same command does not.
> There is no higher mesh dentistry in the middle of the mesh as one would 
> expect form the code.


Indeed. The problem comes from the fact that DistMax is smaller than
LcMax. During the refinement step the algorithm just (unluckily) never
inserts a point inside the small DistMax-radius disk, and so ignores the
constraint altogether. That's definitely a limitation of our current
implementation.

It should work if you set Field[2].DistMax=lowPr. With the last nightly
build you can also ask to use a sigmoid transition instead of a linear
transition (Field[2].Sigmoid=1;)



> 
> 
> kind regards
> 
> 
> Moritz Nadler
> 
> 
> Christophe Geuzaine wrote:
> 
>> It does... The threshold field works like this:
>>
>> LcMax -                         /------------------
>>                               /
>>                             /
>>                           /
>> LcMin -o----------------/
>>        |                |       |
>>     Attractor       DistMin   DistMax
>>
>> At the moment the variation between LcMin and LcMax is always linear. 
>> It might be nice to code other variations (power, log, ...): have a 
>> look at Mesh/Field.cpp if you want to do that.
>>
>> Here's an example:
>>
>> // linear grading of charact lengths, from lc1 (near the attractor
>> // points) to lc2 (at a distance >= r away from the attractor points)
>>
>> lc1 = 0.001;
>> lc2 = 0.1;
>> r = 0.5;
>>
>> Point(1) = {0,0,0,lc2};
>> Point(2) = {1,0,0,lc2};
>> Point(3) = {1,1,0,lc2};
>> Point(4) = {0,1,0,lc2};
>> Line(1) = {3,2};
>> Line(2) = {2,1};
>> Line(3) = {1,4};
>> Line(4) = {4,3};
>> Line Loop(5) = {1,2,3,4};
>> Plane Surface(6) = {5};
>>
>> Point(10) = {0.3,0.5,0};
>> Point(11) = {0.35,0.5,0};
>>
>> Field[1] = Attractor;
>> Field[1].NodesList = {10,11};
>>
>> Field[2] = Threshold;
>> Field[2].IField = 1;
>> Field[2].LcMin = lc1;
>> Field[2].LcMax = lc2;
>> Field[2].DistMin = lc1;
>> Field[2].DistMax = r;
>>
>> Background Field = 2;
> 
> 
> 
> 


-- 
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science
http://www.montefiore.ulg.ac.be/~geuzaine