Hi everyone,
I have a similar issue. I am trying to create the geometry for the hyperelasticity problem in tutorials to understand the creation of 3d geometries with gmsh. Although I have defined the Physical group for the curve, surface and volume. I created a surface and extruded it in the following way. (Without extrude command, it works fine). What am I doing wrong here? I have the same error regarding Physical groups using meshio in dolfinx. I am trying to create quad mesh using Mesh settings in gmsh as āFrontal-Delaunay for quads - 2d algorithmā and āFrontal - 3d algorithmā.
//+
Point(1) = {0, 0, 0, 0.2};
//+
Point(2) = {20, 0, 0, 0.2};
//+
Point(3) = {20, 1, 0, 0.2};
//+
Point(4) = {0, 1, 0, 0.2};
//+
Line(1) = {1, 2};
//+
Line(2) = {2, 3};
//+
Line(3) = {3, 4};
//+
Line(4) = {4, 1};
//+
Curve Loop(1) = {4, 1, 2, 3};
//+
Plane Surface(1) = {1};
//+
Physical Curve(1) = {1, 2, 3, 4};
//+
Physical Surface("My surface") = {1};
//+
e() = Extrude {0, 0, 1}{ Surface{1}; Layers{10}; Recombine; };
//+
Physical Volume(1) = {e(1)};
//+
Coherence;
Mesh 3;
Coherence Mesh;
I am using the following code to read in the .msh file in dolfinx using another 3D mesh created without extrude option but I get an error given below. What could be the issue here?
proc = MPI.COMM_WORLD.rank
def create_mesh(mesh, cell_type, prune_z=False):
cells = mesh.get_cells_type(cell_type)
cell_data = mesh.get_cell_data("gmsh:physical", cell_type)
points = mesh.points[:, :2] if prune_z else mesh.points
out_mesh = meshio.Mesh(points=points, cells={cell_type: cells}, cell_data={"name_to_read": [cell_data.astype(np.int32)]})
return out_mesh
if proc == 0:
# Read in mesh
msh = meshio.read(Path("geometry")/"hyper_3d_v1.msh")
# Create and save one file for the mesh, and one file for the facets
hex_mesh = create_mesh(msh, "hexahedron")
quad_mesh = create_mesh(msh, "quad")
meshio.write("mesh.xdmf", hex_mesh)
meshio.write("mt.xdmf", quad_mesh)
MPI.COMM_WORLD.barrier()
with dolfinx.io.XDMFFile(MPI.COMM_WORLD, "mesh.xdmf", "r") as xdmf:
domain = xdmf.read_mesh(name="Grid") # cell tags
ct = xdmf.read_meshtags(domain, name="Grid")
domain.topology.create_connectivity(domain.topology.dim, domain.topology.dim - 1)
with dolfinx.io.XDMFFile(MPI.COMM_WORLD, "mt.xdmf", "r") as xdmf:
facet_tag = xdmf.read_meshtags(domain, name="Grid") # facet tags
fdim = domain.topology.dim - 1
dim = domain.topology.dim
Error
need at least one array to concatenate
File "/home/igupta/studies/test/basic_tri_thrombus_v1.py", line 58, in create_mesh
cell_data = mesh.get_cell_data("gmsh:physical", cell_type)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/igupta/studies/test/basic_tri_thrombus_v1.py", line 68, in <module>
hex_mesh = create_mesh(msh, "hexahedron")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: need at least one array to concatenate
Here is the .geo file with which this error exists
//+
Point(1) = {0, 0, 0, 0.2};
//+
Point(2) = {20, 0, 0, 0.2};
//+
Point(3) = {20, 1, 0, 0.2};
//+
Point(4) = {0, 1, 0, 0.2};
//+
Point(5) = {0, 0, 1, 0.2};
//+
Point(6) = {20, 0, 1, 0.2};
//+
Point(7) = {20, 1, 1, 0.2};
//+
Point(8) = {0, 1, 1, 0.2};
//+
Line(1) = {1, 2};
//+
Line(2) = {2, 3};
//+
Line(3) = {3, 4};
//+
Line(4) = {4, 1};
//+
Line(5) = {1, 5};
//+
Line(6) = {2, 6};
//+
Line(7) = {3, 7};
//+
Line(8) = {4, 8};
//+
Line(9) = {5, 6};
//+
Line(10) = {6, 7};
//+
Line(11) = {7, 8};
//+
Line(12) = {8, 5};
//+Top
Curve Loop(1) = {-8, -3, 7, 11};
//+Front
Curve Loop(2) = {4, 1, 2, 3};
//+Bottom
Curve Loop(3) = {-5, 1, 6, -9};
//+Back
Curve Loop(4) = {12, 9, 10, 11};
//+Right
Curve Loop(5) = {-2, 6, 10, -7};
//+Left
Curve Loop(6) = {4, 5, -12, -8};
//+
Plane Surface(1) = {1};
//+
Plane Surface(2) = {2};
//+
Plane Surface(3) = {3};
//+
Plane Surface(4) = {4};
//+
Plane Surface(5) = {5};
//+
Plane Surface(6) = {6};
//+
Physical Curve(1) = {1};
//+
Physical Curve(2) = {2};
//+
Physical Curve(3) = {3};
//+
Physical Curve(4) = {4};
//+
Physical Curve(5) = {5};
//+
Physical Curve(6) = {6};
//+
Physical Curve(7) = {7};
//+
Physical Curve(8) = {8};
//+
Physical Curve(9) = {9};
//+
Physical Curve(10) = {10};
//+
Physical Curve(11) = {11};
//+
Physical Curve(12) = {12};
//+
Physical Surface(1) = {1};
//+
Physical Surface(2) = {2};
//+
Physical Surface(3) = {3};
//+
Physical Surface(4) = {4};
//+
Physical Surface(5) = {5};
//+
Physical Surface(6) = {6};
//+
Surface Loop(11) = {1, 2, 3, 5, 4, 6};
//+
Volume(12) = {11};
Physical Volume("Volume", 1) = {12};
//+
Coherence;
Mesh 3;
Coherence Mesh;