I would like to create an ordered mesh with GMSH along with physical tags to apply boundary conditions to. I noticed that after adding transfinite lines/surfaces/volumes to create the ordered mesh, dolfin-convert fails to convert the mesh file to .xml format. In addition, I used the meshio package similar to previous posts, and it eventually fails when trying to read the mesh functions from the .h5 file. I use gmsh version 3.0.6, and the dolfin 2019.1.0 Docker image. The following is a .geo file of a sample geometry I would to import into fenics:
// Gmsh project created on Tue Jul 16 15:55:38 2019
SetFactory(“OpenCASCADE”);
x = 0.1;
//+
Point(1) = {0, 0, 0, x};
//+
Point(2) = {1, 0, 0, x};
//+
Point(3) = {1, 1, 0, x};
//+
Point(4) = {0, 1, 0, x};
//+
Point(5) = {0, 0, 1, x};
//+
Point(6) = {1, 0, 1, x};
//+
Point(7) = {1, 1, 1, x};
//+
Point(8) = {0, 1, 1, x};
//+
Line(1) = {1, 2};
//+
Line(2) = {2, 3};
//+
Line(3) = {3, 4};
//+
Line(4) = {4, 1};
//+
Line(5) = {5, 6};
//+
Line(6) = {6, 7};
//+
Line(7) = {7, 8};
//+
Line(8) = {8, 5};
//+
Line(9) = {5, 1};
//+
Line(10) = {2, 6};
//+
Line(11) = {7, 3};
//+
Line(12) = {4, 8};
//+
Line Loop(1) = {5, -10, -1, -9};
//+
Plane Surface(1) = {1};
//+
Line Loop(2) = {12, -7, 11, 3};
//+
Plane Surface(2) = {2};
//+
Line Loop(3) = {6, 7, 8, 5};
//+
Plane Surface(3) = {3};
//+
Line Loop(4) = {8, 9, -4, 12};
//+
Plane Surface(4) = {4};
//+
Line Loop(5) = {4, 1, 2, 3};
//+
Plane Surface(5) = {5};
//+
Line Loop(6) = {10, 6, 11, -2};
//+
Plane Surface(6) = {6};
//+
Surface Loop(1) = {1, 3, 6, 2, 4, 5};
//+
Volume(1) = {1};
//+
Transfinite Volume{1} = {1, 2, 6, 5, 4, 3, 7, 8};
//+
Transfinite Line {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12} = 10 Using Progression 1;
//+
Transfinite Surface {4} Left;
//+
Transfinite Surface {6} Right;
//+
Transfinite Surface {1} Left;
//+
Transfinite Surface {2} Right;
//+
Transfinite Surface {3} Left;
//+
Transfinite Surface {5} Right;
//+
Physical Surface(“inlet”) = {1};
//+
Physical Surface(“outlet”) = {2};
//+
Physical Surface(“walls”) = {3, 4, 5, 6};
//+
Physical Volume(“fluid”) = {1};
Once again, using a mesh with either transfinite or physical definitions works, however using both definitions fails when using dolfin-convert or meshio. This is the error when using dolfin-convert:
Converting from Gmsh format (.msh, .gmsh) to DOLFIN XML format
Expecting 1000 vertices
Found all vertices
Expecting 4374 cells
Found all cells
Traceback (most recent call last):
File “/usr/local/bin/dolfin-convert”, line 132, in
main(sys.argv[1:])
File “/usr/local/bin/dolfin-convert”, line 79, in main
meshconvert.convert2xml(ifilename, ofilename, iformat=iformat)
File “/usr/local/lib/python3.6/dist-packages/dolfin_utils/meshconvert/meshconvert.py”, line 1301, in convert2xml
convert(ifilename, XmlHandler(ofilename), iformat=iformat)
File “/usr/local/lib/python3.6/dist-packages/dolfin_utils/meshconvert/meshconvert.py”, line 1322, in convert
gmsh2xml(ifilename, handler)
File “/usr/local/lib/python3.6/dist-packages/dolfin_utils/meshconvert/meshconvert.py”, line 494, in gmsh2xml
index = nodes_as_facets[tuple(nodes)]
KeyError: (4, 40, 72)
This is the error when converting with meshio and reading from .h5:
Traceback (most recent call last):
File “example3.py”, line 9, in
infile.read(mvc, “name_to_read”)
RuntimeError:*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
*** fenics-support@googlegroups.com
*** Remember to include the error message listed below and, if possible,
*** include a minimal running example to reproduce the error.
*** -------------------------------------------------------------------------
*** Error: Unable to find entity in map.
*** Reason: Error reading MeshValueCollection.
*** Where: This error was encountered inside HDF5File.cpp.
*** Process: 0
*** DOLFIN version: 2019.1.0
*** Git changeset: 74d7efe1e84d65e9433fd96c50f1d278fa3e3f3f
*** -------------------------------------------------------------------------
Any help would be appreciated.
Also, is it possible to use meshio to read a quadrilateral/hexahedral mesh into fenics?
Thank you.