1
$\begingroup$

In Gmsh, I have a test.geo file. The question is:

  • if I run gmsh -3 test.geo in the command line, I get the below error.

    Error   : Surface mesh is wrong, cannot do the 3D mesh
    Info    : Done meshing 3D (0.002836 s)
    Info    : 927 vertices 2064 elements
    Error   : ------------------------------
    Error   : Mesh generation error summary
    Error   :     0 warnings
    Error   :     2 errors
    Error   : Check the full log for details
    Error   : ------------------------------
    
  • if I partition the test.geo in Gmsh GUI, sometimes I get the same error as above. But if I reload test.geo and then 3D it many times, I am sure I can get the right 3-D partition.

The test.geo file can be obtained from test.geo file

So how does this happen?

$\endgroup$
2
  • 2
    $\begingroup$ This is a question best asked on a Gmsh-specific forum. $\endgroup$ Apr 25, 2018 at 4:26
  • 1
    $\begingroup$ I agree that this is not the right place for this question. Nevertheless, I went and checked your file. You missed an important part of the error message: Error : Self intersecting surface mesh, computing intersections (this could take a while) Error : Surface mesh is wrong, cannot do the 3D mesh. Also, lines 35, 37, 38 and 39 are orphan. $\endgroup$
    – nicoguaro
    Apr 25, 2018 at 14:06

1 Answer 1

1
$\begingroup$

I was totally able to replicate your problem in GMSH 3.0.2. In GUI, I would get an error about self-intersecting surface mesh and inability to perform a 3-D meshing about 1 out of 3 times.

While I don't see anything wrong with your GMSH script, I fixed the normals for the surfaces and surface loop definitions, sometimes that can make a difference (it did not in this case)

Then, I decided to change the meshing algorithm from the default ones to:

  • MeshAdapt for generation of the 2-D mesh
  • New Delaunay for generation of the 3-D mesh

enter image description here

After that, I was not able to replicate the problem in 3-D mesh generation.

Unfortunately, I do not have a concrete answer on what happens with the default options; however, I think that should help you in the immediate term.

Please, find below the script with the fixed normals (it might have contributed) and specified meshing algorithms.

Mesh.RandomFactor=1.e-8;
Mesh.Algorithm = 1; //MeshAdapt
Mesh.Algorithm3D = 2; //New Delaunay

Point(1) = {0.0, 0.0, 0.0, 0.05};
Point(2) = {0.5, 0.0, 0.0, 1.0};
Point(5) = {0.5, 1.0, 0.0, 1.0};
Point(4) = {0.0, 1.0, 0.0, 0.05};
Point(10) = {0.0, 1.0, 0.5, 1.0};
Point(7) = {0.0, 0.0, 0.5, 1.0};
Point(8) = {0.5, 0.0, 0.5, 1.0};
Point(11) = {0.5, 1.0, 0.5, 1.0};
Point(19) = {0.5, 0.2, 0.5, 0.05};
Point(20) = {0.5, 0.6, 0.5, 0.05};
Point(3) = {1.0, 0.0, 0.0, 0.05};
Point(6) = {1.0, 1.0, 0.0, 0.05};
Point(9) = {1.0, 0.0, 0.5, 1.0};
Point(12) = {1.0, 1.0, 0.5, 1.0};
Point(16) = {0.0, 1.0, 1.0, 1.0};
Point(13) = {0.0, 0.0, 1.0, 1.0};
Point(14) = {0.5, 0.0, 1.0, 1.0};
Point(17) = {0.5, 1.0, 1.0, 1.0};
Point(15) = {1.0, 0.0, 1.0, 1.0};
Point(18) = {1.0, 1.0, 1.0, 1.0};


Line(1) = {1, 2};
Line(5) = {2, 5};
Line(9) = {4, 5};
Line(2) = {1, 4};
Line(10) = {4, 10};
Line(15) = {7, 10};
Line(3) = {1, 7};
Line(6) = {2, 8};
Line(14) = {7, 8};
Line(12) = {5, 11};
Line(18) = {8, 19};
Line(34) = {19, 20};
Line(36) = {20, 11};
Line(22) = {10, 11};
Line(4) = {2, 3};
Line(7) = {3, 6};
Line(11) = {5, 6};
Line(8) = {3, 9};
Line(17) = {8, 9};
Line(13) = {6, 12};
Line(20) = {9, 12};
Line(24) = {11, 12};
Line(23) = {10, 16};
Line(28) = {13, 16};
Line(16) = {7, 13};
Line(19) = {8, 14};
Line(27) = {13, 14};
Line(25) = {11, 17};
Line(30) = {14, 17};
Line(32) = {16, 17};
Line(21) = {9, 15};
Line(29) = {14, 15};
Line(26) = {12, 18};
Line(31) = {15, 18};
Line(33) = {17, 18};
Line(35) = {19, 1};
Line(37) = {4, 20};
Line(38) = {19, 3};
Line(39) = {6, 20};


