Error execcting a command from the tutorial

Good morning,

I try to reproduce the fist example of the fenicsx tutorial
I obtained the error message
AttributeError: module 'dolfinx.mesh' has no attribute 'exterior_facet_indices'
for the line
boundary_facets = mesh.exterior_facet_indices(domain.topology)

I use DOLFINx version: 0.4.1 based on GIT commit: unknown of GitHub - FEniCS/dolfinx: Next generation FEniCS problem solving environment

Here is the script I write

from mpi4py import MPI
import numpy
import dolfinx
from dolfinx import mesh
from dolfinx import fem
#
# Dolfinx version
#
print(f"DOLFINx version: {dolfinx.__version__} based on GIT commit: {dolfinx.git_commit_hash} of https://github.com/FEniCS/dolfinx/")
#
# mesh
#
domain = mesh.create_unit_square(MPI.COMM_WORLD, 8, 8, mesh.CellType.quadrilateral)
#
# Spaces
#
V = fem.FunctionSpace(domain, ("CG", 1))
#
# Boundary conditions
#
uD = fem.Function(V)
uD.interpolate(lambda x: 1 + x[0]**2 + 2 * x[1]**2)
#
# Create facet to cell connectivity required to determine boundary facets
#
tdim = domain.topology.dim
fdim = tdim - 1
domain.topology.create_connectivity(fdim, tdim)
boundary_facets = mesh.exterior_facet_indices(domain.topology)

And here is the output produced by typing python3 poisson_02.py

DOLFINx version: 0.4.1 based on GIT commit: unknown of https://github.com/FEniCS/dolfinx/
Traceback (most recent call last):
  File "poisson_02.py", line 29, in <module>
    boundary_facets = mesh.exterior_facet_indices(domain.topology)
AttributeError: module 'dolfinx.mesh' has no attribute 'exterior_facet_indices'

Thank you

Xavier

Hi Xavier,

The tutorial is based of

DOLFINx version: 0.4.2.0 based on GIT commit: b983596ace0842230a442e10e49ffd4f27c34419 of https://github.com/FEniCS/dolfinx/

You can either upgrade to the latest version or try to see the corresponding tutorial under a previous commit,

Most likely this should be

boundary_facets = numpy.flatnonzero(mesh.compute_boundary_facets(domain.topology))

but Iā€™d have to run this on a previous version to check.

1 Like

Thank you,

Do you know how I can upgrade to the lasted version ?
I installed the fenicsx package this morning and I obtained the 0.4.1.0 release.

X

The easiest option would be to pull the latest docker image. Or if you are on linux then install from source.

Thank you.
The source are the newest release of dolfinx ?

The dolfinx/dolfinx docker image is built nightly.
I will release a new updated image with all tutorial dependencies tonight.

Installing from source you would clone the GitHub repository of DOLFINx, and can then checkout the version you would like to use.

See: An overview of the FEniCS Project ā€” FEniCSx tutorial
for docker images compatible with the current release of the tutorial.

2 Likes