[Gmsh] help refining a mesh around the boundary of a plane (3-D)

Terrence Moran tpm92 at cornell.edu
Mon Jan 14 17:44:21 CET 2019


Works great. Thanks  Christophe!

Cheers,
Terrence

On Sat, Jan 12, 2019 at 8:36 AM Christophe Geuzaine <cgeuzaine at uliege.be>
wrote:

>
>
> On 11 Jan 2019, at 16:48, Terrence Moran <tpm92 at cornell.edu> wrote:
>
> Hello all,
>
> I am trying to refine a mesh to be very fine around a curve and very
> coarse away from it. This works very well using one or two curves (photo 1)
> using Distance and Threshold. When I try and do more curves (completing a
> circuit)  the mesh becomes fine everywhere on the plane (Photo 2) ignoring
> the mesh size at DistMax. I understand there are other functions such as
>  Box or cylinder but I need this to work for any geometry. My code is
> below, It is a simple example of a box. The loop is to find the lines that
> make up the surface on which I am trying to refine the boundary. Any help
> would be greatly appreciated!
>
>
> Setting Mesh.CharacteristicLengthExtendFromBoundary = 0; should do the
> trick.
>
> Christophe
>
>
>
>
> Thanks,
> Terrence
> <photo1.PNG>
> <photo2.PNG>
> //+
> SetFactory("OpenCASCADE");
> ShapeFromFile("box.iges")
> //+
> lns[];
> h = 0;
> For i In {1:newl-1}
> pnts[] = Boundary{Line{i};};
> Printf("line %g",i);
> Printf("point one = %g",pnts[0]);
> Printf("point two = %g",pnts[1]);
> coords1[] = Point{pnts[0]};
> coords2[] = Point{pnts[1]};
> If(coords1[2]==254 && coords2[2]==254)// 254=top surface z coord
>   Printf("line %g is on boundary",i);
>   lns[h] = i;
>   h = h+1;
> EndIf
> EndFor
> Field[1] = Distance;
> Field[1].EdgesList = {lns[]};
> Field[1].NNodesByEdge = 100;
> Field[2] = Threshold;
> Field[2].IField = 1;
> Field[2].LcMin = 0.5;
> Field[2].LcMax = 100;
> Field[2].DistMin = 1;
> Field[2].DistMax = 50;
> Background Field = 2;
>
>
> _______________________________________________
> 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
>
> Free software: http://gmsh.info | http://getdp.info | http://onelab.info
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20190114/556b089a/attachment.html>


More information about the gmsh mailing list