Line Loop(1) = {1, 5, -9, -2};
Plane Surface(1) = {-1};
Line Loop(2) = {2, 10, -15, -3};
Plane Surface(2) = {-2};
Line Loop(3) = {1, 6, -14, -3};
Plane Surface(3) = {3};
Line Loop(5) = {5, 12, -18, -34, -36, -6};
Plane Surface(5) = {5};
Line Loop(8) = {9, 12, -22, -10};
Plane Surface(8) = {-8};
Line Loop(10) = {14, 18, 34, 36, -22, -15};
Plane Surface(10) = {10};
Line Loop(4) = {4, 7, -11, -5};
Plane Surface(4) = {-4};
Line Loop(6) = {4, 8, -17, -6};
Plane Surface(6) = {6};
Line Loop(7) = {7, 13, -20, -8};
Plane Surface(7) = {7};
Line Loop(9) = {11, 13, -24, -12};
Plane Surface(9) = {-9};
Line Loop(13) = {17, 20, -24, -18, -34, -36};
Plane Surface(13) = {13};
Line Loop(11) = {15, 23, -28, -16};
Plane Surface(11) = {-11};
Line Loop(12) = {14, 19, -27, -16};
Plane Surface(12) = {12};
Line Loop(14) = {18, 34, 36, 25, -30, -19};
Plane Surface(14) = {14};
Line Loop(17) = {22, 25, -32, -23};
Plane Surface(17) = {-17};
Line Loop(19) = {27, 30, -32, -28};
Plane Surface(19) = {19};
Line Loop(15) = {17, 21, -29, -19};
Plane Surface(15) = {15};
Line Loop(16) = {20, 26, -31, -21};
Plane Surface(16) = {16};
Line Loop(18) = {24, 26, -33, -25};
Plane Surface(18) = {-18};
Line Loop(20) = {29, 31, -33, -30};
Plane Surface(20) = {20};
Line Loop(21) = {35, 2, 37, -34};
Plane Surface(21) = {21};
Line Loop(22) = {38, 7, 39, -34};
Plane Surface(22) = {22};


Surface Loop(1) = {1, 2, 3, 5, 8, 10};
Volume(1) = {1};
Surface Loop(2) = {4, -5, 6, 7, 9, 13};
Volume(2) = {2};
Surface Loop(3) = {-10, 11, 12, 14, 17, 19};
Volume(3) = {3};
Surface Loop(4) = {13, -14, 15, 16, 18, 20};
Volume(4) = {4};


Line{35} In Volume{1};
Line{37} In Volume{1};
Line{38} In Volume{2};
Line{39} In Volume{2};
Surface{21} In Volume{1};
Surface{22} In Volume{2};



Physical Volume("Darcy") = {1};
Physical Volume("Darcy") += {2};
Physical Volume("Darcy") += {3};
Physical Volume("Darcy") += {4};

Physical Surface("BC") = {1};
Physical Surface("BC") += {2};
Physical Surface("BC") += {3};
Physical Surface("BC") += {4};
Physical Surface("MHMSurface") = {5};
Physical Surface("BC") += {6};
Physical Surface("BC") += {7};
Physical Surface("BC") += {8};
Physical Surface("BC") += {9};
Physical Surface("MHMSurface") += {10};
Physical Surface("BC") += {11};
Physical Surface("BC") += {12};
Physical Surface("MHMSurface") += {13};
Physical Surface("MHMSurface") += {14};
Physical Surface("BC") += {15};
Physical Surface("BC") += {16};
Physical Surface("BC") += {17};
Physical Surface("BC") += {18};
Physical Surface("BC") += {19};
Physical Surface("BC") += {20};

Physical Surface("f27") = {21};
Physical Surface("f26") = {22};
$\endgroup$
2
  • 1
    $\begingroup$ Thanks a lot. Your solution is great. But I want to know what exactly happened. I am so curious. $\endgroup$ Apr 25, 2018 at 13:08
  • 1
    $\begingroup$ @fanronghong I don't think you'll get an answer to that specific question on this forum (see Wolfgang's comment). You can wait a bit and accept this as an answer a bit later. You should certainly try onelab.info/mailman/listinfo/gmsh $\endgroup$
    – Anton Menshov
    Apr 25, 2018 at 13:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.