Hello,
I would like to get the total number of integration points of the full domain or, at least, for a cell. I saw that I can use the basix or create a mesh based on “Quadrature” space.
It seems that V.tabulate_dof_coordinates()
corresponds to nodal dof. I wonder if there is a way to extract the total number of gauss points directly from the “CG” domain I create.
import ufl
from dolfinx import log, io, mesh, fem, cpp, plot
from mpi4py import MPI
#Geometry & mesh
comm = MPI.COMM_WORLD
msh = mesh.create_rectangle(comm, [[0.,0.],[1.,1.]], [2,2], mesh.CellType.quadrilateral)
FE_vector = ufl.VectorElement("CG",msh.ufl_cell(),1)
V_u = fem.FunctionSpace(msh,FE_vector)
FE_scalar = ufl.FiniteElement("CG",msh.ufl_cell(), 1)
V_alpha = fem.FunctionSpace(msh,FE_scalar)
len(V_alpha.tabulate_dof_coordinates()) #=9
Thank you for the help !
Best regards,
Lamia
dokken
August 3, 2022, 8:33am
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:
Note that the demo you are considering is quite outdated, and your should consider the latest version
To estimate the polynomial degree, you can use:
from ufl.algorithms.compute_form_data \
import estimate_total_polynomial_degree
estimate_total_polynomial_degree(form)
This is in turn sent to 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
You can also by-pass the basix/ufl workflow by supplying your own quadrature rule:
points = [[0.0, 0.0], [1.0, 0.0], [0.0, 1.0], [0.5, 0.5], [0.0, 0.5], [0.5, 0.0]]
weights = [1 / 12] * 6
a = u * v * ufl.dx(metadata={"quadrature_rule": "custom",
"quadrature_points": points, "quadrature_weights": weights})
1 Like
Thank you very much for the detailed answer ! I managed to get it !