Hello there,
I’m new to dolfinx and trying to reproduce the tutorial (DOLFINx in Parallel with MPI — NewFrac FEniCSx Training) in the latest version, but cannot get through the example 04-mpi-dolfinx.py.
I couldn’t find the alternative of “mesh.topology.create_connectivity_all()” so I deleted this line. When I run
mpirun -n 2 python3 04-mpi-dolfinx.py
I have the results
Rank 0: Number of local cells: 2
Rank 0: Number of global cells: 2
Rank 0: Number of local vertices: 4
Rank 0: Cell (dim = 2) to vertex (dim = 0) connectivity
Rank 0: <AdjacencyList> with 2 nodes
0: [0 1 2 ]
1: [0 3 2 ]
Rank 1: Number of local cells: 0
Rank 1: Number of global cells: 2
Rank 1: Number of local vertices: 0
Rank 1: Cell (dim = 2) to vertex (dim = 0) connectivity
Rank 1: <AdjacencyList> with 0 nodes
which is different from the tutorial where two nodes assemble the mesh cooperatively.
Here is my code (just minimal changes from the tutorial).
from mpi4py import MPI
import dolfinx
import dolfinx.io
comm = MPI.COMM_WORLD
def mpi_print(s):
print(f"Rank {comm.rank}: {s}")
mesh = dolfinx.mesh.create_unit_square(comm=comm, nx=1, ny=1, ghost_mode=dolfinx.mesh.GhostMode.none, diagonal=dolfinx.mesh.DiagonalType.right)
#mesh.topology.create_connectivity_all()
mpi_print(f"Number of local cells: {mesh.topology.index_map(2).size_local}")
mpi_print(f"Number of global cells: {mesh.topology.index_map(2).size_global}")
mpi_print(f"Number of local vertices: {mesh.topology.index_map(0).size_local}")
mpi_print("Cell (dim = 2) to vertex (dim = 0) connectivity")
mpi_print(mesh.topology.connectivity(2, 0))
Could you help me out? Thanks!