The numerical validation suite backing FORTVSH's accuracy claims (see the "Numerical Validation" appendix of the accompanying manuscript). Three families of checks:
TEST2_* counterparts): the same closed-form quantity
computed three independent ways -- a hand-derived analytic formula,
a direct DOT product of VSH values, and the
GWI/GWJ-coefficient expansion -- must agree to machine
precision.BATCH_*_CONS): every _ALL batch routine
must agree pointwise with its single-mode counterpart, looped over
the same range.Every _CONS/_ORTHO/_INVERSION routine returns a STATUS (0 =
pass, 1 = fail against its stated tolerance) and writes its full
per-point data to OUTUNIT, driven from src/main.f90 -- the same
data that feeds the manuscript's convergence figures via
py/compute_validation.py.
Hand-derived closed form for Test 1's target quantity (a specific product of VSH inner products), evaluated over a colatitude grid at for comparison against TEST1_VSH and TEST1_GW.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | NTH |
Number of colatitude samples over . |
Test 1's target quantity computed via the GWI-coefficient expansion in scalar spherical harmonics, rather than direct VSH DOT products -- must agree with TEST1_ANALYTIC and TEST1_VSH to machine precision. This is the check that specifically exercises GWI (see also TEST2_GW for the GWJ counterpart).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | NTH |
Number of colatitude samples over . |
Test 1's target quantity computed directly from DOT products of VSH_TOR/VSH_POL_DN/VSH_POL_UP values -- must agree with TEST1_ANALYTIC to machine precision.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | NTH |
Number of colatitude samples over . |
Hand-derived closed form for Test 2's target quantity (a different product of VSH inner products than Test 1, with nonzero content), evaluated over a colatitude grid at a fixed for comparison against TEST2_VSH and TEST2_GW.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | NTH |
Number of colatitude samples over . |
Test 2's target quantity computed via the GWJ-coefficient expansion (combined with a GWI term) in scalar spherical harmonics -- must agree with TEST2_ANALYTIC and TEST2_VSH to machine precision. This is the check that specifically exercises GWJ.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | NTH |
Number of colatitude samples over . |
Test 2's target quantity computed directly from DOT products of PVSH_POL/PVSH_TOR/PVSH_RAD values -- must agree with TEST2_ANALYTIC to machine precision.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | NTH |
Number of colatitude samples over . |
Batch-consistency check: ASSOC_LEGENDRE_ALL vs. looped
ASSOC_LEGENDRE calls, for , swept over NX points . Writes every
(l,m,x) triple's batch value, single-mode value, and absolute
difference to OUTUNIT; fails (STATUS=1) if any relative error
exceeds .
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | LMAX |
Maximum degree tested, . |
||
| integer(kind=i4), | intent(in) | :: | NX |
Number of points swept over . |
||
| integer(kind=i4), | intent(in) | :: | OUTUNIT |
Fortran unit number to write results to (columns: `L M |
||
| integer(kind=i4), | intent(out) | :: | STATUS |
Output: 0 = pass, 1 = fail (some relative error |
Batch-consistency check: DDX_ASSOC_LEGENDRE_ALL vs. looped
DDX_ASSOC_LEGENDRE calls, for , swept over NX points . Same
tolerance/output convention as BATCH_ALM_CONS.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | LMAX |
Maximum degree tested, . |
||
| integer(kind=i4), | intent(in) | :: | NX |
Number of points swept over . |
||
| integer(kind=i4), | intent(in) | :: | OUTUNIT |
Fortran unit number to write results to (columns: `L M |
||
| integer(kind=i4), | intent(out) | :: | STATUS |
Output: 0 = pass, 1 = fail (some relative error |
Batch-consistency check: GRAD_SSH_ALL vs. looped GRAD_SSH
calls, for , swept over
NTH colatitude points at fixed . Fails (STATUS=1)
if any component's absolute difference exceeds .
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | LMAX |
Maximum degree tested, . |
||
| integer(kind=i4), | intent(in) | :: | NTH |
Number of colatitude points swept over . |
||
| integer(kind=i4), | intent(in) | :: | OUTUNIT |
Fortran unit number to write results to (columns: `L M |
||
| integer(kind=i4), | intent(out) | :: | STATUS |
Output: 0 = pass, 1 = fail (some component difference |
Batch-consistency check: L_SSH_ALL vs. looped L_SSH calls, for
, swept over NTH
colatitude points at fixed . Fails (STATUS=1) if any
component's absolute difference exceeds .
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | LMAX |
Maximum degree tested, . |
||
| integer(kind=i4), | intent(in) | :: | NTH |
Number of colatitude points swept over . |
||
| integer(kind=i4), | intent(in) | :: | OUTUNIT |
Fortran unit number to write results to (columns: `L M |
||
| integer(kind=i4), | intent(out) | :: | STATUS |
Output: 0 = pass, 1 = fail (some component difference |
Batch-consistency check: PVSH_POL_ALL vs. looped PVSH_POL
calls, for , swept over
NTH colatitude points at fixed . Fails (STATUS=1)
if any component's absolute difference exceeds .
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | LMAX |
Maximum degree tested, . |
||
| integer(kind=i4), | intent(in) | :: | NTH |
Number of colatitude points swept over . |
||
| integer(kind=i4), | intent(in) | :: | OUTUNIT |
Fortran unit number to write results to (columns: `L M |
||
| integer(kind=i4), | intent(out) | :: | STATUS |
Output: 0 = pass, 1 = fail (some component difference |
Batch-consistency check: PVSH_RAD_ALL vs. looped PVSH_RAD
calls, for , swept over
NTH colatitude points at fixed . Fails (STATUS=1)
if any component's absolute difference exceeds .
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | LMAX |
Maximum degree tested, . |
||
| integer(kind=i4), | intent(in) | :: | NTH |
Number of colatitude points swept over . |
||
| integer(kind=i4), | intent(in) | :: | OUTUNIT |
Fortran unit number to write results to (columns: `L M |
||
| integer(kind=i4), | intent(out) | :: | STATUS |
Output: 0 = pass, 1 = fail (some component difference |
Batch-consistency check: PVSH_TOR_ALL vs. looped PVSH_TOR
calls, for , swept over
NTH colatitude points at fixed (both routines agree
at too -- PVSH_TOR explicitly branches to return zero
there rather than evaluating a 0/0 form). Fails (STATUS=1) if any
component's absolute difference exceeds .
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | LMAX |
Maximum degree tested, . |
||
| integer(kind=i4), | intent(in) | :: | NTH |
Number of colatitude points swept over . |
||
| integer(kind=i4), | intent(in) | :: | OUTUNIT |
Fortran unit number to write results to (columns: `L M |
||
| integer(kind=i4), | intent(out) | :: | STATUS |
Output: 0 = pass, 1 = fail (some component difference |
Batch-consistency check: SSH_ALL vs. looped SSH calls, for
, swept over NTH
colatitude points at fixed . Fails (STATUS=1) if any
exceeds .
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | LMAX |
Maximum degree tested, . |
||
| integer(kind=i4), | intent(in) | :: | NTH |
Number of colatitude points swept over . |
||
| integer(kind=i4), | intent(in) | :: | OUTUNIT |
Fortran unit number to write results to (columns: `L M |
||
| integer(kind=i4), | intent(out) | :: | STATUS |
Output: 0 = pass, 1 = fail (some |
Batch-consistency check: VSH_POL_DN_ALL vs. looped VSH_POL_DN
calls, for , swept over
NTH colatitude points at fixed . Fails (STATUS=1)
if any component's absolute difference exceeds .
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | LMAX |
Maximum degree tested, . |
||
| integer(kind=i4), | intent(in) | :: | NTH |
Number of colatitude points swept over . |
||
| integer(kind=i4), | intent(in) | :: | OUTUNIT |
Fortran unit number to write results to (columns: `L M |
||
| integer(kind=i4), | intent(out) | :: | STATUS |
Output: 0 = pass, 1 = fail (some component difference |
Batch-consistency check: VSH_POL_UP_ALL vs. looped VSH_POL_UP
calls, for , swept over
NTH colatitude points at fixed . Fails (STATUS=1)
if any component's absolute difference exceeds .
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | LMAX |
Maximum degree tested, . |
||
| integer(kind=i4), | intent(in) | :: | NTH |
Number of colatitude points swept over . |
||
| integer(kind=i4), | intent(in) | :: | OUTUNIT |
Fortran unit number to write results to (columns: `L M |
||
| integer(kind=i4), | intent(out) | :: | STATUS |
Output: 0 = pass, 1 = fail (some component difference |
Batch-consistency check: VSH_TOR_ALL vs. looped VSH_TOR calls,
for (starts at
; VSH_TOR is identical to PVSH_TOR, already
covered at by BATCH_PVSH_TOR_CONS), swept over NTH
colatitude points at fixed . Fails (STATUS=1) if any
component's absolute difference exceeds .
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | LMAX |
Maximum degree tested, . |
||
| integer(kind=i4), | intent(in) | :: | NTH |
Number of colatitude points swept over . |
||
| integer(kind=i4), | intent(in) | :: | OUTUNIT |
Fortran unit number to write results to (columns: `L M |
||
| integer(kind=i4), | intent(out) | :: | STATUS |
Output: 0 = pass, 1 = fail (some component difference |
Verifies pointwise orthogonality of the poloidal and toroidal polar VSH members, for every -- an exact analytic identity (poloidal is a pure gradient, toroidal a pure gradient, and always), so any nonzero DOT value here is purely numerical error.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | LMAX |
Maximum degree tested, . |
||
| integer(kind=i4), | intent(in) | :: | NTH |
Number of colatitude points swept over . |
||
| integer(kind=i4), | intent(in) | :: | OUTUNIT |
Fortran unit number to write results to (columns: `L M |
||
| integer(kind=i4), | intent(out) | :: | STATUS |
Output: 0 = pass, 1 = fail (some ( |{\rm DOT}|>10^{-12} |
Verifies scalar spherical harmonic orthonormality,
, for every . The
integral is done analytically ( for matching
, by construction 0 otherwise, so only same- pairs are
checked); the integral (in ) uses a
plain NQUAD-point midpoint rule via ASSOC_LEGENDRE_ALL, not
SHGLQ -- sufficient here since only a scalar pass/fail diagonal
check is needed, not a high-order transform.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | LMAX |
Maximum degree tested, . |
||
| integer(kind=i4), | intent(in) | :: | NQUAD |
Number of midpoint-rule quadrature points over |
||
| integer(kind=i4), | intent(in) | :: | OUTUNIT |
Fortran unit number to write results to (columns: `L1 M |
||
| integer(kind=i4), | intent(out) | :: | STATUS |
Output: 0 = pass, 1 = fail (any diagonal off from 1, or |
Verifies the orthogonal-rotation identity linking the standard and polar VSH bases can be inverted exactly: i.e. rotating VSH_POL_UP/VSH_POL_DN back by the same angle used to build them from PVSH_POL/PVSH_RAD recovers the originals exactly.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | LMAX |
Maximum degree tested, . |
||
| integer(kind=i4), | intent(in) | :: | NTH |
Number of colatitude points swept over . |
||
| integer(kind=i4), | intent(in) | :: | OUTUNIT |
Fortran unit number to write results to (columns: `L M |
||
| integer(kind=i4), | intent(out) | :: | STATUS |
Output: 0 = pass, 1 = fail (either max difference |