← Back to team overview

dolfin team mailing list archive

Using errornorm() with C++

 

I am trying to use the dolfin errornorm() function to find the relative error between two iterations of my solution. I realise the errornorm() function is designed to find the absolute error, so will this cause a problem?

In my main() I tried errornorm(phi0, phi1, "L2"), dolfin::errornorm(phi0, phi1, "L2"), Laplace::errornorm(phi0, phi1, "L2"), (Laplace is the name of my .ufl file that I compiled to produce Laplace.h and phi0 and phi1 are both dolfin::Functions) and none of these worked.  I also tried modifying my .ufl file like so:

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)
error = errornorm(u, uh, "L2")


The errors I was getting is that errornorm is not defined. The version of dolfin that I am currently running was downloaded three nights ago. The only documentation that I found for errornorm() is in DOLFIN: Automated Finite Element Computing by Anders Logg and Garth N. Wells and it was writen in python. errornorm() was also mentioned in the faq. I know I have a history of stupid questions, so sorry if this is another one.

Any help would be appreciated.

Phil

Follow ups