# Rule of thumb for quadrature degree

**URL:** <https://fenicsproject.discourse.group/t/rule-of-thumb-for-quadrature-degree/11346>\
**Category:** variational formulation\
**Created:** [May 30, 2023, 5:59pm UTC](https://fenicsproject.discourse.group/t/rule-of-thumb-for-quadrature-degree/11346 "2023-05-30T17:59:48Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [May 30, 2023, 8:08pm UTC](https://fenicsproject.discourse.group/t/rule-of-thumb-for-quadrature-degree/11346/4 "2023-05-30T20:08:45Z")

</div>

> [@bay\_swiss](#):
>
> 1b. what is an affine mesh? Sorry if it should be obvious.

An affine mesh is a mesh Which has a linear operation between the reference and physical element.

First order triangles and tetrahedra are affine.  
In general quads and hexes are not (only if they are parallellograms or a parallelepiped).  
If they are non-affine, the jacobian is a polynomial of some order (in 3D i think its about 4).

Higher order (curved cells) are also non-affine.

I would use the Xiao-Gimbutas quadrature rule:

> <https://github.com/FEniCS/basix/blob/main/cpp/basix/quadrature.cpp#L1537>

Which can be accessed through Basix and used as a custom quadrature rule.

> <https://github.com/FEniCS/basix/blob/b08212170c28bbf9fe8f3af37d286ec2e23c138d/test/test_quadrature.py#L52>

Ref

> [@Total number of gauss point](https://fenicsproject.discourse.group/t/total-number-of-gauss-point/8904/2):
>
> The number of Gauss-points used depends on the variational form. DOLFINx uses ufl to estimate the quadrature degree of the variational form, see: This is in turn sent to [basix](https://github.com/FEniCS/basix) which tabulates at the relevant points. You can use basix directly to investigate the default quadrature of any order, see:[Creating and using a quadrature rule — Basix 0.8.0.0 documentation](https://docs.fenicsproject.org/basix/main/python/demo/demo_quadrature.py.html) You can also by-pass the basix/ufl workflow by supplying your own quadrature rule:

---

_[View the full topic](https://fenicsproject.discourse.group/t/rule-of-thumb-for-quadrature-degree/11346)._
