norm is from firedrake.norms.norm(...). But I still get the error even without it.

On Thu, Nov 12, 2015 at 2:50 PM, Andrew McRae <A.T.T.McRae@bath.ac.uk> wrote:
Is 'norm' some symbolic UFL thing?

On 12 November 2015 at 21:48, Justin Chang <jychang48@gmail.com> wrote:
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?

Thanks,
Justin

On Thu, Nov 12, 2015 at 4:33 AM, Lawrence Mitchell <lawrence.mitchell@imperial.ac.uk> wrote:
On 12/11/15 11:27, Justin Chang wrote:
> David,
>
> So if D.assign(assemble(div(q) * e * dx)/assemble(e * dx)) returns
> cell-wise div(q), what's the denominator "/assemble(e * dx)" for?


It's just the normal FE L2 projection:

you want:

u = div(q)

So you hit both sides with a test function and integrate:

u*e*dx = div(q)*e*dx

Where u is a trial function in DG0, e is a test function in DG and q
is in whereever.

But, as David points out, the DG0 mass-matrix is completely diagonal.
 The values on the diagonal are just obtained by assembling the lone
test function:

diag = assemble(e*dx)

But now, because the matrix is diagonal, you can solve the linear
system pointwise by doing a pointwise division:

rhs = assemble(div(q)*e*dx)

solution = assemble(rhs/diag)


Cheers,

Lawrence


_______________________________________________
firedrake mailing list
firedrake@imperial.ac.uk
https://mailman.ic.ac.uk/mailman/listinfo/firedrake




_______________________________________________
firedrake mailing list
firedrake@imperial.ac.uk
https://mailman.ic.ac.uk/mailman/listinfo/firedrake