[Gmsh] help refining a mesh around the boundary of a plane (3-D)
Terrence Moran
tpm92 at cornell.edu
Fri Jan 11 16:48:25 CET 2019
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!
Thanks,
Terrence
[image: photo1.PNG]
[image: 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;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20190111/5c57ece9/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: photo1.PNG
Type: image/png
Size: 213457 bytes
Desc: not available
URL: <http://onelab.info/pipermail/gmsh/attachments/20190111/5c57ece9/attachment-0002.PNG>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: photo2.PNG
Type: image/png
Size: 196612 bytes
Desc: not available
URL: <http://onelab.info/pipermail/gmsh/attachments/20190111/5c57ece9/attachment-0003.PNG>
More information about the gmsh
mailing list