[Gmsh] Boundary layer and OpenCASCADE
malgorzata.zimon at stfc.ac.uk
malgorzata.zimon at stfc.ac.uk
Tue Jun 13 12:59:41 CEST 2017
Dear All,
I am trying to create a boundary layer for a u-bend circular pipe. I have used OpenCASCADE elements such as disk and wire; therefore, I cannot add a boundary layer through simple extrusion as I am receiving an error. I tried using Field[], but that also did not produced anything. Could you please advise me on how to fix this issue? Please find my script below.
Thank you!
SetFactory("OpenCASCADE");
/********************************************************************************/
/* ** Choose general settings ** */
Mesh.CharacteristicLengthMin = 0.05;
Mesh.CharacteristicLengthMax = 0.05;
Geometry.NumSubEdges = 100; // nicer display of curve
General.Color.Text = Black;
Geometry.Color.Points = Purple;
General.Color.Background = White;
General.Color.Text = Black;
Mesh.Color.Points = {255,0,0};
//Mesh.Algorithm3D = 4;
//Mesh.Smoothing = 100;
//Mesh.Optimize=1;
//Mesh.OptimizeNetgen=1;
//Mesh.OptimizeNetgen=1;
/* ** Define constants ** */
DefineConstant[
npts = {16, Name "Number of points in the bend"}
r = {0.38, Name "Bend radius"}
rd = {0.125, Name "Radius of the cross-section"}
mes = {1e-2, Name "Mesh element size"}
lh = {1.49, Name "Length of the horizontal section"}
lv1 = {0.74, Name "Length of the 1st vertical section"}
lv2 = {2.07, Name "Length of the 2nd vertical section"}];
/********************************************************************************/
/* ** Create the first elbow ** */
For i In {0:npts}
theta = i * 0.5 * Pi/npts;
Point(i + 1) = {r * Cos(-theta), r * Sin(-theta), 0, mes};
EndFor
nr[] += 1;
Spline(nr[0]) = {1:npts+1};
Wire(nr[0]) = {1};
Disk(nr[0]) = {0,-r,0, rd};
Rotate {{0, -r, 0}, {0, 0, 0}, Pi/2} {Surface{nr[0]};}
my_volumes[] += Extrude { Surface{nr[0]}; } Using Wire {nr[0]};//pipe
/* ** Translate and duplicate the end point to create the horizontal section ** */
my_new_points[] += Translate {-lh, 0, 0} { Duplicata{ Point{npts+1}; }};
nr[] += newreg;
Spline(nr[1]) = {npts + 1, my_new_points[0]};
Wire(nr[1]) = {nr[1]};
Disk(nr[1]) = {0, -r, 0, rd};
Rotate {{0, -r, 0}, {0, 0, 0}, Pi/2} {Surface{nr[1]};}
my_volumes[] += Extrude { Surface{nr[1]}; } Using Wire {nr[1]};
/* ** Create the second elbow ** */
p1 = newp;
For i In {0:npts}
theta = i * 0.5 * Pi/npts;
Point(i + p1) = {-lh -r * Cos(-theta), r * Sin(-theta), 0, mes};
EndFor
p2 = newp;
nr[] += newreg;
Spline(nr[2]) = {p1:p2-1};
Wire(nr[2]) = {nr[2]};
Disk(nr[2]) = {-1.87, 0, 0, rd};
Rotate {{-(lh + r), 0, 0}, {0, 0, 0}, Pi/2} {Surface{nr[2]};}
my_volumes[] += Extrude { Surface{nr[2]}; } Using Wire {nr[2]};
/* ** Translate and duplicate a point to create of the upstream vertical section ** */
my_new_points[] += Translate {0, lv1, 0} { Duplicata{ Point{p1}; }};
nr[] += newreg;
Spline(nr[3]) = {p1, my_new_points[1]};
Wire(nr[3]) = {nr[3]};
Disk(nr[3]) = {-(lh + r),0,0, rd};
Rotate {{-(lh + r), 0, 0}, {0, 0, 0}, Pi/2} {Surface{nr[3]};}
my_volumes[] += Extrude { Surface{nr[3]}; } Using Wire {nr[3]};
/* ** Translate and duplicate a point to create of the downstream vertical section ** */
my_new_points[] += Translate {0, lv2, 0} { Duplicata{ Point{1}; }};
nr[] += newreg;
Spline(nr[4]) = {1, my_new_points[2]};
Wire(nr[4]) = {nr[4]};
Disk(nr[4]) = {r, 0, 0, rd};
Rotate {{0.38, 0, 0}, {0, 0, 0}, Pi/2} {Surface{nr[4]};}
my_volumes[] += Extrude { Surface{nr[4]}; } Using Wire {nr[4]};
//Printf("Surface id: %g", nr[0]);
Delete{ Surface{nr[]}; }
--
Dr Małgorzata Zimoń
Postdoctoral Researcher, IBM
Daresbury Laboratory
Keckwick Lane, Warrington
WA4 4AD
United Kingdom
--
Email (IBM): malgorzata.zimon at uk.ibm.com
Email (STFC): malgorzata.zimon at stfc.ac.uk
Tel: (+44) 01925 60 3301
More information about the gmsh
mailing list