← Back to team overview

dolfin team mailing list archive

Re: Using errornorm() with C++

 

On Wed, Aug 05, 2009 at 05:31:30PM -0400, phil marinier wrote:
> 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.

That's correct. errornorm() is only defined in the DOLFIN Python
interface and can't be used from form files (.ufl files).

What you need to do is to look at the code in errornorm.py and copy
that appropriately to a .ufl file. It's not that complicated.

> 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.

:-)

-- 
Anders


> Any help would be appreciated.
> 
> Phil

> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/mailman/listinfo/dolfin-dev

Attachment: signature.asc
Description: Digital signature


References