Why is the Jacobian of mesh flipped, thus having negative determinant? See the code below.
import ufl
from dolfinx import fem, mesh
from mpi4py import MPI
NX = 2
NY = 2
grid = mesh.create_unit_square(MPI.COMM_WORLD, NX, NY, mesh.CellType.quadrilateral)
J_ufl = ufl.Jacobian(grid)
Vj = fem.functionspace(grid, ("DG", 0, (2, 2)))
J_fn = fem.Function(Vj)
J_fn.interpolate(fem.Expression(J_ufl, Vj.element.interpolation_points()))
J = J_fn.x.array.reshape(-1, 2, 2)
print("jacobian:", J)
It outputs
jacobian: [[[0. 0.5]
[0.5 0. ]]
[[0. 0.5]
[0.5 0. ]]
[[0. 0.5]
[0.5 0. ]]
[[0. 0.5]
[0.5 0. ]]]