This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Error in example d6_p2D in FEniCS book

+1 vote

Hello,

I have been experimenting FEniCS for a few days, and encountered an error in d6_p2D.py in FEniCS book. The error occurs right here,

Ve = FunctionSpace(mesh, 'Lagrange', degree=7)
u_e_Ve = interpolate(u_e, Ve)
error = (u - u_e_Ve)**2*dx
E3 = sqrt((assemble(error)))
         ^

It seems that when the mesh gets finer, assemble() function gives a negative value. Do you have any idea why this is happening?

closed with the note: Problem solved
asked Feb 20, 2014 by ysakamoto FEniCS Novice (260 points)
closed Mar 28, 2014 by chris_richardson

Hi, are you running that code with omega=1? If so, the exact solution is easy to represent and maybe your problems are due to errors being too small (finite precision issues). I
observed assemble(error)=1E-17 and the crash on the subsequent mesh since the error was -1E-20. Try making the solution more challenging by increasing the frequency to hundred or so.

Yes. The finite precision arithmetic error was a source of failure. It works for a larger omega values.

Thanks!

...