UFL:Expr.ufl_domain() is deprecated


I am working with an .xdmf model using dolfinx and trying to assemble the stiffness and mass matrix associated to the Laplace equation to solve and eigenvalue problem.

When I run the code, I get the following warning: Level 25:UFL:Expr.ufl_domain() is deprecated, please use extract_unique_domain(expr) instead.

How should I modify my code to avoid this? I ran the same code a couple months ago and didn’t have this problem.

The lines of code I’m runing are the following:

with XDMFFile(MPI.COMM_WORLD, "mesh.xdmf", "r") as xdmf:
    domain = xdmf.read_mesh(name="Grid")

#FEM function space
V = fem.FunctionSpace(domain, ("Lagrange", 1))

#Trial and Test functions
u = ufl.TrialFunction(V)
v = ufl.TestFunction(V)

#Stifness matrix
a = ufl.dot(ufl.grad(u),ufl.grad(v))*ufl.dx 

#Mass matrix
b = u*v*ufl.dx

A = fem.petsc.assemble_matrix(fem.form(a))
B = fem.petsc.assemble_matrix(fem.form(b))


Thanks for any help.

It is a known issue and is currently being worked on: UFL deprecated function used in UFL code · Issue #132 · FEniCS/ufl · GitHub

1 Like