CExA-project / ddc

DDC is a discrete domain computation library.
https://ddc.mdls.fr
Other
33 stars 5 forks source link

Periodicity is not handled in the derivative evaluation of splines #646

Open tpadioleau opened 2 months ago

tpadioleau commented 2 months ago

reported by @Paulinemoi

Paulinemoi commented 2 months ago

In SplineEvaluator, the operator() replaces an outside coordinate inside of the domain if it is defined on a periodic dimension. However the deriv() does not proceed the same. So if we want to get the derivative of a spline at an outside coordinate defined on a periodic dimension, it raises an error.

To replace the outside coordinate, the implementation is done in the private eval() method (https://github.com/CExA-project/ddc/blob/54979b6fe4d46f39468426a60783278789cf8f66/include/ddc/kernels/splines/spline_evaluator.hpp#L404C1-L422C10). In the derivative operators, the eval_no_bc() is directly called.

As we don't give any extrapolation rules for the derivatives, we can assume that we won't evaluate the derivative outside of the domain. But I don't know if the periodic case is supposed to be considered as outside of the domain.

The same question can be raised for SplineEvaluator2D and deriv_dim_1(), deriv_dim_2(), deriv_1_and_2(), deriv() and deriv2().

SplineEvaluator: https://github.com/CExA-project/ddc/blob/main/include/ddc/kernels/splines/spline_evaluator.hpp. SplineEvaluator2D: https://github.com/CExA-project/ddc/blob/main/include/ddc/kernels/splines/spline_evaluator_2d.hpp

tpadioleau commented 2 months ago

thank you for the detailed explanation