How to interpolate the derivative of CG functions in DG space


If we have the following functions and function spaces:

V1 = element("Lagrange", "interval", k)
V2 = element("DG", "interval", k-1)

f = Function(V1)
g = Function(V2)

we can clearly see that g should be in the same fucntion space with f.dx(0), so can we obtain g from f in the strong form, i.e., g = f.dx(0), or we can only do that using some weak form like:

g * v = f.dx(0) * v


You can use dolfinx::fem::Expression.
See: Hyperelasticity — DOLFINx 0.3.1 documentation for C++ or Solving a time-dependent problem — FEniCS 22 tutorial for a Python example

1 Like