`errornorm()` misnamed

Issue #354 invalid
Nico Schlömer created an issue

I compute the difference between two states of the same function space as

errornorm(u0, u1)

Then, I get the warning

*** Warning: Degree of exact solution may be inadequate for accurate result in errornorm.

I assume this warning is to indicate that the argument u1 is normally used as "exact solution", and in this case isn't.

I would like to point out that errornorm() can be used for things other than measuring errors, namely just comparing function from the same or different function spaces.

I would hence propose to move the contents of errornorm() except the mentioned warning into a different function, e.g., difference_norm(), and call that from errornorm().

This change leaves the API intact and removes log spam.

Comments (5)

  1. Jan Blechta

    No, u0 should be "exact solution".

    This "log spam" may be useful as the most of DOLFIN users do not realize that explicitly given Expression is interpolated through Lagrange degree 1 element by default (which I do not regard good, pythonic design choice). This warning can point this out.

    Maybe errornorm can be removed. It is not obvious what it is useful for and the only reason of its existence seems to be historical as recently documented by @martinal. Tensor optimization FErari should be no more used.

  2. Jan Blechta

    That's what I am talking about. Try this:

    from dolfin import *
    mesh = UnitIntervalMesh(1)
    e1 = Expression("x[0]*x[0]")
    e2 = Expression("x[0]*x[0]", degree=2)
    print assemble(e1*dx(mesh))
    print assemble(e2*dx(mesh))
    

    Here it is Lagrange of degree 1 and 2 respectively. But one can in principle use other elements by using element kwarg.

  3. Nico Schlömer reporter

    Mhm. Well, this should be a warning when creating an Expression, shouldn't it?

    which I do not regard good

    Me neither!

  4. Log in to comment