# [Gmsh] restrict field

Christophe Geuzaine cgeuzaine at ulg.ac.be
Mon Mar 15 13:53:22 CET 2010

```On 15/03/10 13:06, David Colignon wrote:
>
> On 15/03/10 09:17, Stéphane BLANCHET wrote:
>> Hi,
>>
>> This a simple exemple I used to understand how works this field:
>>
>>
>>
>> Point(1)= {0,0,0};
>> Point(2)= {1,0,0};
>> Point(3)= {1,1,0};
>> Point(4)= {0,1,0};
>> Point(5)= {0,2,0};
>> Point(6)= {1,2,0};
>> Line(1) = {1, 2};
>> Line(2) = {2, 3};
>> Line(3) = {3, 4};
>> Line(4) = {4, 1};
>> Line(5) = {4, 5};
>> Line(6) = {5, 6};
>> Line(7) = {6, 3};
>> Line Loop(8) = {5, 6, 7, 3};
>> Plane Surface(9) = {8};
>> Line Loop(10) = {3, 4, 1, 2};
>> Plane Surface(11) = {10};
>> Extrude {0, 0, 1} {
>> Surface{9, 11};
>> }
>> Physical Surface(56) = {9, 28, 20, 33, 24};
>> Physical Surface(57) = {32};
>> Physical Surface(58) = {11, 54, 55, 46, 50};
>> Physical Volume(59) = {1};
>> Physical Volume(60) = {2};
>>
>> Field[1] = Restrict;
>> Field[1].EdgesList = {6, 19, 14, 23, 7, 5, 13, 15, 3, 18, 16, 27};
>> Field[1].FacesList = {24, 9, 28, 33, 20, 32};
>> Field[1].RegionsList = {1};
>> Background Field = 1;
>>
>> So, with this field, I want to mesh only the first volume.
>
> Hi Stéphane,
>
> if you want to mesh only the first Volume, just add
>
> Delete { Volume {2} ; }
>
> after the extrusion command, or delete the line
>
> Physical Volume(60) = {2};
>
> the second volume will be meshed, but the 3D mesh will not be saved in
> the .msh file
>

PS : the Restrict field is used to restrict the application of another
field to some geometrical entities. In your case the "other field" was
set to 1 (the default value), which caused an infinite recursion. This
has now been fixed in the code.

Here's an example of how you can use the Restrict field:

res1  = 1e-1;
x = 1.0;
y = 0.1;

a0 = newp; Point(a0) = {0,0,0,res1};
a1 = newp; Point(a1) = {-x,0,0,res1};
a2 = newp; Point(a2) = {x,0,0,res1};

la1 = newl; Circle(la1) = {a1,a0,a2};
la2 = newl; Circle(la2) = {a2,a0,a1};

loop = newll; Line Loop(loop) = {la1,la2};

sa = news; Plane Surface(sa) = {loop};

Point(4) = {-2, -2, 0};
Point(5) = {2, -2, 0};
Point(6) = {2, 2, 0};
Point(7) = {-2, 2, 0};
Line(5) = {4, 5};
Line(6) = {5, 6};
Line(7) = {6, 7};
Line(8) = {7, 4};
Line Loop(9) = {7, 8, 5, 6};
Plane Surface(10) = {9, 3};

Field[1] = Attractor;
Field[1].EdgesList = {la1,la2,6};
Field[1].NNodesByEdge = 100;

Field[2] = MathEval;
Field[2].F = Sprintf("F1^2 + %g", res1/4);

Field[3] = Restrict;
Field[3].IField = 2;
Field[3].FacesList = {10};
Field[3].EdgesList = {la1,la2, 5:8};

Field[4] = MathEval;
Field[4].F = "0.2";

Field[5] = Restrict;
Field[5].IField = 4;
Field[5].FacesList = {sa};

Field[6] = Min;
Field[6].FieldsList = {3,5};

Background Field = 6;

Mesh.CharacteristicLengthExtendFromBoundary = 0;

> Regards,
>
> Dave
>
>
>> But every time I click on the "mesh" button, GMsh crashes.
>>
>> Regards
>>
>> //Stéphane
>>
>>
>>
>>
>>
>>
>> > Date: Sun, 14 Mar 2010 08:45:52 +0100
>> > From: David.Colignon at ulg.ac.be
>> > To: stephane.blanchet at esstin.uhp-nancy.fr
>> > CC: gmsh at geuz.org
>> > Subject: Re: [Gmsh] restrict field
>> >
>> > Hi Stéphane,
>> >
>> > can you send us your .geo file and a description of the steps you
>> follow, so that we can try to reproduce the "crash" ?
>> >
>> > Regards,
>> >
>> > Dave
>> >
>> > --
>> > David Colignon, Ph.D.
>> > Collaborateur Logistique du F.R.S.-FNRS
>> > CÉCI - Consortium des Équipements de Calcul Intensif
>> > ACE - Applied & Computational Electromagnetics
>> > Institut Montefiore B28
>> > Université de Liège
>> > 4000 Liège - BELGIQUE
>> > Tél: +32 (0)4 366 37 32
>> > Fax: +32 (0)4 366 29 10
>> > WWW: http://hpc.montefiore.ulg.ac.be/
>> > Agenda:
>> >
>> > On 13/03/10 15:31, Stéphane BLANCHET wrote:
>> > >
>> > > Hello,
>> > >
>> > > I would like to know if the field "restrict" really works!
>> > > Indeed, every time I try to use this field on simple geometries, Gmsh
>> > > crashes!
>> > >
>> > > Best Regards
>> > >
>> > >
>> > > ---------------
>> > >
>> > > BLANCHET Stéphane
>> > >
>> > > Elève-Ingénieur ESSTIN (5 Année)
>> > > Option: Mécanique des Fluides et Énergétique
>> > >
>> > > Tél: 0632224601
>> > > Mail: stephane.blanchet at esstin.uhp-nancy.fr
>> > >
>> > > Ecole Supérieure des Sciences et Technologies de l'Ingénieur de Nancy
>> > > Université Henri Poincaré Nancy I
>> > > 2, rue Jean Lamour
>> > > 54 519 - Vandoeuvre Lès Nancy
>> > >
>> > >
>> > >
>> > >
>> > >
>> ------------------------------------------------------------------------
>> > > Hotmail débarque sur votre téléphone ! Paramétrez Hotmail sur votre
>> > > téléphone! Gratuit !
>> <http://www.messengersurvotremobile.com/?d=Hotmail>
>> > >
>> > >
>> > >
>> > > _______________________________________________
>> > > gmsh mailing list
>> > > gmsh at geuz.org
>> > > http://www.geuz.org/mailman/listinfo/gmsh
>> >
>>
>> ------------------------------------------------------------------------
>> Télécharger en toute sécurité sur Internet ? La solution avec Internet
>> Explorer 8 <http://clk.atdmt.com/FRM/go/206608211/direct/01/>
>>
>>
>> _______________________________________________
>> gmsh mailing list
>> gmsh at geuz.org
>> http://www.geuz.org/mailman/listinfo/gmsh
>>
>
>
> _______________________________________________
> gmsh mailing list
> gmsh at geuz.org
> http://www.geuz.org/mailman/listinfo/gmsh

--
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science
http://www.montefiore.ulg.ac.be/~geuzaine

```