Hi guys,
So I was attempting to do something similar:
L2_error_norm = norm(assemble(v*(u-u_exact)*dx)/assemble(v*dx))
where v is test function, u is FE solution, and u_exact is the analytical solution. All of which are CG1 space. I get an error saying "fl.log.UFLException: Division by non-scalar is undefined"
Know what's up?
Yes, that's either a missing feature or a bug depending on how you look at it. However I think you are just confused in what you are trying to do.
What you probably meant was:
errornorm(u, u_exact)
(errornorm is a Firedrake-provided function).
What errornorm is basically doing is:
assemble((u-u_exact)**2*dx))**0.5
Note that this is a zero-form (no test or trial function; the answer is a scalar) so there are no solves, or divisions by lumped mass.
errornorm actually does somewhat more sophisticated things such as increasing the polynomial order of the functions in order to avoid certain sorts of error, so it's typically better to use errornorm than to do it yourself.
Regards,
David