-
-
Notifications
You must be signed in to change notification settings - Fork 230
Closed
Description
In this code snippet, the element e2 should be a copy of e1 but as a custom element, so the error should be 0. But it is around 0.66.
import dolfinx
import basix
import ufl
from mpi4py import MPI
mesh = dolfinx.mesh.create_unit_cube(MPI.COMM_WORLD, 5, 5, 5, dolfinx.mesh.CellType.tetrahedron)
func = lambda x: x
exact = ufl.SpatialCoordinate(mesh)
e1 = basix.create_element(
basix.ElementFamily.N1E, basix.CellType.tetrahedron, 1, basix.LagrangeVariant.equispaced)
e2 = basix.create_custom_element(
e1.cell_type, e1.value_shape, e1.wcoeffs, e1.x, e1.M, 0, e1.map_type, e1.sobolev_space,
e1.discontinuous, e1.highest_complete_degree, e1.degree)
space1 = dolfinx.fem.FunctionSpace(mesh, basix.ufl_wrapper.BasixElement(e1))
space2 = dolfinx.fem.FunctionSpace(mesh, basix.ufl_wrapper.BasixElement(e2))
f1 = dolfinx.fem.Function(space1)
f2 = dolfinx.fem.Function(space2)
f1.interpolate(func)
f2.interpolate(func)
diff = f1 - f2
error = dolfinx.fem.assemble_scalar(dolfinx.fem.form(ufl.inner(diff, diff) * ufl.dx))
print(error)The error is correctly 0 for Lagrange function spaces.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels