I want to know if there is a way to get the element-wise value of the integral of a functional. The following code gives me the value of the integral over the whole boundary subdomain.
f = inner(nabla_grad(u), nabla_grad(u))*ds(1)
E = assemble(f)
But I want to know if there is a way to get it by element. That is, if the boundary subdomain (marked as "1") has "n" edges, then I want the value of each of the "n" integrals, that when added together match the value of the integral over the whole boundary subdomain (shown above).
The only solution that I can think of is to split the subdomain into "n" different subdomains and perform the integration. However I haven't figured out how to do it, so any help would be appreciated.