.Buildings.Utilities.Math.Functions.splineDerivatives

Information

This function computes the derivatives at the support points xi that can be used as input for evaluating a cubic hermite spline.

If ensureMonotonicity=true, then the support points yi need to be monotone increasing (or decreasing), and the computed derivatives di are such that the cubic hermite is monotone increasing (or decreasing). The algorithm to ensure monotonicity is based on the method described in Fritsch and Carlson (1980) for ρ = ρ2.

This function is typically used with Buildings.Utilities.Math.Functions.interpolate which is used to evaluate the cubic spline. Because in many applications, the shape of the spline depends on parameters which will no longer change once the initialisation is complete, this function computes and returns the derivatives so that they can be stored by the calling model to avoid repetitive computations.

References

F.N. Fritsch and R.E. Carlson, Monotone piecewise cubic interpolation. SIAM J. Numer. Anal., 17 (1980), pp. 238-246.

Interface

function splineDerivatives
  extends Modelica.Icons.Function;
  input Real x[:] "Support point, strictly increasing";
  input Real y[size(x, 1)] "Function values at x";
  input Boolean ensureMonotonicity = isMonotonic(y, strict = false) "Set to true to ensure monotonicity of the cubic hermite";
  output Real d[size(x, 1)] "Derivative at the support points";
end splineDerivatives;

Revisions


Generated at 2024-04-28T18:16:21Z by OpenModelicaOpenModelica 1.22.3 using GenerateDoc.mos