Scaling by element area/volume

Hi,

I am trying to implement mesh morphing techniques for FSI problems, where I need to scale the element-wise integral by the area of the element or the Jacobian of the mapping at the quadrature point.
The quantity to be integrated is the stiffness matrix for the linear elasticity problem.

scaling-by-Jacobian

I have been trying to access the element radius or area like in the legacy FEniCS code but to no avail. I would appreciate any help with implementing this in FEniCSx.

Consider the following MWE:

from mpi4py import MPI

comm = MPI.COMM_WORLD
import dolfinx

mesh = dolfinx.mesh.create_unit_square(comm, 1, 4, cell_type=dolfinx.cpp.mesh.CellType.quadrilateral)

import ufl

detJ = abs(ufl.JacobianDeterminant(mesh))

V = dolfinx.fem.functionspace(mesh, ("Lagrange", 1))
v = ufl.TestFunction(V)

L1 = v/ detJ * ufl.dx
L2 = v * ufl.dx

b1 = dolfinx.fem.assemble_vector(dolfinx.fem.form(L1))
b2 = dolfinx.fem.assemble_vector(dolfinx.fem.form(L2))

print(b1.array)
print(b2.array)

yielding

[0.25 0.5  0.25 0.5  0.5  0.5  0.5  0.5  0.25 0.25]
[0.0625 0.125  0.0625 0.125  0.125  0.125  0.125  0.125  0.0625 0.0625]

Thank you very much for your prompt response!