dolfin-convert .msh to .xml error message


457
views
1
7 months ago by
Hello,
I work on a 3D fenics project, and I'd like to convert a mesh created through gmsh3 to a XML format. But the command dolfin-convert send me an error message for this .msh files ( I mean it already worked on a 2D project) :
root@DESKTOP-OCUFIRK:/mnt/c/Users/Fragloth35/Desktop/projet MECA/3D# dolfin-convert profil_chaise_3D_test.msh profil_chaise_3D.xml
Converting from Gmsh format (.msh, .gmsh) to DOLFIN XML format
Expecting 15560 vertices
Found all vertices
Expecting 61800 cells
Found all cells
Traceback (most recent call last):
  File "/usr/bin/dolfin-convert", line 132, in <module>
    main(sys.argv[1:])
  File "/usr/bin/dolfin-convert", line 79, in main
    meshconvert.convert2xml(ifilename, ofilename, iformat=iformat)
  File "/usr/lib/python2.7/dist-packages/dolfin_utils/meshconvert/meshconvert.py", line 1299, in convert2xml
    convert(ifilename, XmlHandler(ofilename), iformat=iformat)
  File "/usr/lib/python2.7/dist-packages/dolfin_utils/meshconvert/meshconvert.py", line 1320, in convert
    gmsh2xml(ifilename, handler)
  File "/usr/lib/python2.7/dist-packages/dolfin_utils/meshconvert/meshconvert.py", line 490, in gmsh2xml
    index = nodes_as_facets[tuple(nodes)]
KeyError: (0, 704, 2542)
Aborted (core dumped)​
my initial .msh file was created by gmsh3 from the following .geo script (with no error) :
d = 0.005 ;
H = 0.4 ;
L = 0.4 ;
Rc = 0.1;
R = 0.08 ;
e = 0.010;

Point(1) = {-L,H+R,0,d} ;
Point(2)={-L,H+R-e,0,d} ;
Point(3) = {0,H+R,0,d} ;
Point(4) ={0,H+R-e,0,d} ;
Point(13) = {0,H,0,d};
Line(1) = {1,3} ;
Line(2) = {4,2} ;
Line(3)={3,4} ;
Line(4)={2,1} ;
Line loop(1) = {1,3,2,4} ;
Plane Surface(1) = {1} ;

//tube1[] = Extrude{ {1,0,0}, {-L,H,0} , 2*Pi } { Surface{1};} ;

Point(5) = {-L,-H+R,0,d} ;
Point(6)={-L,-H+R-e,0,d} ;
Point(7) = {0,-H+R,0,d} ;
Point(8) ={0,-H+R-e,0,d} ;
Point(14)={0,-H,0,d};
Line(5) = {5,7} ;
Line(6) = {8,6} ;
Line(7)={7,8} ;
Line(8)={6,5} ;
Line loop(2) = {5,7,6,8} ;

Plane Surface(2) = {2} ;

//tube2[] = Extrude{ {1,0,0}, {-L,-H,0} , 2*Pi } { Surface{2};} ;

Point(9) = {Rc,H-Rc-R,0,d} ;
Point(10)={Rc+e,H-Rc-R,0,d} ;
Point(11) = {Rc,-H+Rc+R,0,d} ;
Point(12) ={Rc+e,-H+Rc+R,0,d} ;
Point(15) = { Rc+R,0,0,d} ;
Point(16) = { 0,H-R-Rc,0,d};
Point(17) = { 0,-H+R+Rc,0,d};

Line(9) = {11,9} ;
Line(10) = {10,12} ;
Line(11)={9,10} ;
Line(12)={12,11} ;
Line loop(3) = {9,11,10,12} ;

Plane Surface(3) = {3} ;






//+
Extrude {{1, 0, 0}, {0, 0.4, 0}, Pi*0.5} {
  Surface{1}; Layers{5}; 
}
//+
Extrude {{1, 0, 0}, {0, 0.4, 0}, Pi*0.5} {
  Surface{34}; Layers{5}; 
}
//+
Extrude {{1, 0, 0}, {0, 0.4, 0}, Pi*0.5} {
  Surface{56}; Layers{5}; 
}
//+
Extrude {{1, 0, 0}, {0, 0.4, 0}, Pi*0.5} {
  Surface{78}; Layers{5}; 
}
//+
Line Loop(4) = {64, 86, 20, 42};
//+
Extrude {{0, 1, 0}, {0.18, 0, 0}, Pi*0.5} {
  Surface{3}; Layers{5}; 
}
//+
Extrude {{0, 1, 0}, {0.18, 0, 0}, Pi*0.5} {
  Surface{121}; Layers{5}; 
}
//+
Extrude {{0, 1, 0}, {0.18, 0, 0}, Pi*0.5} {
  Surface{143}; Layers{5}; 
}
//+
Extrude {{0, 1, 0}, {0.18, 0, 0}, Pi*0.5} {
  Surface{165}; Layers{5}; 
}
//+
Extrude {{0, 0, -1}, {0, 0.22, 0}, Pi*0.5} {
  Surface{47}; Surface{25}; Surface{91}; Surface{69}; Layers{5}; 
}
//+
Extrude {{1, 0, 0}, {0, -0.4, 0}, Pi*0.5} {
  Surface{2}; Layers{5}; 
}
//+
Extrude {{1, 0, 0}, {0, -0.4, 0}, Pi*0.5} {
  Surface{292}; Layers{5}; 
}
//+
Extrude {{1, 0, 0}, {0, -0.4, 0}, Pi*0.5} {
  Surface{314}; Layers{5}; 
}
//+
Extrude {{1, 0, 0}, {0, -0.4, 0}, Pi*0.5} {
  Surface{336}; Layers{5}; 
}
//+
Extrude {{0, 0, -1}, {0, -0.22, 0}, Pi*0.5} {
  Surface{120}; Surface{186}; Surface{164}; Surface{142}; Layers{5}; 
}
//+
Physical Volume(1) = {13, 14, 17, 16, 15, 19, 20, 18, 8, 5, 12, 11, 6, 7, 10, 9, 4, 3, 2, 1};
//+
Physical Line("top") = {1};
//+
Physical Surface("ext") = {21, 55, 43, 87, 95, 73, 65, 29, 51, 99, 33, 77, 249, 216, 195, 220, 228, 207, 199, 270, 262, 152, 174, 182, 138, 130, 160, 108, 116, 433, 441, 412, 420, 370, 378, 305, 391, 399, 345, 353, 279, 287, 331, 323, 357, 291, 313, 335, 309, 301, 241};
​
Can someone who know the inner code of dolfin-convert module can help me ?
Thank you very much.
Community: FEniCS Project
If I remember correctly, I faced some problems as well, when I tried to use gmsh 3 which I could fix by switching back to gmsh 2

A comment in the source says that the script only supports gmsh2.0. Maybe try building your mesh in gmsh2?
written 7 months ago by klunkean  
I tried with gmsh2.16, the result is the same.
However I can convert some other meshes to .xml, so the problem seems to come from my specific structure.
written 7 months ago by Liam Gonzalez  
Ps : the mesh is my profile image.
written 7 months ago by Liam Gonzalez  
Please login to add an answer/comment or follow this question.

Similar posts:
Search »