← Back to team overview

fenics team mailing list archive

Re: misleading message with interpolate?

 

On Thu, Jun 24, 2010 at 05:57:57PM -0500, Douglas Arnold wrote:
> If we run this simple program, which interpolates the quadratic  x*y
> onto a mesh of the unit square and then integrate it, it gives
> the exact answer .25.  This is not surprising, but the warning
> message
>
>   Automatic selection of expression element: <CG? on a <? of degree 1>>
>
> is.  What does the "degree 1" refer to.  I interpreted it to be warning
> me that the expression was interpolated into the P1 element space, but
> that cannot be correct, since then I would not have gotten the exat
> integral.
>
> Code:
>
> from dolfin import *
> mesh = UnitSquare(4,4)
> V = FunctionSpace(mesh,'CG',2)
> f = interpolate(Expression("x[0]*x[1]"),V)
> print(assemble(f*dx, mesh=mesh))
>
>
> Output:
>
> Warning: Converting real-valued parameter to double, might loose precision.
> Automatic selection of expression element: <CG? on a <? of degree 1>>
> Warning: Converting real-valued parameter to double, might loose precision.
> 0.25

Degree 1 means here the degree of the mapping of the geometry (which
is almost always 1). It's there in UFL to enable higher order
(isoparametric) mapping.

The ? means that DOLFIN does not know the appropriate polynomial
degree of the function space at the time the message is written. The
degree is selected later by the form compiler. This is more of a debug
message that was introduced when we implemented the automatic
selection (to remove the need for the V=V argument).

I've removed that output now. What would be more interesting would be
for the form compiler to print the degree it selects. It does print
that but it gets lost somewhere in the communication between DOLFIN
and FFC. I'll see if it can be fixed.

--
Anders

Attachment: signature.asc
Description: Digital signature


Follow ups

References