[firedrake] Projecting CG1 function into DG0 function

Justin Chang jychang48 at gmail.com
Thu Nov 12 21:48:13 GMT 2015


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 at 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 at imperial.ac.uk
> https://mailman.ic.ac.uk/mailman/listinfo/firedrake
>
>
-------------- next part --------------
HTML attachment scrubbed and removed


More information about the firedrake mailing list