Hi,
with Gmesh I build a 2D-mesh using:
SetFactory("OpenCASCADE");
ln1 = 0.2;
ln2 = 3.0;
lc1 = 0.04;
lc3 = 0.005;
lc4 = 0.01;
Point(1) = {0,0,0,lc3};
Point(2) = {ln1,0.0,0,lc1};
Point(3) = {ln1,0.6,0,lc1};
Point(4) = {ln1,ln2,0,lc1};
Point(5) = {0,ln2,0,lc1};
Line(1) = {1,2};
Line(2) = {2,3};
Line(3) = {3,4};
Line(4) = {4,5};
Line(5) = {5,1};
Curve Loop(5) = {1,2,3,4,5};
Plane Surface(6) = {5};
Field[1] = Distance;
Field[1].CurvesList = {1,2};
Field[1].NumPointsPerCurve = ln2/lc3;
Field[2] = Distance;
Field[2].CurvesList = {3};
Field[2].NumPointsPerCurve = ln2/lc4;
Field[3] = Threshold;
Field[3].InField = 1;
Field[3].SizeMin = lc3;
Field[3].SizeMax = lc1;
Field[3].DistMin = 0.01;
Field[3].DistMax = 0.1;
Field[4] = Threshold;
Field[4].InField = 2;
Field[4].SizeMin = lc4;
Field[4].SizeMax = lc1;
Field[4].DistMin = 0.01;
Field[4].DistMax = 0.2;
Field[5] = Min;
Field[5].FieldsList = {3,4};
Background Field = 5;
Mesh.MeshSizeExtendFromBoundary = 0;
Mesh.MeshSizeFromPoints = 0;
Mesh.MeshSizeFromCurvature = 0;
and further
meshio-convert --input-format gmsh --output-format xdmf mymesh.gmsh mymesh.xdmf
which should result in a mesh like the attached file.
Doing the following:
mesh = Mesh()
filename = "mymesh.xdmf"
f = XDMFFile(MPI.comm_world, filename)
f.read(mesh)
plot(mesh)
gives the error:
*** Error: Unable to recognise cell type.
*** Reason: Unknown value "mixed".
*** Where: This error was encountered inside XDMFFile.cpp.
*** Process: 0
***
*** DOLFIN version: 2019.2.0.dev0
*** Git changeset: unknown
What did I do wrong and how can I just replace
mesh = RectangleMesh(p0,p1,npX,npY,'left')
by the Gmsh mesh?
Thank’s ins advance.