PyREC scaffolding (from YREC development, 7be4133)/ cspline.fGlossary

cspline.f

55 lines · 1 definitions · on GitHub (7be4133)

Python version: cspline.py, 55 lines, on the right (switch to Python above the code).

Variables on this page (1)

json

Purpose

The second derivatives of a cubic spline through tabulated points, from Numerical Recipes (SPLINE), in double precision "for opacities."

How it fits

  • Inputs: X(N) (increasing), Y(N), and the end slopes YP1, YPN; a slope of $10^{30}$ or more asks for a natural spline (zero second derivative) at that end.
  • Who calls it: the opacity routines GTPURZ and ZSULAOL; at rp_1 also GTLAOL, GTLAOL2 and SULAOL (removed since rp_1).
  • Output: Y2(N), the second derivatives, for a spline evaluation routine.
  • Limits: the work array U has the fixed size JSON (5000, from DIMENSIONS_MOD; line 27↗), and N is not checked against it; the callers pass at most 104 points (the pure-Z table's densities and temperatures, ZLAOL_MOD).

The method

Continuity of the first derivative at interior points gives the tridiagonal system $$\frac{h_{i-1}}{6}y''_{i-1} + \frac{h_{i-1} + h_i}{3}y''_i + \frac{h_i}{6}y''_{i+1} = \frac{y_{i+1} - y_i}{h_i} - \frac{y_i - y_{i-1}}{h_{i-1}},$$ with $h_i = x_{i+1} - x_i$, solved by forward elimination and back substitution.

Definitions

subroutineCSPLINE

lines 16–55 · GitHub

Numerical Recipes' cubic-spline setup: returns the second derivatives Y2, natural or with given end slopes.

Uses modules DIMENSIONS_MOD

Called by GTPURZ, ZSULAOL

Change log

The changes since rp_1

Changed since rp_1. Declarations only: JSON from DIMENSIONS_MOD, IMPLICIT NONE; three of its callers removed with their files.