Hello, I am trying to use gmshio.read_from_mesh to input a 2D model from a .msh file (attachment) :
from dolfinx import *
from dolfinx import default_scalar_type
from dolfinx.fem.petsc import LinearProblem
from dolfinx.io import gmshio
from dolfinx.mesh import meshtags
from mpi4py import MPI
import gmsh
import ufl
import numpy as np
import ufl.measure
import genmodel
import dolfinx_mpc as mpc
import dolfinx_mpc.utils
from dolfinx_mpc import LinearProblem, MultiPointConstraint
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
m = gmshio.read_from_msh('1111.msh', comm=comm, gdim=2)
But I encounter an error says:
Traceback (most recent call last):
File "/home/zh9702/disk780/projectData/fenics/./energy_test_2D.py", line 75, in <module>
m = gmshio.read_from_msh(mfile, comm=comm, gdim=2)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/zh9702/miniconda3/envs/fenics-env/lib/python3.12/site-packages/dolfinx/io/gmshio.py", line 332, in read_from_msh
msh = model_to_mesh(gmsh.model, comm, rank, gdim=gdim, partitioner=partitioner)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/zh9702/miniconda3/envs/fenics-env/lib/python3.12/site-packages/dolfinx/io/gmshio.py", line 215, in model_to_mesh
x = extract_geometry(model)
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/zh9702/miniconda3/envs/fenics-env/lib/python3.12/site-packages/dolfinx/io/gmshio.py", line 176, in extract_geometry
assert np.all(indices[perm_sort] == np.arange(len(indices)))
AssertionError
What’s the reason for this error? Is there any way fixing this?
1111.msh