Cleanup large list of available dg spaces
During the setup of a PDE with some piecewise defined nonlinear coefficients I noticed that calling DGSpace.interpolate() gives me an interpolation function that I didn't expect.
My example to reproduce this would be u_h_dg = spaceLagrangeDG.interpolate(conditional(x[0] > x[1], 1.0, 0.0), name="u_h_dg")
on a [0,1]x[0,1] square (linear lagrange DG space, full example attached). The resulting discrete function u_h_dg
has some entries in the DOF vector that are not in the [0,1] range, which is strange to me because I thought the above conditional could only yield 1 and 0 by definition. If elementwise interpolation is performed I would expect the result I get when I use standard Lagrange polynomials or am I again overlooking some DG property here?
This example illustrates my confusion:
from ufl import SpatialCoordinate
from dune.grid import structuredGrid as leafGridView
from dune.fem.space import dglagrange as dgLagrangeSpace
from dune.fem.space import lagrange as lagrangeSpace
from ufl import conditional
gridView = leafGridView([0, 0],
[1, 1], [2, 2])
dimOrder = 1
spaceLagrangeDG = dgLagrangeSpace(gridView, order=dimOrder)
spaceLagrange = lagrangeSpace(gridView, order=dimOrder)
x = SpatialCoordinate(spaceLagrangeDG)
u_h_dg = spaceLagrangeDG.interpolate(conditional(x[0] > x[1], 1.0, 0.0), name="u_h_dg")
u_h_lagrange = spaceLagrange.interpolate(conditional(x[0] > x[1], 1.0, 0.0), name="u_h_lagrange")
u_h_dg.plot()
u_h_lagrange.plot()
# The following also gives me the result that I would have expected in the first place:
u_h_dg.interpolate(u_h_lagrange)
u_h_dg.plot()
Is this expected behaviour or did I overlook something?