erronnorm, sum of expressions
Issue #220
invalid
errornorm
is a little to strict with its argument checking: Sums (of Expression
s) aren't accepted although they are perfectly valid as exact solutions.
MWE:
from dolfin import *
mesh = UnitSquareMesh(20, 20)
V = FunctionSpace(mesh, 'CG', 1)
u = Function(V)
ex0 = Expression('sin(x[0])')
ex1 = 1.0
#ex1 = Constant(1.0)
errornorm(ex0 + ex1, u)
One possible solution would be to treat the sum of Expression
s (and products,...) as Expression
s.
Comments (5)
-
-
- changed status to invalid
-
reporter I've always been thinking of
Expression
s as expression in the mathematical sense, i.e., the sum of two expressions is an expression and so forth. Apparently, that's not quite the correct notion since "elements" (?) are associated with them. Is there any more detailed info available? -
Try help(Expression) ;-)
-
Expression = dolfin type
Expr = ufl type
If you want to work with symbolic expressions, stick with ufl types and avoid Expression.
- Log in to comment
The implementation of errornorm() is based on specifying an GenericFunction (user Expression or Function) as the exact solution. This is required since we need to know the exact function space (element) of the exact solution. If you specify a sum of Expressions, those may have different elements, and the function would not know what to do. If you have a sum, then interpolate that sum into a suitable higher order space before sending it into errornorm().