Skip to content

mesh file generated by gmsh command in terminal does not save a crack

Hi,

I created a simple .geo script that uses the Crack plugin, pasted below.

When I open it using GUI and save .msh (with all elements), I get a mesh with a crack, as expected. When I use a gmsh command in terminal, I get a mesh without a crack. The command I am using is: 'gmsh script.geo -2 -save_all'

I would like to be able to save a mesh using a command in terminal. Any help is much appreciated.

Edit: I realized that earlier I had not pasted the entire geo script.

Best Regards, Ashish Bhole ---------------------script.geo---------------------------------------

SetFactory("OpenCASCADE");

lx = 5.0; // domain length in x-dir
ly = 5.0; // domain length in y-dir

lc = 0.1;

Point(1) = {-lx, -ly, 0, lc};
Point(2) = { lx, -ly, 0, lc};
Point(3) = { lx,  ly, 0, lc};
Point(4) = {-lx,  ly, 0, lc};
Line(1) = {1, 2};
Line(2) = {2, 3};
Line(3) = {3, 4};
Line(4) = {4, 1};
Line Loop(1) = {1,2,3,4};
Plane Surface(3) = {1};

Point(5) = {-1, -2, 0, lc};
Point(6) = { 1, -2, 0, lc};
Line(5) = {5, 6};
Line{5} In Surface{3};

Physical Line('1') = {5};
Physical Surface('100') = {3};

v() = BooleanFragments{ Surface{3}; Delete; }{ Line{5}; Delete; };
Mesh 2;
Mesh.Format = 1;
Mesh.MshFileVersion = 2.2;

Plugin(Crack).Dimension = 1;
Plugin(Crack).PhysicalGroup = 1;
Plugin(Crack).Run;

Mesh.SaveAll = 1;

Edited by Christophe Geuzaine