I’m running one of the base tutorials by @dokken (deflection of a membrane). I’m using WSL (Ubuntu 22.04.2 LTS distro) with minconda and vscode as interface, here are the versions of the relevant packages:
fenics-basix 0.6.0 py310hdf3cbec_0 conda-forge
fenics-dolfinx 0.6.0 py310h25dff07_104 conda-forge
fenics-ffcx 0.6.0 pyh56297ac_0 conda-forge
fenics-libbasix 0.6.0 h1284905_0 conda-forge
fenics-libdolfinx 0.6.0 h67f7cd0_104 conda-forge
fenics-ufcx 0.6.0 h56297ac_0 conda-forge
fenics-ufl 2023.1.1 pyhd8ed1ab_1 conda-forge
gmsh 4.11.1 h28bb747_2 conda-forge
mpi 1.0 openmpi conda-forge
mpi4py 3.1.4 py310h6075a6b_0 conda-forge
python 3.10.11 he550d4f_0_cpython conda-forge
python-gmsh 4.11.1 h57928b3_2 conda-forge
The minimal working example is:
import gmsh
from dolfinx.io import gmshio
from mpi4py import MPI
# meshing example taken from https://jsdokken.com/dolfinx-tutorial/chapter1/membrane_code.html
gmsh.initialize()
membrane = gmsh.model.occ.addDisk(0, 0, 0, 1, 1)
gmsh.model.occ.synchronize()
gdim = 2
gmsh.model.addPhysicalGroup(gdim, [membrane], 1)
gmsh.model.mesh.generate(gdim)
gmsh_model_rank = 0
mesh_comm = MPI.COMM_WORLD
domain, cell_markers, facet_markers = gmshio.model_to_mesh(gmsh.model, mesh_comm, gmsh_model_rank, gdim=2)
gmsh.finalize()
I get the following error:
Traceback (most recent call last):
File "/home/giulio/paraffinator/meshingTest.py", line 15, in <module>
domain, cell_markers, facet_markers = gmshio.model_to_mesh(model=gmsh.model, comm=mesh_comm, rank=gmsh_model_rank, gdim=2)
File "/home/giulio/miniconda3/envs/new-env/lib/python3.10/site-packages/dolfinx/io/gmshio.py", line 250, in model_to_mesh
mesh = create_mesh(comm, cells, x[:, :gdim], ufl_domain, partitioner)
File "/home/giulio/miniconda3/envs/new-env/lib/python3.10/site-packages/dolfinx/mesh.py", line 177, in create_mesh
cmap = _cpp.fem.CoordinateElement(_uflcell_to_dolfinxcell[cell_shape], cell_degree, variant)
TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
1. dolfinx.cpp.fem.CoordinateElement(celltype: dolfinx.cpp.mesh.CellType, degree: int)
2. dolfinx.cpp.fem.CoordinateElement(celltype: dolfinx.cpp.mesh.CellType, degree: int, variant: basix::element::lagrange_variant)
Invoked with: <CellType.triangle: 3>, 1, <LagrangeVariant.equispaced: 0>
Pylance also displays the error on gmsh.model:
Argument of type "Type[model]" cannot be assigned to parameter "model" of type "model" in function "model_to_mesh"
"Type[type]" is incompatible with "Type[model]"
I’m new to python and dolfinx, so I apologize in advance if it’s a really stupid mistake