dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #14561
Re: Using errornorm() in C++
Quoting phil marinier <lonewolf_13p@xxxxxxxxxxx>:
>
> This is the .ufl file that I wrote so that I could evaluate an error norm in
> my main():
>
>
> element = FiniteElement("Lagrange", triangle, 1)
>
> v = TestFunction(element)
> u = TrialFunction(element)
> f = Function(element)
>
> a = inner(grad(v), grad(u))*dx
> L = v*f*dx
>
> uh = Function(element)
> u = Function(element)
> e = uh - u
>
> errorSqr = dot(e, e)*dx
>
>
> It compiles, but that doesn't mean its right. I am only interested in the L2
> norm at the moment.
>
> Assuming this does what I think it does, how do I access this code from my
> main. I included ENorm.h and I can do regular VariationalProblem solutions
> using this .h file. I tried doing ENorm::e, ENorm::errorSqr, L.e, L.errorSqr.
> I am obviously missing something basic here.
Put the code:
uh = Function(element)
u = Function(element)
e = uh - u
M = dot(e, e)*dx
in a separate ufl file, compile and include it in main.cpp and assemble the
functional (look at demo/pde/functional/).
Kristian
> I was thinking of doing Function.vector() and directly manupulating the
> GenericVectors in my main() but then I realised that I probably can't use
> dot() inside main()
>
> Thanks for your help, with this and previously,
>
> Phil
>
References