dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #17092
[Question #95601]: Computing Error Norms (C++)
New question #95601 on DOLFIN:
https://answers.launchpad.net/dolfin/+question/95601
Hi all
I am trying to compute the error given a known solution. (C++). This is what I did.
I created two .ufl files; the first to genrate a functional:
Error.ufl
=======
element = FiniteElement("Lagrange", "triangle", 3)
v = Coefficient(element)
w = Coefficient(element)
M= ((w - v) * (w - v)) * dx
and the second to represent a higher order function space onto which the exact solution will be interpolated:
HigherOrder.ufl
=============
element = FiniteElement("Lagrange", "triangle", 3)
Then in main.cpp, I had
Function u_exact_high(V_high_order);
u_exact_high.interpolate(u_exact);
Error::functional M(mesh, u_exact_high, u);
double error = std::sqrt(assemble(M));
1. is this the correct way to do it?
2. Is there a function or class that I can use? [I've searched but couldn't find one].
3. Do I follow the same procedure to calculate the H1 seminorm and other norms?
Best wishes
Pietro
--
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.