I currently have code working for reading of gmsh with dolfin using the auto-generated triangular mesh that gmsh initializes. I would like to work in a quadrilaterally discretized space, such as the following .geo
file:
// Gmsh project created on Tue Dec 08 11:46:33 2020
nx=10;
ny=10;
// Lengths in x and y
Lx=1;
Ly=1;
Point(1) = {0, 0, 0,0.1};
Point(2) = {0, Ly, 0,0.1};
Point(3) = {Lx, Ly, 0,0.1};
Point(4) = {Lx, 0, 0,0.1};
Line(1) = {1, 4};
Line(2) = {4, 3};
Line(3) = {3, 2};
Line(4) = {2, 1};
// Define surfaces
Line Loop(1) = {4, 1, 2, 3};
Plane Surface(1) = {1};
// Transfinite lines and surfaces for structured mesh
Transfinite Curve {1, 3} = nx+1 Using Progression 1;
Transfinite Curve {4, 2} = ny+1 Using Progression 1;
Transfinite Surface {1};
// Recombine surfaces to create quadrilaterals
Recombine Surface {1};
Physical Surface(1) = {1};
The relevant read functionality in my python file is as follows:
os.system('dolfin-convert %s.msh %s.xml' % (file_name, file_name))
mesh = Mesh("%s.xml" % file_name)
where file_name
is a string containing the name of the generated .msh
file (ver 2.2). Here is the error I get:
*** Unable to find cells of supported type.
Traceback (most recent call last):
File <path-to-file>, line 18, in <module>
mesh = Mesh("%s.xml" % file_name)
RuntimeError:
This is mainly because the .xml
file that is created is blank.
What is the best course of action going forward? I have looked at meshio, but I can’t seem to get the module to work with either the triangular or quadrilateral .msh
files.
Thank you.