Since there is no weights, I use create_quadrature trying to get the quadrature weights. These two block of codes are run as follows:
# fristly get the quad points
import ffc
from dolfin import *
mesh = UnitSquareMesh(1, 1)
el = FiniteElement("Quadrature", mesh.ufl_cell(), degree=1, quad_scheme="default")
V = FunctionSpace(mesh, el)
print(V.tabulate_dof_coordinates())
points, weights = ffc.fiatinterface.create_quadrature(mesh.cell_name(), degree=1, scheme="default")
print(points, weights)
Get the result:
Calling FFC just-in-time (JIT) compiler, this may take some time.
[[0.66666667 0.33333333]
[0.33333333 0.66666667]]
[[0.33333333 0.33333333]] [0.5]
With the same mesh cell, they generate different number of quadrature points, let alone match them precisely. How can I get the quadrature points and relevant weights of a physical mesh cell ?
This quadrature is based on the reference element.
The quadrature extracted with:
Gives you the quadrature points in physical space, i.e.
# fristly get the quad points
import ffc
from dolfin import *
mesh = UnitSquareMesh(1, 1)
el = FiniteElement("Quadrature", mesh.ufl_cell(), degree=2, quad_scheme="default")
V = FunctionSpace(mesh, el)
x = V.tabulate_dof_coordinates()
for cell in cells(mesh):
print(V.dofmap().cell_dofs(cell.index()), x[V.dofmap().cell_dofs(cell.index())])
Does it mean that I can multiply the weights form the ref cel accordingly with the quad points above? Do the quad points from the physical cell automatically align with the weights from the ref cell?
The sum of weights should equal to the volume of the physical cell. If I just use the quad weights from the ref cell, it surely won’t get correct integration because the volume of general physical cell != volume of the ref cell.
Now you are mixing quadrature weights and the absolute value of the determinant of the Jacobian of the mapping from the physical element to the reference element.