Importing Mesh from Gmsh

Hello,

I’m pretty new to FEniCS and I have a question about importing a mesh from Gmsh to FEniCS.
I wanted to try to replace the standard mesh “mesh = UnitSquareMesh(8, 8)” in the ft01_poisson.py example from Automated Solution of Differential Equations by the Finite Element Method with my own mesh.

My mesh should look like this:
Mesh_Picture

Remark that there is NOT a hole in the mesh. It is supposed to be a bigger square.
For that i used following code in Gmsh:

Summary

SetFactory(“OpenCASCADE”);
//+
Point(1) = {0, 0, 0, 1.0};
//+
Point(2) = {0, 8, 0, 1.0};
//+
Point(3) = {8, 8, 0, 1.0};
//+
Point(4) = {8, 0, 0, 1.0};
//+
Point(5) = {4, 6, 0, 1.0};
//+
Point(6) = {6, 6, 0, 1.0};
//+
Point(7) = {6, 4, 0, 1.0};
//+
Point(8) = {4, 4, 0, 1.0};
//+
Point(9) = {4, 8, 0, 1.0};
//+
Point(10) = {6, 8, 0, 1.0};
//+
Point(11) = {4, 0, 0, 1.0};
//+
Point(12) = {6, 0, 0, 1.0};
//+
Line(1) = {8, 5};
//+
Line(2) = {5, 6};
//+
Line(3) = {6, 7};
//+
Line(4) = {7, 8};
//+
Curve Loop(1) = {2, 3, 4, 1};
//+
Plane Surface(1) = {1};
//+
Physical Curve(“Mitte L”, 5) = {1};
//+
Physical Curve(“Mitte O”, 6) = {2};
//+
Physical Curve(“Mitte R”, 7) = {3};
//+
Physical Curve(“Mitte U”, 8) = {4};
//+
Transfinite Surface {1} = {8, 5, 6, 7};
//+
Transfinite Curve {1, 2, 3, 4} = 2 Using Progression 1;
//+
Recombine Surface {1};
//+
Line(5) = {1, 2};//+
Line(6) = {2, 9};
//+
Line(7) = {9, 11};
//+
Line(8) = {11, 1};
//+
Curve Loop(2) = {5, 6, 7, 8};
//+
Plane Surface(2) = {2};
//+
Physical Curve(“1 L”, 9) = {5};
//+
Physical Curve(“1 O”, 10) = {6};
//+
Physical Curve(“1 R”, 11) = {7};
//+
Physical Curve(“1 U”, 12) = {8};
//+
Transfinite Surface {2} = {1, 2, 9, 11};
//+
Transfinite Curve {5, 7} = 9 Using Progression 1;
//+
Transfinite Curve {8, 6} = 5 Using Progression 1;
//+
Recombine Surface {2};//+
Line(9) = {5, 9};
//+
Line(10) = {9, 10};
//+
Line(11) = {10, 6};
//+
Line(12) = {6, 5};
//+
Curve Loop(3) = {10, 11, 12, 9};
//+
Plane Surface(3) = {3};
//+
Physical Curve(“2 L”, 13) = {10};
//+
Physical Curve(“2 O”, 14) = {11};
//+
Physical Curve(“2 R”, 15) = {12};
//+
Physical Curve(“2 U”, 16) = {9};
//+
Transfinite Surface {3} = {5, 9, 10, 6};
//+
Transfinite Curve {10, 11, 12, 9} = 3 Using Progression 1;
//+
Recombine Surface {3};
//+
Line(13) = {12, 10};
//+
Line(14) = {10, 3};
//+
Line(15) = {3, 4};
//+
Line(16) = {4, 12};
//+
Curve Loop(4) = {15, 16, 13, 14};
//+
Plane Surface(4) = {4};
//+
Physical Curve(“3 L”, 17) = {13};
//+
Physical Curve(“3 O”, 18) = {14};
//+
Physical Curve(“3 R”, 19) = {15};
//+
Physical Curve(“3 U”, 20) = {16};
//+
Transfinite Surface {4} = {12, 10, 3, 4};
//+
Transfinite Curve {13, 15} = 9 Using Progression 1;
//+
Transfinite Curve {14, 16} = 3 Using Progression 1;
//+
Recombine Surface {4};
//+
Line(17) = {11, 8};
//+
Line(18) = {8, 7};
//+
Line(19) = {7, 12};
//+
Line(20) = {12, 11};
//+
Curve Loop(5) = {17, 18, 19, 20};
//+
Plane Surface(5) = {5};
//+
Physical Curve(“4 L”, 21) = {17};
//+
Physical Curve(“4 O”, 22) = {18};
//+
Physical Curve(“4 R”, 23) = {19};
//+
Physical Curve(“4 U”, 24) = {20};
//+
Transfinite Surface {5} = {11, 8, 7, 12};
//+
Transfinite Curve {17, 19} = 5 Using Progression 1;
//+
Transfinite Curve {18, 20} = 3 Using Progression 1;//+
Recombine Surface {5};//+
Physical Surface(“M”, 25) = {1};
//+
Physical Surface(“1”, 26) = {2};
//+
Physical Surface(“2”, 27) = {3};
//+
Physical Surface(“3”, 28) = {4};
//+
Physical Surface(“4”, 29) = {5};

So I exported this in Gmsh to a .msh file. Let’s call it mymesh.msh.
I then used “dolfin-convert mymesh.msh mymesh.xml”. This resulted in “mymesh.xml” and “mymesh_physical_region.xml” files.
I found out that there should also be a “mymesh_facet_region.xml” file but it is somehow missing.
1. Did I miss something in creating the .msh file in Gmsh?

I then tried to replace the line in example:
mesh = UnitSquareMesh(8, 8)
with my new mesh:
xml_file = “mymesh.xml”
mesh = Mesh(xml_file)

From that i got some warnings:
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Degree of exact solution may be inadequate for accurate result in errornorm.

So my next two questions are:
2. Is it even possible to use such mesh in FEniCS?
3. Is my replacement right or do I need “mymesh_facet_region.xml” and other changes in the code?

Greetings and thanks for any help.

Dolfin and DOLFINx does not support hanging nodes