# [Gmsh] How to generate several boundary layers ?

Tom aspyk51 at gmail.com
Mon Mar 2 13:29:16 CET 2015

```Hi everyone,

I want to generate a 2D rectangular mesh with a hole inside it. I would
like to add two differents boundary layers on the "external" wall and on
the "internal" wall, is it possible ?
I tried to make two BoundaryLayer fields and a "Min" field to merge them,
but it doesn't works. Note that if I make only one BoundaryLayer field
containing all the walls, it works but in this case the boundary layers are
identical.

Tom

Here is my geo file :

//---------------------------------------------------------------

r = 0.1;
h = 0.3;
ri1 = 0.045;
ri2 = 0.055;
hi1 = 0.03;
hi2 = 0.27;
r_c = 0.005;

Lc = 0.005;

Mesh.CharacteristicLengthExtendFromBoundary = 1;

Point(1) = {0, 0 , 0, Lc};
Point(2) = {r, 0 , 0, Lc};
Point(3) = {r, 0 , h, Lc};
Point(4) = {0, 0 , h, Lc};

Point(9) = {ri1, 0, hi1+r_c, Lc};
Point(10) = {ri1+r_c, 0, hi1, Lc};
Point(11) = {ri2, 0, hi1+r_c, Lc};
Point(12) = {ri1+r_c, 0, hi1+r_c, Lc};

Point(13) = {ri1, 0, hi2-r_c, Lc};
Point(14) = {ri1+r_c, 0, hi2, Lc};
Point(15) = {ri2, 0, hi2-r_c, Lc};
Point(16) = {ri1+r_c, 0, hi2-r_c, Lc};

// external wall
Line(1) = {1,2} ;
Line(2) = {2,3} ;
Line(3) = {3,4} ;
Line(4) = {4,1} ;

//internal wall
Line(6) = {11,15} ;
Line(8) = {13,9} ;
Circle(31) = {9,12,10};
Circle(32) = {10,12,11};
Circle(33) = {15,16,14};
Circle(34) = {14,16,13};

Line Loop(1) = {1,2,3,4};
Line Loop(2) = {31,32,6,33,34,8};

Plane Surface(1) = {1,2} ;

// internal boundary layer
Field[1] = BoundaryLayer;
Field[1].EdgesList = {6,8,31,32,33,34};
Field[1].hfar = 0.005;
Field[1].hwall_n = 0.0005;
Field[1].hwall_t = 0.001;
Field[1].ratio = 1.1;
Field[1].thickness = 0.002;
//BoundaryLayer Field = 1;

// external boundary layer
Field[2] = BoundaryLayer;
Field[2].EdgesList = {1,2,3,4};
Field[2].NodesList = {1,4};
Field[2].hfar = 0.005;
Field[2].hwall_n = 0.001;
Field[2].hwall_t = 0.002;
Field[2].ratio = 1.1;
Field[2].thickness = 0.003;