AssertionError: Mismatch of quadrature points!

hello everyone
I would like to model the growth phenomenon in the cardiac muscle according to the following equations below. the code I have written is the one where I calculate the growth tensor to form the elastic tensor.
But I have a quadrature error.
Has anyone ever modelled this phenomenon before? Please help.

1 2 3 4 5
where theta is the growth factor, lamda_e the elastic stretch and the lamda_h is the hydrostatic stretch.

here is the code function
def growthfunction (f_0, s_0, n_0, d,v):

t = np.linspace(0,1,4)
dt=0.9
N=len(t)
O_max=2
O_min=0
gam=0.1
lam=0.2
lamda_h=1
I = Identity(d)
F=I+v
O_0=1
iterration=0
err=1
F_g=O_0*I
for j in range(N):

   F_gt=F_g.T
   FF_g=inner(f_0,(F_g.T*F_g)*f_0)
   lamda_g=sqrt(FF_g)
   #lamda_e=(1/lamda_g)*(f_0*(F.T/O_0)*(F/O_0)*f_0)^0.5
   O_1=O_0+dt*((1/gam)*(((O_max-O_0)/(O_max-O_min))**lam)*(lamda_g-lamda_h))
   F_g=O_1*I
   O_0=O_1
   
   print ('\n growth steps ' ,j)

return F_g

It’s not clear what’s going on from the given code, but the “Mismatch of quadrature points!” error usually occurs when a Form's integrand involves a Function in a "Quadrature"-type FunctionSpace, but the Form is integrated with a different quadrature degree than that of the "Quadrature"-type Function. To clarify, here is an annotated snippet of code to illustrate:

from dolfin import *
from ufl.algorithms.compute_form_data \
    import estimate_total_polynomial_degree

# Set up a quadrature function space:
mesh = UnitIntervalMesh(1)
q_deg = 3
print("Degree of quadrature element: "+str(q_deg))
Qe = FiniteElement("Quadrature", mesh.ufl_cell(),
                   degree=q_deg,
                   quad_scheme="default")
Q = FunctionSpace(mesh, Qe)

# Create a simple integrand for demonstration:
q_func = Function(Q)
q_func.interpolate(Expression("1",degree=0))
x = SpatialCoordinate(mesh)
f = x[0]*q_func

# Estimated degree is higher than the degree
# of the quadrature element; without forcing
# quadrature of forms to use a lower degree,
# this will result in an error.
f_deg = estimate_total_polynomial_degree(f)
print("Estimated degree of `f`: "+str(f_deg))

# Would cause "Mismatch of quadrature points",
# since `dx` defaults to using the estimated
# polynomial degree of the integrand:

#int_f = assemble(f*dx)

# Error avoided by manually setting quadrature
# degree for forms to match that of
# quadrature element:
dx = dx(metadata={"quadrature_degree":q_deg})
int_f = assemble(f*dx)

# Sanity check:
print("Result = " + str(int_f))

As shown in the code snippet, the usual way around this is to set the degree of the integration Measure to match the degree of the "Quadrature"-type Function needed in the integrand.

Thank a lot kamensky I will try and give your a feedback. However I would like to know if there is a technic to found integrated degree quadratures manually.

Djoumessi René Thierry
PhD student
university of Dschang
department of physics
heart and complex system modelling.