Please note that your specification of versions doesn’t make sense, as
DOLFINx and FEniCSx represents the same package.
Here is an updated example for v0.7.x
from mpi4py import MPI
import dolfinx
import ufl
import numpy as np
domain = dolfinx.mesh.create_unit_square(MPI.COMM_WORLD, 1, 1)
tdim = domain.topology.dim
V = dolfinx.fem.FunctionSpace(domain, ("CG", 2))
point = np.array([[0.2, 0.3, 0]])
bb = dolfinx.geometry.bb_tree(domain, tdim)
bbox_collisions = dolfinx.geometry.compute_collisions_points(bb, point)
cells = dolfinx.geometry.compute_colliding_cells(
domain, bbox_collisions, point)
cell = cells.links(0)[0]
cmap = domain.geometry.cmaps[0]
geom_dofs = domain.geometry.dofmap[cell]
x_ref = cmap.pull_back(point, domain.geometry.x[geom_dofs])
n = ufl.as_vector([0.1, 0.2])
expr = ufl.inner(ufl.grad(ufl.TestFunction(V)), n)
E = dolfinx.fem.Expression(expr, x_ref)
grad_u_at_x_ref = E.eval(domain, [cell])
print(
f"Cell: {cell}, Point: {point}, x_ref: {x_ref}, grad(u)*n {grad_u_at_x_ref}")