[Gmsh] Mesh size definition referring to surface or volume numbers.

Mark Starnes mark.starnes at fttech.co.uk
Wed May 25 12:15:31 CEST 2011


Hi Geordie,  thanks for the rapid reply.

Your example helped a great deal.  Thanks!
I went on with it, attempting to define the
field for more than one surface, using MathEval
to set the mesh size for an initial field, then 
defined a new second field for each surface using 
Restrict (following your example).

Can you tell me how to combine these field
definitions, please?  I tried Min, Max, MathEval
and MinAniso types to define my last field
(referenced as the background field) but the
element sizes in different regions all appear the
same.

I have attached my efforts (for what they are worth).  

Thanks again for the help.

Best regards,

Mark.



On Wed, May 25, 2011 at 02:45:38AM +0100, Geordie McBain wrote:
> 2011/5/25 Mark Starnes <mark.starnes at fttech.co.uk>:
> > Hi everyone,
> >
> > Can you please tell me if it is possible to
> > specify the size of elements in a region based on, for example, the
> > region number and a transition distance? ?I usually define my
> > element sizes during Point definitions and on
> > occasion using Fields, but I have some geometries
> > for which I would like to set the target element size by
> > Surface number or Volume number. ?The reason for
> > this is that I'm coupling regions with requiring
> > dissimilar mesh densities; these regions are
> > complex enough for me to feel apprehension at the
> > thought of attempting to define geometric objects
> > inside the regions to define mesh fields.
> >
> > Is this approach possible?
> 
> Yes, use Restrict
> <http://geuz.org/gmsh/doc/texinfo/gmsh.html#index-Restrict-309>.  For
> example, to refine just Plane Surface (9), use:
> 
>   Field[1] = MathEval;
>   Field[1].F = "0.1";
> 
>   Field[2] = Restrict;
>   Field[2].IField = 1;
>   Field[2].FacesList = {9};
> 
>   Background Field = 2;
> 
> I attach a complete example.




-- 
Dr. Mark Starnes
Senior Physicist
FT Technologies
Church Lane
Teddington
TW11 8PA

web:  www.fttech.co.uk
DDI:  0208 614 2730 
  
FT Technologies Limited is registered in England and Wales under registered number 01603909. Its registered office is at Church Lane, Teddington, Middlesex, TW11 8PA.
The information in this message is confidential and is intended only for the use of the intended recipient(s). If you are not an intended recipient, you should not disclose, use or copy this information. Please contact the sender immediately if you have received this message in error.
-------------- next part --------------
Point (1) = {0, 0, 0};		// -*- c++ -*-
Point (2) = {1, 0, 0};
Point (3) = {2, 0, 0};
Point (5) = {1, 1, 0};
Point (9) = {1, -1, 0};

Line(1) = {1, 2};
Line(2) = {2, 3};
Line(3) = {3, 5};
Line(5) = {5, 1};
Line(7) = {5, 2};


Line Loop(8) = {1, -7, 5};
Plane Surface (9) = {8};
Line Loop(10) = {7, 2, 3};
Plane Surface (11) = {10};

Line(12) = {1, 9};
Line(13) = {9, 2};
Line(14) = {9, 3};

Line Loop(15) = {1, -13, -12};
Plane Surface(16) = {15};
Line Loop(17) = {2, -14, 13};
Plane Surface(18) = {17}; 

Field[1] = MathEval;
Field[1].F = "0.01";  // Sets the element size in the left region (9)

Field[2] = MathEval;
Field[2].F = "0.02";  // Sets the element size in the left region (9)
 
Field[3] = MathEval;
Field[3].F = "0.04";  // Sets the element size in the left region (9)
 
Field[4] = Restrict;
Field[4].IField = 1;        
Field[4].FacesList = {9};

Field[5] = Restrict;
Field[5].IField = 2;
Field[5].FacesList = {11};

Field[6] = Restrict;
Field[6].IField = 3;
Field[6].FacesList = {16};

 
// Field[7] = Min;  // all elements are tiny.
// Field[7] = Max;  // all elements are large.
// Field[7].FieldsList = {1,2,3,4,5};

// Field[7] = MathEval;
// Field[7].F = "F4 + F5 + F6";  // All elements are the same size.

// Field[7] = MinAniso;
// Field[7].FieldsList = {4,5,6}; // All elements are large.

Background Field = 7;