** Code:**
domain.topology.create_connectivity(fdim, tdim)
boundary_facets = mesh.exterior_facet_indices(domain.topology)
Error:
boundary_facets = mesh.exterior_facet_indices(domain.topology)
AttributeError: module ‘dolfinx.mesh’ has no attribute ‘exterior_facet_indices’
I ran the code in both Ubuntu and conda which I installed on 29th July. Got the same error in both.
This is the whole code:
from mpi4py import MPI
from dolfinx import mesh
domain = mesh.create_unit_square(MPI.COMM_WORLD, 8, 8, mesh.CellType.quadrilateral)
from dolfinx.fem import FunctionSpace
V = FunctionSpace(domain, ("CG", 1))
from dolfinx import fem
uD = fem.Function(V)
uD.interpolate(lambda x: 1 + x[0]**2 + 2 * x[1]**2)
import numpy
# 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)
boundary_dofs = fem.locate_dofs_topological(V, fdim, boundary_facets)
bc = fem.dirichletbc(uD, boundary_dofs)
import ufl
u = ufl.TrialFunction(V)
v = ufl.TestFunction(V)
from petsc4py.PETSc import ScalarType
f = fem.Constant(domain, ScalarType(-6))
a = ufl.dot(ufl.grad(u), ufl.grad(v)) * ufl.dx
L = f * v * ufl.dx
problem = fem.petsc.LinearProblem(a, L, bcs=[bc], petsc_options={"ksp_type": "preonly", "pc_type": "lu"})
uh = problem.solve()
from dolfinx import io
with io.VTKFile(domain.comm, "poissonx2/outputp.pvd", "w") as vtk:
vtk.write([uh._cpp_object])
with io.XDMFFile(domain.comm, "poissonx2/outputx.xdmf", "w") as xdmf:
xdmf.write_mesh(domain)
xdmf.write_function(uh)
This is the code from the FEniCSx Tutorial.
I apologise in advance if this is a silly doubt. I’m very new to FEniCSx.