How to get quadrature points and their weights?

In the previous FEniCS version, quadrature points and corresponding weights can be calculated like this:

from ffc.quadrature_schemes import create_quadrature

shape = "tetrahedron"
degree = 2
scheme="default"

(points, weights) = create_quadrature(shape, degree, scheme)

Is there any similar function in the current version of FEniCS?

Hi,
Looking at the repo, this seems to be what you are looking for:

from ffc.fiatinterface import create_quadrature as cquad
shape = "triangle"
deg = 2
scheme = "default"

points, weights = cquad(shape, deg, scheme)

3 Likes

Thank you. This is what I was looking for.

Can we know the shape functions used for tetrahedron and default scheme in FEniCS?

Any help is appreciated.

Are you using legacy DOLFIN or DOLFINx?

The general shape functions used for Lagrangian elements order 1: https://defelement.com/elements/examples/tetrahedron-Lagrange-1.html, order 2: https://defelement.com/elements/examples/tetrahedron-Lagrange-2.html is listed in the links provided.

The default quadrature scheme is shown in:

and you can read the docs describing what rules it uses at:

and the rules for tetrahedra are shown here:

In general, you can use Symfem:GitHub - mscroggs/symfem: A symbolic finite element definition library to get the symbolic representation of a basis function.

python3 -m pip install symfem
order = 1
print(symfem.create_element("tetrahedron", "Lagrange", order).get_basis_functions())

returning:

[-x - y - z + 1, x, y, z]
1 Like

Hello, Can we print the Jacobian data?

from dolfin import *
from ufl import Jacobian
mesh= UnitSquareMesh(1,1)
t = Jacobian(mesh)

How can I excess the Jacobian matrix from t for each element?

You cannot get that in legacy DOLFIN without doing a projection of each component into a tensor space of DG-0 elements.

In DOLFINx this is easily available by using dolfinx.fem.Expression

1 Like