Hi everyone!
I am using the following conda
env:
name: test_env
channels:
- conda-forge
- defaults
- anaconda
variables:
PYTHONNOUSERSITE: '1'
LANG: 'C'
LC_ALL: 'C'
LC_NUMERIC: 'C'
PYTHONIOENCODING: 'utf-8'
dependencies:
- python 3.11
- fenics-dolfinx 0.8.0
- mpich 4.2.1
- pyvista 0.39.0
- gmsh 4.11.1
- python-gmsh 4.11.1
- numpy=1.24.3
- scipy 1.10.1
- matplotlib 3.7.1
- pyqt 5.15.7
- flake8 6.0.0
- black 23.3.0
- sphinx 7.0.1
- sphinx-gallery 0.13.0
- pytest 7.3.1
- jupyter 1.0.0
- trame 2.3.2
- tqdm 4.65.0
- backports.tempfile 1.0
- treelib 1.6.4
- meshio 5.3.4
- shapely 2.0.1
- numba 0.58.1
I should mention that I installed and used this environment until very recently without any problems. Today, I also tried to run this simple script:
import gmsh
from dolfinx.io.gmshio import model_to_mesh
from mpi4py import MPI
import numpy as np
GDIM = 2
MODEL_RANK = 0
MESH_COMM = MPI.COMM_WORLD
ri = 0.01 # Inner radius of wire
rc = 5 # Outer radius of wire
R = 100 # Radius of domain
nwire = 20 # number of wire divisions
lwire = 0.1 # mesh characteristic length for each segment
nenclo = 20 # number of external enclosure divisions
lenclo = 1 # mesh characteristic length for each segment
# create enclosure points (D-shape)
theta1 = np.linspace(np.pi / 2, -np.pi / 2, nenclo)
xenclo = R * np.cos(theta1)
yenclo = R * np.sin(theta1)
# create wire points (circular cross-section)
theta2 = np.linspace(0, 2 * np.pi, nwire)
xwire = rc + ri * np.cos(theta1)
ywire = ri * np.sin(theta1)
gmsh.initialize()
enclo_pts = []
enclo_lns = []
for i, (r, z) in enumerate(zip(xenclo, yenclo)):
enclo_pts.append(gmsh.model.occ.addPoint(r, z, 0.0, lenclo))
if i > 0:
enclo_lns.append(gmsh.model.occ.addLine(enclo_pts[i - 1], enclo_pts[i]))
enclo_lns.append(gmsh.model.occ.addLine(enclo_pts[-1], enclo_pts[0]))
wire_pts = []
wire_lns = []
for i, (r, z) in enumerate(zip(xwire, ywire)):
wire_pts.append(gmsh.model.occ.addPoint(r, z, 0.0, lenclo))
if i > 0:
wire_lns.append(gmsh.model.occ.addLine(wire_pts[i - 1], wire_pts[i]))
wire_lns.append(gmsh.model.occ.addLine(wire_pts[-1], wire_pts[0]))
gmsh.model.occ.addCurveLoop(enclo_lns, 0)
gmsh.model.occ.addCurveLoop(wire_lns, 1)
gmsh.model.occ.addPlaneSurface([1], 1)
gmsh.model.occ.addPlaneSurface([0, 1], 0)
gmsh.model.occ.synchronize()
gmsh.model.addPhysicalGroup(GDIM, [0], 0)
gmsh.model.addPhysicalGroup(GDIM, [1], 1)
# mesh generation options
gmsh.option.setNumber("Mesh.Algorithm", 2)
gmsh.option.setNumber("Mesh.CharacteristicLengthMin", lwire)
gmsh.option.setNumber("Mesh.CharacteristicLengthMax", lenclo)
# generate 2D mesh
gmsh.model.mesh.set_order(1)
gmsh.model.mesh.generate(GDIM)
gmsh.model.mesh.optimize("Netgen")
mesh, ct, ft = model_to_mesh(gmsh.model, MESH_COMM, MODEL_RANK, GDIM)
gmsh.finalize()
I get the following errors:
Traceback (most recent call last):
File "/home/mnotazio/mambaforge/envs/test_env/lib/python3.11/site-packages/dolfinx/fem/element.py", line 91, in _
return CoordinateElement(_cpp.fem.CoordinateElement_float32(e._e))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: __init__(): incompatible function arguments. The following argument types are supported:
1. __init__(self, celltype: dolfinx.cpp.mesh.CellType, degree: int) -> None
2. __init__(self, element: basix::FiniteElement<float>) -> None
3. __init__(self, celltype: dolfinx.cpp.mesh.CellType, degree: int, variant: int) -> None
Invoked with types: dolfinx.cpp.fem.CoordinateElement_float32, basix._basixcpp.FiniteElement_float64
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/mnotazio/PhD/pecan/git_local/pecan/mattenotazio/example_mesh.py", line 65, in <module>
mesh, ct, ft = model_to_mesh(gmsh.model, MESH_COMM, MODEL_RANK, GDIM)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mnotazio/mambaforge/envs/test_env/lib/python3.11/site-packages/dolfinx/io/gmshio.py", line 293, in model_to_mesh
mesh = create_mesh(comm, cells, x[:, :gdim].astype(dtype, copy=False), ufl_domain, partitioner)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mnotazio/mambaforge/envs/test_env/lib/python3.11/site-packages/dolfinx/mesh.py", line 407, in create_mesh
cmap = _coordinate_element(e_ufl.basix_element) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mnotazio/mambaforge/envs/test_env/lib/python3.11/functools.py", line 909, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mnotazio/mambaforge/envs/test_env/lib/python3.11/site-packages/dolfinx/fem/element.py", line 93, in _
return CoordinateElement(_cpp.fem.CoordinateElement_float64(e._e))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: __init__(): incompatible function arguments. The following argument types are supported:
1. __init__(self, celltype: dolfinx.cpp.mesh.CellType, degree: int) -> None
2. __init__(self, element: basix::FiniteElement<double>) -> None
3. __init__(self, celltype: dolfinx.cpp.mesh.CellType, degree: int, variant: int) -> None
Invoked with types: dolfinx.cpp.fem.CoordinateElement_float64, basix._basixcpp.FiniteElement_float64
Is anyone able to help me? Thank you in advance