[Gmsh] Variable characteristic length over a surface

Christophe Geuzaine cgeuzaine at ulg.ac.be
Thu May 26 22:11:04 CEST 2016


> On 26 May 2016, at 21:50, Karl Kästner <kastner.karl at gmail.com> wrote:
> 
> Hello,
> 
> I want to vary the element size over a surface. More specifically I want to geometrically increase the element size with increasing distance from the boundary. I tried to use the boundary layer option but this did not work, as the surface shape is nontrivial and the edge length has also to vary along the boundary.
> 
> Therefore I first generate an initial mesh, then compute the local element size at the interior points of the initial mesh, add the interior points of the initial mesh to the geometry file and finally generate a second mesh.
> 
> Unfortunately the points of the first mesh are also vertices of the second mesh, thus the element size of the second mesh cannot be lower than that of the first mesh. I tried to add the points to an attractor field, but gmsh displayed following warning and crashes:
> 
> Error   : Wrong mesh element size lc = 0 (lcmin = 0, lcmax = 1e+22)
> 

(the attractor returns distances, which can here be equal to zero when you are on the points)

Replace everything after 

  Plane Surface(1) = {1};

in your file with this:

  // field 1 computes the distance to your boundary
  Field[1] = Attractor;
  Field[1].NNodesByEdge = 100;
  Field[1].EdgesList = {1:32};

  // field 2 processes this distance to create a size field from 0.01 to 0.1
  Field[2] = Threshold;
  Field[2].IField = 1;
  Field[2].LcMin = 0.01;
  Field[2].LcMax = 0.1;
  Field[2].DistMin = 0.02;
  Field[2].DistMax = 0.5;
  Background Field = 2;

  // don't extend the size field from the boundary
  Mesh.CharacteristicLengthExtendFromBoundary = 0;

which will do what you want.






> Attached a trivial example reproducing the behaviour. Any help is appreciated.
> 
> Kind regards,
> 
> -- 
> Karl Kästner
> ------------
> Phd Student at Wageningen University & Research centre
> Hydrology and Quantitative Water Management Group
> Droevendaalsesteeg 3, Lumen building, 6708 PB Wageningen, The Netherlands
> Phone: +31617876970 (Netherlands) +491627351075 (Germany)
> Mail: kastner.karl at gmail.com
> <characteristic_length-line-00010-00001-000.2-1-resolution.geo>_______________________________________________
> gmsh mailing list
> gmsh at onelab.info
> http://onelab.info/mailman/listinfo/gmsh

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

Tetrahedron V, July 4-5 2016: http://tetrahedron.montefiore.ulg.ac.be
Free software: http://gmsh.info | http://getdp.info | http://onelab.info




More information about the gmsh mailing list