Subject: Re: [Ffc] [Branch ~dolfin-core/dolfin/main] Rev 4434: Set parameter to use tensor rep for DG Poisson demo. It's broken.

From: Anders Logg <[email-masked]>
Date: Wed, 3 Feb 2010 08:29:43 +0100

On Tue, Feb 02, 2010 at 11:20:32PM -0000, [email-masked] wrote:
> ------------------------------------------------------------
> revno: 4434
> committer: Garth N. Wells <[email-masked]>
> branch nick: dolfin-all
> timestamp: Tue 2010-02-02 23:16:44 +0000
> message:
>   Set parameter to use tensor rep for DG Poisson demo. It's broken.
>
>   This shows that tensor rep is not wotking for DG.

I think it just shows that the tensor representation does not handle
FacetNormals or Division which is known. Without the -r representation
option, FFC will automatically discover that the integrand in question
needs to be done with quadrature but if someone insists on -r tensor,
then FFC will try and explain why it fails:

  *** FFC: No handler defined for expression Division.

I'll switch the demo back to "auto".

--
Anders

> modified:
>   demo/pde/dg/poisson/python/demo.py
>
>

> === modified file 'demo/pde/dg/poisson/python/demo.py'
> --- demo/pde/dg/poisson/python/demo.py	2010-01-27 21:09:29 +0000
> +++ demo/pde/dg/poisson/python/demo.py	2010-02-02 23:16:44 +0000
> @@ -23,6 +23,8 @@
>
>  from dolfin import *
>
> +parameters["form_compiler"]["representation"] = "tensor"
> +
>  # Create mesh and define function space
>  mesh = UnitSquare(24, 24)
>  V = FunctionSpace(mesh, "DG", 1)
>

---

From: "Garth N. Wells" <[email-masked]>
Date: Wed, 03 Feb 2010 08:04:54 +0000

Anders Logg wrote:
> FacetNormals 

This sounds to me like a significant deficiency. Is there are technical
reason for this?

or Division which is known.

> Without the -r representation
> needs to be done with quadrature

OK, it's good it if can figure this out.

Garth

> but if someone insists on -r tensor,
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~dolfin
> Post to     : [email-masked]
> Unsubscribe : https://launchpad.net/~dolfin
> More help   : https://help.launchpad.net/ListHelp

---

From: Anders Logg <[email-masked]>
Date: Wed, 3 Feb 2010 12:44:56 +0100

> This sounds to me like a significant deficiency. Is there are technical

It has been like this for about a year (since the UFL introduction
last year). Before we had the quadrature option, we stretched the
tensor representation to support things it really couldn't handle like
division, sqrt etc by some tricks. When we did the UFL conversion last
year, I thought it best to remove these special tricks to keep the
implementation simple. FacetNormal is somewhere in between. It could
be added with some effort but since it is handled nicely by the
quadrature representation it is not a high priority to add back.

> OK, it's good it if can figure this out.

Here's how FFC selects the representation:

1. If there's a quadrature element --> return "quadrature"

2. If tensor representation is not possible --> return "quadrature"

3. Compare estimated cost of tensor and quadrature representation and
use the most efficient option.

The above case gets quadrature because of 2.

The cost is estimated as the rank of the geometry tensor (number of
derivatives + number of coefficients) and tensor representation is
used if the cost is 3 or less. This can be fine-tuned with some
appropriate benchmarks.

--
Anders