Question about Quadrature elements and their integration into variational forms

Hi,

I’ve been using quadrature elements to implement some plasticity models recently in DolfinX 0.8.0.
I wanted to see if I could get some conceptual help for how they are actually implemented and integrated.

In particular I’m wondering what happens if the number of quadrature points is miss matched between the quadrature element and the dx

For example:

deg_stress = 2
deg_dx = 1
W_scal_e = quadrature_element(domain.basix_cell(), degree=deg_stress)
W_scal = functionspace(domain, W_scal_e)

sig = Function(W_scal,name = "Quad_Function")

Ve = element("Lagrange", domain.basix_cell()) 
V = functionspace(domain, Ve)

v = TrialFunction(V)

dx = ufl.Measure("dx",domain=domain,  metadata={"quadrature_degree": deg_u, "quadrature_scheme": "default"} )




residual_u = ufl.inner(sig,v) * dx 

This is not fully accurate to the complexity I have but gives an idea of what I mean by different degrees.

I would have thought that when dx and the quadrature are different degrees there would have been an error (either hard error or a “Soft” wrong result error) but when I tried different quadrature degrees in my more complex script I didn’t notice a difference in the solution.

I’m wondering if it’s just that I got lucky there (maybe the mesh is fine enough where there is not much difference. Or if it’s something else, and I just don’t fully understand in the implementation.

Hi. Just a regular user here. First, Read before posting: How do I get my question answered? (you need a MWE if ever you want an answer. Following the requests of those who are helping you–for free–is a very good advice–because I say so :stuck_out_tongue: ). Secondly, all sort of things can go wrong. I’ve been there. Good luck.