← Back to team overview

dolfin team mailing list archive

Re: [Question #95601]: Computing Error Norms (C++)

 

Question #95601 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/95601

Phil Marinier posted a new comment:
This is the way I did it. It worked for me. I use something different
now, because we decided to calculate the error at a different point in
our process, but when I was using this it worked fine.

element = FiniteElement("Lagrange", triangle, 1)

uh = Function(element)
u = Function(element)
e = uh - u

M = dot(e, e)*dx


then in the code:

        ENorm::Functional M;

	M.u = Phi0;
	M.uh = Phi1;
	
	double errorSqr = assemble(M);
	double error = sqrt(errorSqr);

where Phi0 and Phi1 are dolfin::Functions that I had previously solved
for. They are both defined over the same function space.

This is obviously least squares. There are built in methods to find
error norms if you use python, but as far as I know, the c++ interface
hasn't been built yet. However, if you can find the code in the dolfin
files, you can use parts of it. That's what I was doing when I was
experimenting with different error norms.

I would also like to know if there is a c++ built in way to do this.

I did this a while ago, not sure if the update has any effect on the
code.

This isn't a full answer but hopefully it helps.

-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.