Repository navigation
PPM option limiter = "hord12": FV3's hord = 12 tracer reconstruction - #183
Conversation
… (GCHP hord_tr default)
cfranken
left a comment
There was a problem hiding this comment.
Thanks, this is a clean addition and fits the design: the limiter is a type selected by dispatch, it builds on the public limiter functions from #179, the stencil and halo stay the same, and the inversion driver refuses it explicitly.
Checked
- The Huynh constraint matches the pinned GCHP
tp_core.F90(xppm): both clamps, the ¾ factor, the curvature test and the 1e-25 flattening (Float32-safe). Derived independently, not from the comments. - Every PPM face flux (x, y, z; cubed-sphere seams, packed tracers,
same_as_horizontalvertical) passes the neighbour tuple in the right order; no path falls back to the 4-argument form for hord12. test_ppm_hord12_limiter.jl(143/143) andtest_advection_kernels.jlpass on CPU. The Float32 kernel code compiles branch-free with no allocation. Not run: GPU.
Must fix: the positivity claim. The docstring and advection_schemes.md say the constraint keeps a non-negative tracer non-negative in 1-D uniform flow up to Courant 1. Counterexample: periodic row, unit air masses, means [0, 1, 1/8, 0, 1, 0], mass flux 0.5 to the right. After one sweep the fourth cell is −7/96 (the third cell exports −1/96, the fourth 1/16), in Float32 and Float64, reproduced with an independent implementation of the formula. This is FV3's own behaviour: in the GCHP fork only hord 9 and 13 add the positivity filter. It matters for zero-background tracers (Rn-222, pulses, flux anomalies), not for CO₂ on a 400 ppm background.
Design: no silent AbstractLimiter fallbacks (your question 3).
- They can break limiters defined elsewhere: an external
limited_slope(::Float32, ::Float32, ::Float32, limiter)method that resolved before is now ambiguous. - They hide mistakes: a missing method silently becomes van Leer/CW84 (
limited_slope(…, CW84Limiter())now returns a value instead of an error). We prefer explicit errors for unsupported combinations. - Suggested instead: keep explicit methods, give the new limiter its own one-line
limited_moment, and make the 4-argumentppm_limit_profilefor it throw instead of using CW84.
Smaller points
- Name (question 1): since "hord 12" means different schemes in different FV3 lines, name the type after the method (
FV3HuynhLimiter) and keeplimiter = "hord12"as the config value GCHP users know. - Question 2: no need to force
fv3_kord8; document that GCHP pairs hord 12 with kord 8. - Optional, later: the closed union of limiters that use van Leer edges and the swept-parabola flux could become a trait, so a limiter defined outside the package can opt in.
- Before merging: a short GPU run with the new limiter and a GPU speed check of the built-in PPM (it now passes four extra neighbour values).
I'll push these changes onto this branch (maintainer edits are on) and merge once CI and the GPU checks pass.
…sitivity docs
- Rename Hord12Limiter -> FV3HuynhLimiter ("hord 12" names different schemes in
different FV3 lines); the config value stays limiter = "hord12".
- Remove the AbstractLimiter fallbacks of limited_slope, limited_moment and the
three-value ppm_limit_profile: a missing method stays a MethodError instead of
silently becoming the monotone rule, and external scalar-typed methods no
longer become ambiguous. FV3HuynhLimiter gets its own limited_moment (no
clamp); its three-value ppm_limit_profile throws, since the constraint needs
the neighbours. The five-argument form still forwards to a limiter's
three-value method.
- Docs and CHANGELOG: the FV3 Huynh constraint is neither monotone nor
positive-definite (cell means [0, 1, 1/8, 0, 1, 0], Courant 0.5: a zero cell
becomes -7/96; GCHP adds a filter only for hord 9 and 13). New regression test.
Checks: touched test files pass on CPU; advection kernel tests pass on the L40S
(CPU-GPU agreement incl. the new limiter); structure check passes, code map
regenerated; C90 L72 4-tracer GPU benchmark: built-in PPM and upwind unchanged
(0.0494-0.0495 s and 0.0451-0.0452 s per window on main and this branch).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qfkez3tXkdGpzp8H8U6PPz
|
Thanks, you're right about positivity: by hand from the test's Since the C90 pulses start from zero, I checked the table above. Over all 113 days, hord12's negative mass is at most 9e-5 of the strat pulse and 2.7e-4 of the UT pulse, no more than the default PPM and a tenth of ORD 7. Zeroing negatives moves no table entry by more than 1e-5, so the numbers stand. I agree with the rest: the |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #183 +/- ##
=======================================
Coverage 88.66% 88.66%
=======================================
Files 342 342
Lines 37185 37210 +25
=======================================
+ Hits 32970 32993 +23
- Misses 4215 4217 +2
🚀 New features to boost your workflow:
|
Adds
[advection] scheme = "ppm", limiter = "hord12"(PPMScheme(Hord12Limiter())): the horizontal tracer PPM of FV3'sxppm/yppmwithhord = 12, GCHP'shord_trdefault. It keeps the CW84 edges and swept-parabola flux and replaces the profile limiter by Lin's form of Huynh's second constraint (GCHP forktp_core.F90:556-575, commit643f3c44). Withvertical = "fv3_kord8"it is GCHP'shord_tr = 12/kord_tr = 8pair in split sweeps. Lat-lon and cubed sphere, CPU and GPU, same stencil and halo; forward only (the inversion driver rejects it).Two interface changes on top of #179:
limited_slope,limited_momentandppm_limit_profilefall back toMonotoneLimiterbehaviour onAbstractLimiter(a missing method was aMethodErrorinside the kernel), andppm_limit_profilegets a five-argument form with the donor's neighbours. Built-in limiters are bitwise unchanged.Why. It moves AT's cross-tropopause exchange to where Lin–Rood ORD 7 puts it, the scheme the CATRINE protocol notes as closest to GCHP above 100 hPa. C90 L72 MERRA-2, Dec 2021–Mar 2022, pulses at 0.07 ps (strat) and 0.2 ps (UT), fraction above 100 hPa minus ORD 7:
At 30–60°N hord12 drifts back toward the default by March. In a C24 age-of-air test the default PPM is 15 d older than hord12 above 100 hPa after two years.
Caveat. "hord 12" depends on the FV3 line: in NOAA-GFDL
mainand GEOS-ESM this branch isiord == 10, and 12 is the LR96 positive-definite scheme.Hord12Limiterfollows the GCHP fork; the docstring says so.Tests. New
test/core/test_ppm_hord12_limiter.jl(hand-computed FV3 profiles, a loop transcription ofxppmto 1e-14, positivity, conservation, convergence); hord12 added to the advection-kernel and cubed-sphere loops. Orion CPU, on85e91b1d: the 9 touched test files pass (hord12 limiter 143/143); main vs branch digests for every built-in scheme (LL 6 + CS 3, Float32/Float64): byte-identical, 18/18 lines;check_structure.jlpasses with the code map regenerated. Not run: GPU, full suite.Questions. (1) Keep the name, or
FV3HuynhLimiterwith a"hord12"alias? (2) Shouldhord12withvertical = "same_as_horizontal"requirefv3_kord8on the cubed sphere? (3) Are the silent monotone fallbacks wanted?🤖 Generated with Claude Code