Assembly timings for hexahedral elements slow

You are setting the quadrature degree in the wrong place (function space), not in the measure.
If you fix this:

def pre_hyperelastic_dolfinx(mesh, **kwargs):
    quadrature_degree = 4
    ord = 1
    elemu = element("P", mesh.basix_cell(), ord, shape=(3,))
    V = functionspace(
        mesh, elemu,
    )
    u = Function(V, name="u")
    v = TestFunction(V)
    du = TrialFunction(V)
    F = Identity(len(u)) + grad(u)
    C = F.T * F
    Ic = tr(C)
    J = det(F)
    dx = Measure("dx", domain=mesh, metadata={
        "quadrature_degree": quadrature_degree})
    mu, lmbda = default_scalar_type(1.0), default_scalar_type(2.0)
    psi = 1 / 2 * (mu * (Ic - 3)) - mu * ln(J) + lmbda / 2 * ln(J) ** 2
    stress = derivative(psi, u, v) * dx
    jacobian = derivative(stress, u, du)
    return jacobian

See results in next post

2 Likes