Linear Elasticity Tutorial w/ Quadratic Tetrahedrals


Quick one. Just need some guidance editing the Linear Elasticity Tutorial for Second Order Tetrahedrals.

I have edited the setup as follows:

domain = mesh.create_box(
        [np.array([0, 0, 0]), np.array([L, W, W])],
        [20, 6, 6], 
V = fem.VectorFunctionSpace(domain, ("Lagrange", 2))   

But am encountering this error:

RuntimeError: Degree of output Function must be same as mesh degree. Maybe the Function needs to be interpolated?

Referring to XDMF File export:

  with io.XDMFFile(domain.comm, "deformation.xdmf", "w") as xdmf:
      xdmf.write_mesh(domain) = "Deformation"

Besides this the code is identical to that in the tutorial.

Thank you in advance.

Use instead of xdmffile if you are not using isoparametric elements.

1 Like