See for instance: Implementation — FEniCSx tutorial or Projection and interpolation — FEniCS Tutorial @ Sorbonne