I want to compute the functionals over each element and then use them later as refinement indicators. A simple example will be to compute \integral_k (u_exact - uh)^2 dx where k represents an element in the mesh. Currently, I compute the L2 norm of the error for a given exact solution using the following snippet of the code:
M = (u_ex - uh)**2 * ufl.dx
M = fem.form(M)
error = msh.comm.allreduce(fem.assemble_scalar(M),op = MPI.SUM)
But I would like to have an array wich contains element contribution.
regards
Ankit