Skip to content

Commit

Permalink
Fix lagrange variants
Browse files Browse the repository at this point in the history
  • Loading branch information
schnellerhase committed Dec 1, 2024
1 parent 78b130b commit ce1fa58
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions python/demo/demo_lagrange_variants.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

import basix
import basix.ufl
import ufl
from dolfinx import default_real_type, fem, mesh
from ufl import SpatialCoordinate, dx

# -

Expand Down Expand Up @@ -123,7 +123,7 @@ def saw_tooth(x):
# +
msh = mesh.create_unit_interval(MPI.COMM_WORLD, N)

x = ufl.SpatialCoordinate(msh)
x = SpatialCoordinate(msh)
u_exact = saw_tooth(x[0])

for variant in [basix.LagrangeVariant.equispaced, basix.LagrangeVariant.gll_warped]:
Expand Down Expand Up @@ -174,7 +174,7 @@ def saw_tooth(x):
V = fem.functionspace(msh, ufl_element)
uh = fem.Function(V)
uh.interpolate(lambda x: saw_tooth(x[0]))
M = fem.form((u_exact - uh) ** 2 * ufl.dx)
M = fem.form((u_exact - uh) ** 2 * dx)
error = msh.comm.allreduce(fem.assemble_scalar(M), op=MPI.SUM)
print(f"Computed L2 interpolation error ({variant.name}):", error**0.5)
# -
Expand Down

0 comments on commit ce1fa58

Please sign in to comment.