# Computing Error Norms (C++)

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(

v = Coefficient(

w = Coefficient(

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(

Then in main.cpp, I had

Function u_exact_

u_exact_

Error::functional M(mesh, u_exact_high, u);

double error = std::sqrt(

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

## Question information

- Language:
- English Edit question

- Status:
- Solved

- For:
- DOLFIN Edit question

- Assignee:
- No assignee Edit question

- Solved by:
- Andy R Terrel

- Solved:

- Last query:

- Last reply: