Subject: [Ufl] How is the quad_scheme argument to FiniteElement interpreted?

From: Martin Sandve Alnæs <[email-masked]>
Date: Mon, 23 May 2011 11:20:25 +0200

Is this documented somewhere? Since it is a UFL argument, it should be
documented in UFL.

Martin

---

From: Kristian Ølgaard <[email-masked]>
Date: Mon, 23 May 2011 12:05:45 +0200

> Is this documented somewhere? Since it is a UFL argument, it should be

It's not documented anywhere I think. True, it is a UFL argument, but
UFL doesn't know anything about quadrature schemes and I don't think
it needs to. The argument just has to be a string, then it's up to the
form compilers how to deal with the argument.
FFC currently supports two different schemes, the 'default' scheme
which is the hardcoded quadrature schemes which Garth implemented and
the 'canonical' scheme which is a Gauss--Legendre--Jacobi quadrature
scheme mapped onto simplices.

Kristian

> Martin
>
> _______________________________________________
> Mailing list: https://launchpad.net/~ufl
> Post to     : [email-masked]
> Unsubscribe : https://launchpad.net/~ufl
> More help   : https://help.launchpad.net/ListHelp
>

---

From: Martin Sandve Alnæs <[email-masked]>
Date: Tue, 24 May 2011 11:23:27 +0200

> scheme mapped onto simplices.

Ok. And why does a FiniteElement need to have an associated a quad scheme?

Martin

---

From: Kristian Ølgaard <[email-masked]>
Date: Tue, 24 May 2011 11:39:55 +0200

> Ok. And why does a FiniteElement need to have an associated a quad scheme?

Because the dofs of quadrature elements are located at the quadrature
points with a value of 1 at those points and zero elsewhere.
Derivatives are not defined. This enables this type of element to be
handled like any other finite element by the form compilers.
However, it also means that FiniteElement("Quadrature", triangle, 2)
will have 4 dofs if the 'canonical' scheme is used and only 3 dofs if
the 'default' scheme is used.
Therefore the scheme has to be included when identifying unique elements.

Kristian

---

From: Martin Sandve Alnæs <[email-masked]>
Date: Tue, 24 May 2011 15:31:13 +0200

> Therefore the scheme has to be included when identifying unique elements.

Thanks, that makes perfect sense.

Martin

---

From: Florian Rathgeber <[email-masked]>
Date: Fri, 03 Jun 2011 20:38:23 +0100

> Thanks, that makes perfect sense.

Kristian, could you provide an example how this is used? I have a use
case where I want to specify a quadrature scheme and this would come in
really handy. However I don't currently see how to access this
information in the form compiler.

Florian

---

From: Kristian Ølgaard <[email-masked]>
Date: Fri, 3 Jun 2011 22:02:40 +0200

On 3 June 2011 21:38, Florian Rathgeber
<[email-masked]> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>

Currently, only the FFC compiler supports different quadrature schemes.
This is selected from the command line using the '-q scheme' options
where 'scheme'
can be one of 'default' or 'canonical'. 'default' is, well, the default.
To use a different scheme you can add one to
ffc/ffc/quadrature_schemes.py and perhaps submit a patch if you think
it might be useful for others.

The 'quadrature_scheme' argument to FiniteElements in UFL is not used
by the form compilers at the moment so it can be ignored for now.

Kristian

> Florian
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
>
> iEYEARECAAYFAk3pOC8ACgkQ8Z6llsctAxadewCbBB+hbRBmItn4A5/rKuiw6b5C
> DrYAnRz7OjWJBNMWEoQ0WJztNRDpnvCM
> =iQE5
> -----END PGP SIGNATURE-----
>
>

---

From: Florian Rathgeber <[email-masked]>
Date: Fri, 03 Jun 2011 21:27:50 +0100

>> by the form compilers at the moment so it can be ignored for now.

Sorry, I was imprecise. The quadrature_scheme parameter to a
FiniteElement would usually be a string specifying the name of the
scheme to be parsed by the form compiler? I want to use the
quadrature_scheme argument in UFL to pass the quadrature degree
(gaussian quadrature) for our own form compiler (which is completely
separate from FFC) and would hence abuse it to carry an int. Since UFL
doesn't interpret the parameter in any way I should be fine doing that,
right?

Florian

---

From: Kristian Ølgaard <[email-masked]>
Date: Sat, 4 Jun 2011 00:40:27 +0200

On 3 June 2011 22:27, Florian Rathgeber
<[email-masked]> wrote:
> scheme to be parsed by the form compiler?

Yes, but it could be anything. I don't think UFL does any type checks
on the argument at the moment, but if it did it should probably only
be a check if it is a string or not. What the argument actually means
is left completely to the form compilers.

> I want to use the

That's exactly how I think it should be used from UFL.

Kristian

> iEYEARECAAYFAk3pQ8YACgkQ8Z6llsctAxbMhQCgoCGLFrA9lLBc30QPo3cAYuST
> qZgAnRX7Vl7nAUyUHc/D23ofRHSDUshU
> =FdMJ

---

From: Martin Sandve Alnæs <[email-masked]>
Date: Mon, 6 Jun 2011 10:18:05 +0200

> That's exactly how I think it should be used from UFL.

Can't you use the degree parameter instead for the degree?

Martin

---

From: Florian Rathgeber <[email-masked]>
Date: Fri, 10 Jun 2011 23:53:34 +0100

>> Can't you use the degree parameter instead for the degree?

Do you suggest to compute the quadrature degree needed to integrate an
element of polynomial degree "degree" exactly? Could do, but currently
the quadrature degree is given in the input file format, so the form
compiler is not smart about choosing the quadrature degree. This might
change however.

What is form_degree for btw.?

Florian

---

From: Kristian Ølgaard <[email-masked]>
Date: Sat, 11 Jun 2011 13:58:15 +0200

> compiler is not smart about choosing the quadrature degree. This might

But if you already pass the quadrature degree to the compiler in the
input file, then why do want to pass it as part of the
FiniteElement? Then you'll have to add it in all element definitions.
I suggest to let UFL compute the polynomial degree of a given integral
using the ufl.algorithm.estimate_total_polynomial_degree function and
from that determine what quadrature degree you need for the scheme
that you're using.
If you find this degree to be too high, you can always set a threshold
in your input file.

Kristian

> iEYEARECAAYFAk3yoG4ACgkQ8Z6llsctAxZrnACfYM9jn3Iz3B388mTkcoa2+8fy
> tvoAnRhUeCyhn/mPNigCMzwmj0Opy7J8
> =fu+p

---

From: Florian Rathgeber <[email-masked]>
Date: Sat, 11 Jun 2011 15:07:29 +0100

>> If you find this degree to be too high, you can always set a threshold

That is due to the design of the form compiler: The input file contains
some meta data used to create UFL FiniteElement objects and only these
are then passed on to further compilation stages. So I thought the
cleanest way to transport the quadrature degree is in the element.

However I totally see the point of having UFL compute the optimal
quadrature degree and will probably use that instead. The quadrature
degree in the input file is the minimum to exactly integrate all
integrals anyway, so having UFL compute it is more straightforward and
less error prone.

Florian

---

From: "Marie E. Rognes" <[email-masked]>
Date: Mon, 13 Jun 2011 13:18:39 +0200

> What is form_degree for btw.?

The form_degree is the form degree when exterior calculus notation is 
used for specifying the finite element, see the ufl/demo/FEEC.ufl for an 
example.

--
Marie