Skip to content

Temporal-nesting support: payload time interpolation, collar evaluation, and an R3X fix on the tiled path#20

Merged
mmbell merged 5 commits into
mainfrom
feature/nesting-support
Jul 14, 2026
Merged

Temporal-nesting support: payload time interpolation, collar evaluation, and an R3X fix on the tiled path#20
mmbell merged 5 commits into
mainfrom
feature/nesting-support

Conversation

@mmbell

@mmbell mmbell commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

Support for two-way temporally-nested models per DeMaria et al. (1992, MWR) and Ooyama (2001, JAS), plus a correctness fix the nesting work uncovered on the tiled transform path.

Added

  • `lerp_payload!(dest, p0, p1, θ)` — linear time interpolation of `InterfacePayload`s, bitwise-exact at the endpoints. A subcycling child patch applies the interpolated parent trio at each substep between the parent's bracketing steps.
  • `evaluate_grid_ipoints(grid, xq)` (+ in-place form) — evaluate a grid's spectral representation at arbitrary i-points with the full `physical` derivative-slice layout (1-D spline `R` and `RiRk`). This is the fine→coarse feedback primitive: the coarse patch's collar quadrature points are evaluated on the fine grid and feed the coarse Galerkin loads (DeMaria eq. 2.22) — feedback through the tendencies, not a boundary condition.
  • `test/nesting_support.jl` — collar-interface construction (a parent extended one cell past the junction via the existing `is_stacked` path, making the extracted trio interior and freely fitted), exactness tests, and an anti-freeze regression against dual-R3X BC-based feedback, which is degenerate (a rank-3 spline's border trio ≡ its `ahat`).

Fixed

  • Out-of-place `SAtransform(spline, b)` ignored the R3X `ahat`. Every 3-arg (tiled) `splineTransform!` uses this form for the b→a solve on the patch splines, so a rank-3-coupled patch silently lost its donated border (pinned to zero) on the distributed tile path, while the in-place `SAtransform!` honored it. The rank-3 inhomogeneous path now matches `SAtransform!` exactly, with a regression test.

Validation

  • Full suite passes (35,213 tests), including 92 new nesting-support tests.
  • Downstream (Scythe.jl grid nesting): a 3-patch 1-D advection nest transmits a Gaussian pulse through 2:1 interfaces with peak 0.999 and reflection ~3e-5; the distributed nested driver is bitwise-identical to the in-process reference; a 5-patch two-way nested moist-convection benchmark reproduces the single-grid rainfall to <2% at 2.9x speedup.

mmbell added 5 commits July 13, 2026 21:36
Two-way nesting a la DeMaria et al. (1992) / Ooyama (2001):
- lerp_payload! linearly interpolates interface payloads in time for
  subcycled fine patches (bitwise-exact at the endpoints).
- evaluate_grid_ipoints evaluates a grid's spectral representation at
  arbitrary i-points with the full physical derivative-slice layout
  (1D R and RiRk), providing the fine-mesh values for the coarse
  patch's collar-zone Galerkin loads (the fine-to-coarse feedback).
- Collar interfaces (coarse patch extended one cell past the interface,
  trio extracted at the now-interior interface node) are covered by the
  existing is_stacked path; tests document the construction and add an
  anti-freeze regression against BC-based feedback.
The allocating SAtransform(spline, b) - the form every 3-arg (tiled)
splineTransform! method uses for the b->a solve on patch splines - ignored
spline.ahat, so a rank-3-coupled (R3X) patch lost its donated border trio
on the distributed tile path: the border was silently pinned to zero while
the in-place SAtransform! honored the coupling. Route rank-3 inhomogeneous
splines through the ahat path, matching SAtransform! exactly. Regression
test asserts allocating == in-place for an R3X spline with nonzero ahat.
…ulus offsets

Three pieces toward radially-nested RL (cylindrical) models:

- The 2- and 3-arg RL splineTransform! now reload the coupled per-wavenumber
  border (ahat) from the multi-patch registry before every solve on the
  reused k0/real/imag splines, mirroring gridTransform; previously an
  R3X-coupled RL patch carried the last-applied wavenumber's border on every
  mode along the tiled path. Same fix in _get_ahat_cache_rl.

- evaluate_grid_points(::RL_Grid, pts; kmax): values + dr/drr/dl/dll at
  arbitrary (r, lambda) points (the fine->coarse collar-feedback primitive),
  with per-point wavenumber truncation matching the target ring's support.
  Building it exposed a latent sign bug: the unstructured RL/RLZ evaluators
  synthesized with +aI*sin, but FFTW halfcomplex imag slots hold NEGATIVE
  sine sums - every asymmetric field evaluated as its mirror image. Fixed in
  _eval_unstructured_rl/_rlz; a mish-point test now pins the convention
  against gridTransform! (existing tests passed under either sign).

- Nest annulus patches set patchOffsetL explicitly (global ring numbering)
  while spectralIndexL stays patch-relative; _create_tile_from_patch
  composes the patch's own offset into its tiles (identity for ordinary
  patches, so existing behavior is bit-preserved).

Full suite: 35,230 pass.
@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.59036% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/interpolation.jl 66.66% 3 Missing ⚠️
src/multipatch.jl 99.28% 1 Missing ⚠️
Files with missing lines Coverage Δ
src/CubicBSpline.jl 94.08% <100.00%> (+0.02%) ⬆️
src/Springsteel.jl 67.30% <ø> (ø)
src/tiling.jl 84.44% <100.00%> (+0.48%) ⬆️
src/multipatch.jl 94.64% <99.28%> (+1.00%) ⬆️
src/interpolation.jl 83.58% <66.66%> (-0.18%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mmbell
mmbell merged commit 7785adb into main Jul 14, 2026
25 checks passed
@mmbell
mmbell deleted the feature/nesting-support branch July 14, 2026 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant