[Gmsh] Attractor around a point in 3D

Srinath Madhavan msrinath80 at yahoo.com
Sat Jan 10 13:51:25 CET 2009


Hi all,

I have a simple cube and a point at the center. Using attractors, I'm trying to refine the mesh around the point and make it coarse as we move away from the point. The code I use is pasted below:

************CODE BEGINS*************

lc = 0.15;
Point(1) = {-0.5, -0.5, -0.5, lc};
Point(2) = {0.5, -0.5, -0.5, lc};
Point(3) = {0.0, 0.0, 0.0, lc};
Line(3) = {1, 2};

e1[] = Extrude{0, 1, 0}{Line{3};};
e2[] = Extrude{0, 0, 1}{Surface{e1[1]};};

// Attractor field on point 3. This field returns the
// distance to point 3.
Field[1] = Attractor;
Field[1].NodesList = {3};

// Threshold field using the return value of the attractor field 1 in
// order to define a simple change in element size around the
// attractors (i.e., around point 3)
//
// LcMax -                         /------------------
//                               /
//                             /
//                           /
// LcMin -o----------------/
//        |                |       |
//     Attractor       DistMin   DistMax
Field[2] = Threshold;
Field[2].IField = 1;
Field[2].LcMin = lc / 30;
Field[2].LcMax = lc;
Field[2].DistMin = 0.05;
Field[2].DistMax = 0.5;

// Use minimum of all the fields as the background field
Field[3] = Min;
Field[3].FieldsList = {2};
Background Field = 3;

// Don't extend the elements sizes from the boundary inside the domain
Mesh.CharacteristicLengthExtendFromBoundary = 0;

Physical Volume("domain") = {e2[1]};
Physical Surface("wall") = {29,28,24,20,16,7};

************CODE ENDS*************

The mesh generation works but I don't see any refinement around point 3. If however, I change the line:

Field[1].NodesList = {3}; TO Field[1].NodesList = {1};

Then I see refinement around point 1. This works for point 2 as well.

Can someone point out what I'm doing wrong here?

Thanks & Best Regards,
Srinath Madhavan
PhD Student
University of Alberta

Free as in Freedom. May the source be with you!