Thank you for your reply. I used the one you sent as well but I get the error:
ValueError Traceback (most recent call last)
Cell In[111], line 1
----> 1 line_mesh = create_mesh(mesh_from_file, “line”, prune_z=True)
2 meshio.write(“new_facet_mesh.xdmf”, line_mesh)
4 triangle_mesh = create_mesh(mesh_from_file, “triangle”, prune_z=True)
Cell In[110], line 4, in create_mesh(mesh, cell_type, prune_z)
2 def create_mesh(mesh, cell_type, prune_z=False):
3 cells = mesh.get_cells_type(cell_type)
----> 4 cell_data = mesh.get_cell_data(“gmsh:physical”, cell_type)
5 points = mesh.points[:,:2] if prune_z else mesh.points
6 out_mesh = meshio.Mesh(points=points, cells={cell_type: cells}, cell_data={“name_to_read”:[cell_data]})
File /opt/anaconda3/envs/fenicss/lib/python3.11/site-packages/meshio/_mesh.py:249, in Mesh.get_cell_data(self, name, cell_type)
248 def get_cell_data(self, name: str, cell_type: str):
→ 249 return np.concatenate(
250 [d for c, d in zip(self.cells, self.cell_data[name]) if c.type == cell_type]
251 )
File <array_function internals>:200, in concatenate(*args, **kwargs)
ValueError: need at least one array to concatenate
my gmsh mesh file is looks correct which is:
$MeshFormat
2.2 0 8
$EndMeshFormat
$PhysicalNames
3
2 5 “Fixed”
2 6 “Force”
3 7 “beam”
$EndPhysicalNames
$Nodes
4410
1 0 0 5
2 1.000000003627494e-15 1 5
3 4.163336342344337e-16 0.75 5
4 2.775557561562891e-16 0.5 5
5 1.387778780781446e-16 0.25 5
6 1 0 5
7 0.25 0 5
8 0.5 0 5
9 0.75 0 5
10 1 1 5
11 1 0.25 5
12 1 0.5 5
13 1 0.75 5
14 0.75 1 5
15 0.5 1 5
16 0.25 1 5
17 0.6339163780212402 0.4695656597614288 5
18 0.3135612607002258 0.4157798588275909 5
19 0.437676876783371 0.6760674715042114 5
20 0.5522602200508118 0.2255466431379318 5
.
.
.