On 13 August 2012 12:35, Martin Sandve Alnæs <email address hidden> wrote:
> In the email prior to this report, you say that:
> """
> Also, DOLFIN/FFC interpolates all functions in a finite element space,
> so when computing errors some care is necessary to be sure that
> analytical expressions are evaluated with sufficient accuracy. Doing
>
> u0 = Expression("1.0 + x[0]*sin(pi*x[0])")
> f = Expression("2.0*pi*cos(pi*x[0]) - pi*pi*x[0]*sin(pi*x[0])")
>
> the form compiler FFC will try to determine a suitable order Lagrange
> basis. This should be high enough, but to be sure you can force the
> degree, say
>
> u0 = Expression("1.0 + x[0]*sin(pi*x[0])", degree=p+6)
> f = Expression("2.0*pi*cos(pi*x[0]) - pi*pi*x[0]*sin(pi*x[0])",
> degree=p+6)
> """
>
> AFAIK this is _not_ correct. When making an Expression("..."), FFC does
> not even know what the expression string is, and the degree that DOLFIN
> assigns is independent of the expression string.
>
Yes, it is independent of the string but DOLFIN does not determine
the degree. FFC makes a guess at the degree. The code is in
ffc/ffc/analysis.py in the function
_auto_select_degree(elements)
> If, on the other hand, you use an UFL expression:
> u0 = 1.0 + x[0]*sin(pi*x[0])
> and compile a functional
> error = (u-u0)**2*dx
> then no interpolation of u0 takes place, since the exact expression for u0 will become part of the code generated by FFC, and the complexity of u0 will be visible to FFC/UFL when estimating an integration order.
>
With the above, the accuracy issue is shifted from interpolation to
integration. The functional above will be integrated approximately,
and one needs to make sure that the integration is sufficiently
accurate. If u0 is an Expression, the integration is exact but there
is an interpolation error.
On 13 August 2012 12:35, Martin Sandve Alnæs <email address hidden> wrote: "2.0*pi* cos(pi* x[0]) - pi*pi*x[ 0]*sin( pi*x[0] )") "2.0*pi* cos(pi* x[0]) - pi*pi*x[ 0]*sin( pi*x[0] )",
> In the email prior to this report, you say that:
> """
> Also, DOLFIN/FFC interpolates all functions in a finite element space,
> so when computing errors some care is necessary to be sure that
> analytical expressions are evaluated with sufficient accuracy. Doing
>
> u0 = Expression("1.0 + x[0]*sin(pi*x[0])")
> f = Expression(
>
> the form compiler FFC will try to determine a suitable order Lagrange
> basis. This should be high enough, but to be sure you can force the
> degree, say
>
> u0 = Expression("1.0 + x[0]*sin(pi*x[0])", degree=p+6)
> f = Expression(
> degree=p+6)
> """
>
> AFAIK this is _not_ correct. When making an Expression("..."), FFC does
> not even know what the expression string is, and the degree that DOLFIN
> assigns is independent of the expression string.
>
Yes, it is independent of the string but DOLFIN does not determine
the degree. FFC makes a guess at the degree. The code is in
ffc/ffc/analysis.py in the function
_auto_ select_ degree( elements)
> If, on the other hand, you use an UFL expression:
> u0 = 1.0 + x[0]*sin(pi*x[0])
> and compile a functional
> error = (u-u0)**2*dx
> then no interpolation of u0 takes place, since the exact expression for u0 will become part of the code generated by FFC, and the complexity of u0 will be visible to FFC/UFL when estimating an integration order.
>
With the above, the accuracy issue is shifted from interpolation to
integration. The functional above will be integrated approximately,
and one needs to make sure that the integration is sufficiently
accurate. If u0 is an Expression, the integration is exact but there
is an interpolation error.
Garth
> -- /bugs.launchpad .net/bugs/ 1036135 /bugs.launchpad .net/dolfin/ +bug/1036135/ +subscriptions
> You received this bug notification because you are a member of DOLFIN
> Core Team, which is subscribed to DOLFIN.
> https:/
>
> Title:
> Python function errornorm will give misleading results for higher-
> order elements
>
> To manage notifications about this bug go to:
> https:/