CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   Gmsh crashes and gives a segfault when trying to extrude mesh to 3D (https://www.cfd-online.com/Forums/main/245273-gmsh-crashes-gives-segfault-when-trying-extrude-mesh-3d.html)

algc September 24, 2022 12:43

Gmsh crashes and gives a segfault when trying to extrude mesh to 3D
 
Hi all,

I'm using gmsh for the first time, and trying to create a mesh around a cylinder for use in OpenFOAM. When I try to extrude the mesh into 3D using the translation, it crashes immediately and gives a segmentation fault. My .geo file is below:
__________________________________________
// Gmsh project created on Sat Sep 24 15:53:50 2022
SetFactory("OpenCASCADE");
//+

xbox = -1;
ybox = 1;
xfar= 20;
xinlet = -8;
yfar = 8;
ncyl = 200;
ninlet= 32;
ntop = 32;
nbot = 32;
nybox = 16;
nxbox = 128;
noutlet = 32;

Circle(1) = {0, 0, 0, 0.5, 0, 2*Pi};
//+
Point(2) = {xbox, ybox, 0, 1.0};
//+
Point(3) = {xbox, -ybox, 0, 1.0};
//+
Point(4) = {xfar, -ybox, 0, 1.0};
//+
Point(5) = {xfar, ybox, 0, 1.0};
//+
Point(6) = {xinlet, yfar, 0, 1.0};
//+
Point(7) = {xinlet, -yfar, 0, 1.0};
//+
Point(8) = {xfar, -yfar, 0, 1.0};
//+
Point(9) = {xfar, yfar, 0, 1.0};
//+
Line(2) = {6, 9};
//+
Line(3) = {6, 7};
//+
Line(4) = {7, 8};
//+
Line(5) = {8, 4};
//+
Line(6) = {9, 5};
//+
Line(7) = {4, 5};
//+
Line(8) = {2, 5};
//+
Line(9) = {3, 4};
//+
Line(10) = {2, 3};
//+
Transfinite Curve {1} = ncyl Using Progression 1;
//+
Transfinite Curve {3} = ninlet Using Progression 1;

//+
Transfinite Curve {2} = ntop Using Progression 1;
//+
Transfinite Curve {4} = nbot Using Progression 1;
//+
Transfinite Curve {10} = nybox Using Progression 1;
//+
Transfinite Curve {7} = nybox Using Progression 1;
//+
Transfinite Curve {8} = nxbox Using Progression 1;
//+
Transfinite Curve {9} = nxbox Using Progression 1;
//+
Transfinite Curve {6} = noutlet/2 Using Progression 1;
//+
Transfinite Curve {5} = noutlet/2 Using Progression 1;
//+
Curve Loop(1) = {3, 4, 5, -9, -10, 8, -6, -2};
//+
Plane Surface(1) = {1};
//+
Curve Loop(2) = {8, -7, -9, -10};
//+
Curve Loop(3) = {1};
//+
Plane Surface(2) = {2, 3};

___________________________________

Any help will be greatly appreciated!

aerosayan September 24, 2022 13:20

1 Attachment(s)
I played around a little bit, and did get a 3d grid, but the error report says something definitely isn't correct. Need to find out more about how to correct the errors.

I did it with the GUI, but the script had this code added automatically to the end of it. Maybe you can also add it to your script, and try it.

Code:

//+
Extrude {0, 0, 10} {
  Surface{1}; Layers{10}; Recombine;
}


aerosayan September 24, 2022 13:28

1 Attachment(s)
The 2 sections don't combine. Don't know why. Additional code:

Code:

//+
Extrude {0, 0, 5} {
  Surface{1}; Surface{2}; Layers{5}; Recombine;
}


aerosayan September 24, 2022 13:33

2 Attachment(s)
Okay, now it works.
  • Open in GMSH.
  • Click on Mesh->3D.
Full script:

Code:

// Gmsh project created on Sat Sep 24 15:53:50 2022
SetFactory("OpenCASCADE");
//+

xbox = -1;
ybox = 1;
xfar= 20;
xinlet = -8;
yfar = 8;
ncyl = 200;
ninlet= 32;
ntop = 32;
nbot = 32;
nybox = 16;
nxbox = 128;
noutlet = 32;

Circle(1) = {0, 0, 0, 0.5, 0, 2*Pi};
//+
Point(2) = {xbox, ybox, 0, 1.0};
//+
Point(3) = {xbox, -ybox, 0, 1.0};
//+
Point(4) = {xfar, -ybox, 0, 1.0};
//+
Point(5) = {xfar, ybox, 0, 1.0};
//+
Point(6) = {xinlet, yfar, 0, 1.0};
//+
Point(7) = {xinlet, -yfar, 0, 1.0};
//+
Point(8) = {xfar, -yfar, 0, 1.0};
//+
Point(9) = {xfar, yfar, 0, 1.0};
//+
Line(2) = {6, 9};
//+
Line(3) = {6, 7};
//+
Line(4) = {7, 8};
//+
Line(5) = {8, 4};
//+
Line(6) = {9, 5};
//+
Line(7) = {4, 5};
//+
Line(8) = {2, 5};
//+
Line(9) = {3, 4};
//+
Line(10) = {2, 3};
//+
Transfinite Curve {1} = ncyl Using Progression 1;
//+
Transfinite Curve {3} = ninlet Using Progression 1;

//+
Transfinite Curve {2} = ntop Using Progression 1;
//+
Transfinite Curve {4} = nbot Using Progression 1;
//+
Transfinite Curve {10} = nybox Using Progression 1;
//+
Transfinite Curve {7} = nybox Using Progression 1;
//+
Transfinite Curve {8} = nxbox Using Progression 1;
//+
Transfinite Curve {9} = nxbox Using Progression 1;
//+
Transfinite Curve {6} = noutlet/2 Using Progression 1;
//+
Transfinite Curve {5} = noutlet/2 Using Progression 1;
//+
Curve Loop(1) = {3, 4, 5, -9, -10, 8, -6, -2};
//+
Plane Surface(1) = {1};
//+
Curve Loop(2) = {8, -7, -9, -10};
//+
Curve Loop(3) = {1};
//+
Plane Surface(2) = {2, 3};
//+
Extrude {0, 0, 5} {
  Surface{1}; Surface{2}; Layers{5}; Recombine;
}


algc September 24, 2022 18:32

Thank you so much! I'm going to bed now, will write more tomorrow.


All times are GMT -4. The time now is 00:06.