Add polynomial-interpolation cut-cell stencils (E2); harden devcontainer build#27
Merged
Merged
Conversation
…ner build
Migrate the project's Mathematica polynomial-interpolation derivation into the
sympy stencil framework, and make the devcontainer's Spack build fail loudly
instead of silently shipping a deps-less image.
Poly-interp migration (scripts/stencil_gen/) -- the novel idea: define
interpolation polynomials f[i+y] = sum_j gamma[i,j](y,psi,params)*f[node_j]
(TEMO-style) so the derivative stencil falls out as (1/h)*d/dy gamma|_{y=0},
giving one consistent free-parameter set (fa feeds interp_wall + nbs_floating;
ia is interp-only; da is the Dirichlet derivative):
- stencil_gen/interp.py (new): derive_interior_interp, derivative_from_interp
(the d/dy|0 core), cut-cell wall rows (2-variant zero+blend+average),
derive_floating_coeffs via interp<->derivative duality, and a DERIVED
Dirichlet closure (poly recipe + one conservation solve); the transcribed
dirichlet_coeffs_symbolic is kept as a cross-check oracle.
- taylor_system.py: _interp_rhs / build_interp_system (eval-at-y functional).
- printer.py, codegen.py: emit real interp_interior / interp_wall / query_interp
(additive, gated on None-default StencilGenSpec fields, so existing stencils
are unchanged). __main__.py: `generate polyE2_1`.
- tools/eval_poly.py: parse a polyE2_1.cpp's runtime methods for numeric checks.
- tests/test_interp.py, tests/test_codegen_poly.py: symbolic golden, duality,
exactness, decoupling, Dirichlet-derived-vs-oracle, and a capstone proving the
regenerated output is numerically equivalent (<=1e-12) to the committed
src/stencils/polyE2_1.cpp across all four runtime methods.
- docs/poly_interp_design.md, _proto_interp.py: design spec + validated demo.
Pure-Python and additive; src/stencils/polyE2_1.cpp is unchanged. Validated:
t-polyE2_1 passes in a real build and the regenerated codegen matches it.
Devcontainer (.devcontainer/Dockerfile): spack install --fail-fast. The default
best-effort install skips failed packages and their dependents yet exits 0,
which let a fetch failure produce a deps-less image that looked built.
--fail-fast aborts on the first failure. Pairs with the SPACK_MIRROR_URL
build-arg for reliable source fetches behind a TLS-intercepting proxy.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrates the project's Mathematica polynomial-interpolation cut-cell derivation into the SymPy stencil framework (
scripts/stencil_gen/), and hardens the devcontainer's Spack build.Poly-interpolation stencils (the new capability)
Define interpolation polynomials
f[i+y] = Σ_j γ_ij(y, ψ, params)·f[node_j](TEMO-style); the derivative stencil then falls out as(1/h)·d/dy γ|_{y=0}. This yields one consistent free-parameter set —fafeeds bothinterp_wallandnbs_floating;iais interpolation-only;dais the Dirichlet derivative.stencil_gen/interp.py(new):derive_interior_interp,derivative_from_interp(thed/dy|0core), cut-cell wall rows (two-variant zero+blend+average),derive_floating_coeffsvia the interp↔derivative duality, and a derived Dirichlet closure (poly recipe + one conservation solve). The transcribeddirichlet_coeffs_symbolicis retained as a cross-check oracle.taylor_system.py:_interp_rhs/build_interp_system(eval-at-yfunctional).printer.py,codegen.py: emit realinterp_interior/interp_wall/query_interp. Additive and gated onNone-defaultStencilGenSpecfields, so existing stencils emit unchanged.__main__.py:generate polyE2_1.tools/eval_poly.py: parse apolyE2_1.cpp's runtime methods for numeric comparison.tests/test_interp.py,tests/test_codegen_poly.py): symbolic golden values, interp↔derivative duality, polynomial exactness, value/derivative decoupling, derived-vs-oracle Dirichlet, and a capstone asserting the regeneratedpolyE2_1.cppis numerically equivalent (≤1e-12, all four runtime methods) to the committedsrc/stencils/polyE2_1.cpp.docs/poly_interp_design.md,_proto_interp.py: design spec + a runnable validation demo.Pure-Python and additive —
src/stencils/polyE2_1.cppis unchanged (the generator + capstone prove the codegen stays compatible). Scope is E2 only for now.Devcontainer
.devcontainer/Dockerfile:spack install --fail-fast. The default best-effort install skips failed packages and their dependents yet exits 0 — which could produce a dependency-less image that still looked successfully built.--fail-fastaborts on the first failure. Pairs with theSPACK_MIRROR_URLbuild-arg for reliable source fetches behind a TLS-intercepting proxy.Validation
t-polyE2_1passes in a real C++ build (verified both in the CI dependency image and a native arm64 devcontainer build).stencil_gentests are unaffected (additive, gated behindNone-default fields).Follow-ups (not in this PR)
src/stencils/polyE2_1.cppfrom the pipeline (numerically equivalent output; left as-is to avoid a noisy CSE diff).