Problem with import quad mesh from GMSH to FEniCS

4 weeks ago by
I want to import a quad mesh generated in the GMSH to FEniCS. Here is the text file of the quad mesh in GMSH:

Point(1) = {0, 0, 0, 1.0};
Point(2) = {0, 1, 0, 1.0};
Point(3) = {1, 0, 0, 1.0};
Point(4) = {1, 1, 0, 1.0};
Line(1) = {2, 4};
Line(2) = {4, 3};
Line(3) = {3, 1};
Line(4) = {1, 2};
Line Loop(5) = {1, 2, 3, 4};
Plane Surface(6) = {5};
Recombine Surface {6};
Transfinite Surface{6};
Transfinite Line {1,2,3,4} = 10;​

Here is the generated mesh in GMSH:

I tried to convert it to XML format to import it into the FEniCS by writing this line in Ubuntu terminal:

dolfin-convert quad.msh quad.xml

Here is the error I get :

The thing is, it only happens in case of quad elements. For example if I remove the "Recombine" from the text file of the mesh (e.g. changing the quad elements to triangle elements) , the conversion works perfectly.
Does anybody know how I can import a quad mesh into the FEniCS from GMSH?

Community: FEniCS Project

1 Answer

4 weeks ago by
I had the same problem... In the end i'm using triangular meshes ..
But sometimes we need to use quad mesh to get more accurate results.
I found out dolfin-convert is not compatible with quad mesh by looking at the source code. I found a way to convert the quad mesh (generated in GMSH) into a qaud mesh in FEniCS. I did it by writing a text editor in Python and using mesh.editor function in FEniCS.
written 29 days ago by Leo  
would you mind sharing how you did that? thanks in advance
written 24 days ago by lhdamiani  
Sure. You can ask it in a separate question and I will share how I did it.
written 23 days ago by Leo  
Hello Leo,

I too am working on Quad mesh and will be very grateful if you could please share the details. Thank you very much in advance.
written 23 days ago by Yogesh Deepak Bansod  
Please login to add an answer/comment or follow this question.

Similar posts:
Search »