Error ehile loading 3D tet mesh in dolfinx.
mesh, subdomains, boundaries = gmshio.read_from_msh("tet_3D.msh", MPI.COMM_WORLD,0, gdim=3)
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
Cell In[8], line 1
----> 1 mesh, subdomains, boundaries = gmshio.read_from_msh("tet_3D.msh", MPI.COMM_WORLD,0, gdim=3)
File /usr/lib/petsc/lib/python3/dist-packages/dolfinx/io/gmshio.py:373, in read_from_msh(filename, comm, rank, gdim, partitioner)
371 gmsh.model.add("Mesh from file")
372 gmsh.merge(filename)
--> 373 msh = model_to_mesh(gmsh.model, comm, rank, gdim=gdim, partitioner=partitioner)
374 gmsh.finalize()
375 return msh
File /usr/lib/petsc/lib/python3/dist-packages/dolfinx/io/gmshio.py:290, in model_to_mesh(model, comm, rank, gdim, partitioner, dtype)
287 facet_values = np.empty((0,), dtype=np.int32)
289 # Create distributed mesh
--> 290 ufl_domain = ufl_mesh(cell_id, gdim, dtype=dtype)
291 gmsh_cell_perm = cell_perm_array(_cpp.mesh.to_type(str(ufl_domain.ufl_cell())), num_nodes)
292 cells = cells[:, gmsh_cell_perm].copy()
File /usr/lib/petsc/lib/python3/dist-packages/dolfinx/io/gmshio.py:76, in ufl_mesh(gmsh_cell, gdim, dtype)
74 raise e
75 cell = ufl.Cell(shape)
---> 76 element = basix.ufl.element(
77 basix.ElementFamily.P,
78 cell.cellname(),
79 degree,
80 basix.LagrangeVariant.equispaced,
81 shape=(gdim,),
82 dtype=dtype, # type: ignore[arg-type]
83 )
84 return ufl.Mesh(element)
File /usr/lib/python3/dist-packages/basix/ufl.py:2006, in element(family, cell, degree, lagrange_variant, dpc_variant, discontinuous, shape, symmetry, dtype)
2003 elif family == EF.DPC:
2004 dpc_variant = _basix.DPCVariant.diagonal_gll
-> 2006 e = _basix.create_element(
2007 family, cell, degree, lagrange_variant, dpc_variant, discontinuous, dtype=dtype
2008 )
2009 ufl_e = _BasixElement(e)
2011 if shape is None or shape == tuple(e.value_shape):
File /usr/lib/python3/dist-packages/basix/finite_element.py:606, in create_element(family, celltype, degree, lagrange_variant, dpc_variant, discontinuous, dof_ordering, dtype)
577 def create_element(
578 family: ElementFamily,
579 celltype: CellType,
(...)
585 dtype: npt.DTypeLike = np.float64,
586 ) -> FiniteElement:
587 """Create a finite element.
588
589 Args:
(...)
603 A finite element.
604 """
605 return FiniteElement(
--> 606 _create_element(
607 family.value,
608 celltype.value,
609 degree,
610 lagrange_variant.value,
611 dpc_variant.value,
612 discontinuous,
613 dof_ordering if dof_ordering is not None else [],
614 np.dtype(dtype).char,
615 )
616 )
RuntimeError: Cannot pass a DPC variant to this element.
The .msh data:
$MeshFormat
2.2 0 8
$EndMeshFormat
$Nodes
9
1 -2.2299981443473595 0.49374912834507845 10.344827586206897
2 -2.056342014934421 0.42234502598529555 10.544827586206896
3 -2.062486500247639 0.4089720553352334 10.544827586206896
4 -2.0568290303717087 0.4199458559101729 10.744827586206895
5 -2.0573160458089967 0.4175466858350502 10.944827586206895
6 -2.0627328421274402 0.40675703452746365 10.744827586206895
7 -2.234752320279737 0.4861608460276258 10.744827586206895
8 -2.232375232313548 0.48995498718635216 10.544827586206896
9 -2.062240158367838 0.4111870761430031 10.344827586206897
$EndNodes
$Elements
4
1 4 2 0 1 1 2 3 9
2 4 2 0 1 8 4 3 2
3 4 2 2 1 8 4 6 3
4 4 2 2 1 7 5 6 4
$EndElements
The 4th column is for subdomain data and 5th to 8th column is for element connectivity.