fem.Expression not working

Hi everyone,
I was trying to use the fem.Expression command to define a function and I encounter some problems. So I was looking at the tutorials (in particular at this one): I’m reporting the code:

import ufl
from dolfinx import mesh, fem
from mpi4py import MPI
from petsc4py.PETSc import ScalarType

domain = mesh.create_unit_square(MPI.COMM_WORLD, 8, 8, mesh.CellType.quadrilateral)

V = fem.FunctionSpace(domain, ("CG", 2))

x = ufl.SpatialCoordinate(domain)
beta = fem.Constant(domain, ScalarType(12))
R0 = fem.Constant(domain, ScalarType(0.3))
p = 4 * ufl.exp(-beta**2 * (x[0]**2 + (x[1] - R0)**2))

expr = fem.Expression(p, V.element.interpolation_points)
pressure = fem.Function(V)
pressure.interpolate(expr)

Here’s the error message:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-5-5a79b2277334> in <module>()
     13 p = 4 * ufl.exp(-beta**2 * (x[0]**2 + (x[1] - R0)**2))
     14 
---> 15 expr = fem.Expression(p, V.element.interpolation_points)
     16 pressure = fem.Function(V)
     17 pressure.interpolate(expr)

/usr/local/lib/python3.7/dist-packages/dolfinx/fem/function.py in __init__(self, ufl_expression, X, form_compiler_params, jit_params, dtype)
     96         """
     97 
---> 98         assert X.ndim < 3
     99         num_points = X.shape[0] if X.ndim == 2 else 1
    100         _X = np.reshape(X, (num_points, -1))

AttributeError: 'builtin_function_or_method' object has no attribute 'ndim'

Does anyone know why this occurs? Because the syntax is identical to the tutorial…

Thanks in advance

There has been a recent change that I’ve not had time to reflect in the tutorial.

You should replace:

with
V.element.interpolation_points()

Thanks for the quick answer!!