|
[Sponsors] |
June 13, 2017, 08:07 |
Boundary layer in Gmsh with OpenCASCADE
|
#1 |
New Member
Malgorzata
Join Date: Jun 2017
Posts: 3
Rep Power: 9 |
Dear All,
I am trying to create a boundary layer for a u-bend circular pipe. I have used the elements of OpenCASCADE, such as disk and wire; therefore, I cannot add a boundary layer through simple extrusion. I tried using Field[]=BoundaryLayer, but that also did not produce 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 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 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[]}; } |
|
October 5, 2017, 10:15 |
|
#2 |
New Member
Join Date: Jan 2015
Posts: 4
Rep Power: 11 |
Hi chomikzimon,
I stumbled upon the very same problem and can't find a solution. I have been working on it for a while now. As I am additionally using boolean operators, I am also not able to work around the issue through using only functions that work with the SetFactory "built-in". Were you able to solve your problem? I would be very glad for any kind of help! |
|
October 5, 2017, 10:20 |
|
#3 |
New Member
Malgorzata
Join Date: Jun 2017
Posts: 3
Rep Power: 9 |
Hi,
Unfortunately, I don't think there is an easy way to do it in Gmsh at the moment. I moved to Salome instead. I am sorry for not being of much help. |
|
December 3, 2017, 08:50 |
Boundary in GMSH
|
#4 |
New Member
Leonardo
Join Date: Dec 2017
Posts: 2
Rep Power: 0 |
how can I make a duplicate mesh in the structure and not duplicate in the fluid in the GMSH?
Geometry is the cross section of the guitar, I'm having trouble putting just fluid in the sound hole of the guitar. and I need the mesh to be triangular regular between point(4) and point (5), it's the sound hole, and there I need it to be just fluid and the line(4) disappears. help me please, i'm beginner of scientific research msh code .geo dim = 34; gridsize = dim/4; dim2 = 38.3; gridsize2 = dim2/4; dim3 = 48; gridsize3 = dim3/4; Point(1) = {0, 0, 0, gridsize}; Point(2) = {dim3 , 0, 0, gridsize3}; Point(3) = {dim3 , 10.5, 0, gridsize3}; Point(4) = {dim2, 10.5, 0, gridsize2}; Point(5) = {dim, 10.5, 0, gridsize}; Point(6) = {0, 10.5, 0, gridsize2}; //+ Line(1) = {1, 2}; //+ Line(2) = {2, 3}; //+ Line(3) = {3, 4}; //+ Line(4) = {4, 5}; //+ Line(5) = {5, 6}; //+ Line(6) = {6, 1}; //+ Line Loop(1) = {6, 1, 2, 3, 4, 5}; //+ Plane Surface(1) = {1}; |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[snappyHexMesh] snappyHexMesh Boundary Layer at Corner | panpanzhong | OpenFOAM Meshing & Mesh Conversion | 5 | July 3, 2018 06:53 |
Problem in setting Boundary Condition | Madhatter92 | CFX | 12 | January 12, 2016 05:39 |
Wrong flow in ratating domain problem | Sanyo | CFX | 17 | August 15, 2015 07:20 |
Error finding variable "THERMX" | sunilpatil | CFX | 8 | April 26, 2013 08:00 |
[Gmsh] Default Faces on Boundary Layer | axel | OpenFOAM Meshing & Mesh Conversion | 8 | February 17, 2011 08:47 |