# [Gmsh] 3 levels of mesh refinement in a box

Olavo Luppi Silva olavo.luppi at ig.com.br
Mon Jun 28 19:30:53 CEST 2010

```Hi Eric
Thanks for your suggestion.
I admit that I haven't tried to mesh with the parameters you suggested, and
it remedy the problem somehow. Maybe this solution would lead to an
overrefined mesh. I realized that increasing Field[3].DistMax to a distance
proportional to the maximum dimension of the box led to a solution better
than reducing Field[3].LcMax.
I'll try to apply these principles to a more complex geometry and see what I
get.

Thanks again,
Olavo

2010/6/27 Eric Nutsch <ericnutsch at gmail.com>

> If I am understanding you correctly why not just change:
> Field[3].LcMax = lc; to Field[3].LcMax = lc/ 2;
>
> or maybe change:
> Field[3].DistMax = 1; to Field[3].DistMax = 5;
>
> Just some ideas
>
> Eric
>
>
>
> On Wed, May 26, 2010 at 2:48 PM, Olavo Luppi Silva
> <olavo.luppi at ig.com.br> wrote:
> > Dear gmsh community,
> >
> > I'm trying to make a 3D mesh of a box with 3 levels of mesh refinement.
> > Level 1, the mesh is coarse (lc), and should be used at the inner portion
> of
> > the box
> > Level 2, the mesh is intermediate (lc/8), and should be used near the
> faces
> > of the box
> > Level 3, the mesh is refined (lc/40), and should be used inside the
> circle
> > at one of the faces of the box.
> >
> > The file below shows the best I could get. Notice that at the top face,
> > element size is smaller (lc/8) near the vertices, and bigger (lc) at
> > interior, which is ok. At the front face, there are big elements (lc)
> near
> > tiny elements (lc/40) inside the circle. I'd like them to be medium size
> > (lc/8).
> > I tried to use
> >   Field[2] = Attractor;
> >   Field[2].FacesList = {1,2,4,5,6,27};
> >
> > instead of
> >    Field[2] = Attractor;
> >    Field[2].EdgesList = {1:12};
> >
> > But gmsh generated a bunch of errors. Any suggestions?
> >
> > Olavo Luppi
> >
> > =======================
> >
> > lc = 1.0;
> > L = 4;
> > W = 3;
> > h = 2.0;
> > R = 0.1;
> >
> > Point(1) = {0.0,0.0,0.0,lc};
> > Point(2) = {L,0.0, 0.0,lc};
> > Point(3) = {L,W,0.0,lc};
> > Point(4) = {0,W,0.0,lc};
> >
> > Point(5) = {0.0,0.0,h,lc};
> > Point(6) = {L,0.0,h,lc};
> > Point(7) = {L,W,h,lc};
> > Point(8) = {0,W,h,lc};
> >
> > Line(1) = {4,3};
> > Line(2) = {3,2};
> > Line(3) = {2,1};
> > Line(4) = {1,4};
> >
> > Line(5) = {5,6};
> > Line(6) = {6,7};
> > Line(7) = {7,8};
> > Line(8) = {8,5};
> >
> > Line(9) = {1,5};
> > Line(10) = {6,2};
> > Line(11) = {7,3};
> > Line(12) = {8,4};
> >
> > a[] = Point{1};
> > b[] = Point{2};
> > c[] = Point{6};
> > d[] = Point{5};
> >
> >
> > Point(20) = {(a[0]+b[0]+c[0]+d[0])/4,(a[1]+b[1]+c[1]+d[1])/4,
> > (a[2]+b[2]+c[2]+d[2])/4, lc};
> > centro[] = Point{20};
> >
> > Point(21) = {centro[0]+R, centro[1], centro[2],lc};
> > Point(22) = {centro[0], centro[1], centro[2]+R,lc};
> > Point(23) = {centro[0]-R, centro[1], centro[2],lc};
> > Point(24) = {centro[0], centro[1], centro[2]-R,lc};
> >
> >
> > Line Loop(1) = {2,3,4,1};
> > Line Loop(2) = {5,6,7,8};
> > Line Loop(3) = {9,5,10,3};
> > Line Loop(4) = {10, -2, -11, -6};
> > Line Loop(5) = {1, -11, 7, 12};
> > Line Loop(6) = {12, -4, 9, -8};
> >
> >
> > Plane Surface(1) = {1};
> > Plane Surface(2) = {2};
> > //Plane Surface(3) = {3};
> > Plane Surface(4) = {4};
> > Plane Surface(5) = {5};
> > Plane Surface(6) = {6};
> >
> >
> >
> > Circle(21) = {21, 20, 22};
> > Circle(22) = {22, 20, 23};
> > Circle(23) = {23, 20, 24};
> > Circle(24) = {24, 20, 21};
> >
> > Line Loop(25) = {21, 22, 23, 24};
> > Plane Surface(26) = {25};
> > Plane Surface(27) = {3, 25};
> >
> >
> > Surface Loop(28) = {2, 27, 6, 5, 1, 4, 26};
> > Volume(29) = {28};
> >
> > Field[1] = Attractor;
> > Field[1].NodesList = {20};
> >
> >
> > Field[2] = Attractor;
> > Field[2].EdgesList = {1:12};
> >
> > Field[3] = Threshold;
> > Field[3].IField = 1;
> > Field[3].LcMin = lc / 40;
> > Field[3].LcMax = lc;
> > Field[3].DistMin = R;
> > Field[3].DistMax = 1;
> >
> > Field[4] = Threshold;
> > Field[4].IField = 2;
> > Field[4].LcMin = lc / 8;
> > Field[4].LcMax = lc;
> > Field[4].DistMin = 0.3;
> > Field[4].DistMax = 1.5;
> >
> > // Use minimum of all the fields as the background field
> > Field[5] = Min;
> > Field[5].FieldsList = {3,4};
> > Background Field = 5;
> >
> >
> > // Don't extend the elements sizes from the boundary inside the domain
> > Mesh.CharacteristicLengthExtendFromBoundary = 0;
> >
> >
> > _______________________________________________
> > gmsh mailing list
> > gmsh at geuz.org
> > http://www.geuz.org/mailman/listinfo/gmsh
> >
> >
>
>
>
> --
> Eric Nutsch
> Mechanical Engineer, BSME, EIT
> bote Innovations LLC
> 1574 Coburg Road #145
> Eugene, OR 97401-4802
>
> Phone & Fax: 888.541.2683
> http://boteinnovations.com/
>
-------------- next part --------------
An HTML attachment was scrubbed...