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

interp.f

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

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

Purpose

INTERP returns the weights of 4-point Lagrange interpolation, and of its first derivative, at a point $x$.

How it fits

Called by EQSCVE and EQSCVG (the SCV equation of state), GETALEX06 and GETOPAL95 (opacity tables; YALO3D is removed since rp_1), and MICRODIFF_MTE and MODEL_TO_EQUAL (regridding for diffusion). No modules, no calls. The version without derivatives is INTRP2; the 3-point one is INTER3.

The header's "VandenBerg opacity tables" is from an older use. The comment calls it "THE INTERPOLATION ROUTINE FOR THE VANDENBERG OPACITY TABLES(CAPPA)" (lines 16–18↗); it now serves the SCV EOS (EQSCVE, EQSCVG), the opacity tables of GETOPAL95 and GETALEX06, and the diffusion grids (MICRODIFF_MTE, MODEL_TO_EQUAL), so the comment could describe a general four-point Lagrange interpolation.

The method

For nodes $a_1,\dots,a_4$,

$$B_i(x) = \prod_{j\ne i}\frac{x-a_j}{a_i-a_j},\qquad C_i(x) = \frac{dB_i}{dx},$$

returned in B and C; then $f(x)\approx\sum_i B_i f(a_i)$ and $f'(x)\approx\sum_i C_i f(a_i)$. Used in a table, the interpolant is piecewise: it is continuous where the four-point stencil shifts from one cell to the next, but its derivative, and so the derivative weights C the equation of state and opacities use, jump there.

Definitions

subroutineINTERP

lines 6–43 · GitHub

4-point Lagrange weights and derivative weights (above).

Called by EQSCVE ×2, EQSCVG ×2, GETALEX06 ×2, GETOPAL95 ×5, MICRODIFF_MTE ×2, MODEL_TO_EQUAL ×2

Change log

The changes since rp_1

Changed since rp_1. Declarations only: IMPLICIT NONE. One caller, YALO3D, is removed with the obsolete opacity options.