CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

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

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 24, 2022, 13:43
Default Gmsh crashes and gives a segfault when trying to extrude mesh to 3D
  #1
New Member
 
Anthony Cummins
Join Date: Sep 2022
Posts: 4
Rep Power: 2
algc is on a distinguished road
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!
algc is offline   Reply With Quote

Old   September 24, 2022, 14:20
Default
  #2
Senior Member
 
Sayan Bhattacharjee
Join Date: Mar 2020
Posts: 456
Rep Power: 6
aerosayan is on a distinguished road
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;
}
Attached Images
File Type: jpg extruded-grid.jpg (197.7 KB, 11 views)
aerosayan is offline   Reply With Quote

Old   September 24, 2022, 14:28
Default
  #3
Senior Member
 
Sayan Bhattacharjee
Join Date: Mar 2020
Posts: 456
Rep Power: 6
aerosayan is on a distinguished road
The 2 sections don't combine. Don't know why. Additional code:

Code:
//+
Extrude {0, 0, 5} {
  Surface{1}; Surface{2}; Layers{5}; Recombine;
}
Attached Images
File Type: jpg extruded-grid-2.jpg (201.3 KB, 7 views)
aerosayan is offline   Reply With Quote

Old   September 24, 2022, 14:33
Default
  #4
Senior Member
 
Sayan Bhattacharjee
Join Date: Mar 2020
Posts: 456
Rep Power: 6
aerosayan is on a distinguished road
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;
}
Attached Images
File Type: jpg extruded-grid-3.jpg (143.6 KB, 12 views)
File Type: jpg extruded-grid-4.jpg (146.7 KB, 11 views)
aerosayan is offline   Reply With Quote

Old   September 24, 2022, 19:32
Default
  #5
New Member
 
Anthony Cummins
Join Date: Sep 2022
Posts: 4
Rep Power: 2
algc is on a distinguished road
Thank you so much! I'm going to bed now, will write more tomorrow.
algc is offline   Reply With Quote

Reply

Tags
gmsh, gmsh 4.8.4, gmsh cylinder

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 17:11.