Skip to content

NSCBC 6/7: boundary registers -- stateful inlet and outlet repairs, opt-in - #1063

Draft
drummerdoc wants to merge 6 commits into
Pele-Suite:developmentfrom
drummerdoc:nscbc-4-registers
Draft

NSCBC 6/7: boundary registers -- stateful inlet and outlet repairs, opt-in#1063
drummerdoc wants to merge 6 commits into
Pele-Suite:developmentfrom
drummerdoc:nscbc-4-registers

Conversation

@drummerdoc

Copy link
Copy Markdown
Collaborator

Stacked on #1062 (part 6/7 of the stack tracked in #1057). The reviewable content of this PR is its LAST commit — the earlier commits are the lower stack levels and will vanish from this diff as they merge and the stack rebases.

The two failure modes statelessness cannot fix, and the smallest state
that fixes them. A value-relaxation inlet cannot inject a signal
faithfully (the wave the domain sends back is indistinguishable from
target error), and an outflow relaxation spends its authority fighting
the acoustics it should transmit. The repair for both is a learned
reference mean: per boundary point, an EMA of the outgoing invariant
and of the pressure (tau = 3 acoustic transits), held in a small flat
replicated device store, updated once per level-0 advance outside every
fill path, and composed into the effective Target by BCfill -- the
kernel stays the pure function the first PR of this stack reviewed.

pelec.bc_nscbc_nri (inlets): the fill adds the learned incoming-wave
velocity to the target; with the hook's Target::dudt feed-forward this
holds Daviller's injection index near 1 at any stiffness and frequency,
including on resonance (driver gate: I_in in [0.85, 1.15] across the
matrix; PeleC duct point 0.970 vs the driver's 1.031, feed-forward
alone 2.4).

pelec.bc_nscbc_ndnr (outlets): the relaxation acts on the EMA-mean
deviation instead of the instantaneous pressure, collapsing sigma = 16
reflection 30.1% -> 3.7% while anchoring the mean TIGHTER (37 ppm vs
71 ppm), because it no longer fights the wave.

Two invariants paid for in measurement, recorded in the design note:
the register invariant is referenced to a slow-EMA impedance (an
instantaneous rho*c aliases the mean p/(rho c) into the invariant at
signal amplitude -- measured identically in both codes), and the store
records the domain it was sized for as its own level test. Registers
ride in checkpoints (restart bit-identity gated); n1-vs-n6
decomposition is bit-identical including register faces split
tangentially across ranks. Both flags default off: every earlier PR's
result is unchanged to the bit.

Docs/NSCBC-boundary-registers-design.md is the design note: why
registers, the architectural invariants, the measured prototype table,
and the implementation record.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XU8M23nucKsu1do2WxXFeq

drummerdoc and others added 6 commits August 28, 2026 10:06
…LODI limit

The base characteristic treatment as a ghost-cell fill: one wave
decomposition in an outward-normal frame, two boundary types.  Outgoing
invariants extrapolate from the interior on a minmod-limited slope; the
incoming acoustic is modelled as a Poinsot-Lele relaxation written as a
gradient increment (a mesh-independent rate, so literature coefficients
transfer), sigma at outflows, relax_u/relax_t at inflows, with a
stateless feed-forward slot (Target::dudt) for problems that inject
signals.  Supersonic faces are exact.  Flow reversal at an outflow runs
the same closure with the material slopes upwinded off across a narrow
Mach band -- one code path on both sides of u_out = 0.

The fill is a pure function of pre-launch interior data: idempotent,
order-independent, bit-reproducible across restarts and decompositions,
GPU-resident (POD captures, counted fallbacks instead of device
aborts).  Every fallback increments a counter and the counters report by
default -- a silent fallback is indistinguishable from a healthy
boundary.  Problems opt in per boundary POINT through a
bcnormal_nscbc() hook returning a Target; a face may mix inflow,
outflow and wall.  EB requires eb_zero_body_state (fatal otherwise, the
fill detects covered cells by non-positive density); an AMR fine face
touching a characteristic boundary warns.

This PR is the 1-D-normal LODI limit on purpose: transverse terms and
the reacting-boundary closures arrive as the next two PRs in this
stack, each an additive, default-off correction to the modelled
incoming wave (some comments here forward-reference them).  Verification
driver and regression cases follow in the stack; headline number from
the case PR: an acoustic pulse leaves through this boundary with 0.8%
reflection against 97% for a hard-pressure fill.

Also removes the dead nscbc_adv/nscbc_diff keys of the deleted Fortran
implementation (aborting, not ignoring, when an inputs file still sets
them) and retires the 1 K default for eb_boundary_T in favour of 300 K.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XU8M23nucKsu1do2WxXFeq
The multi-dimensional correction: -(1 - beta) T_in on the incoming
amplitude, where T_in carries the tangential convective and dilatational
terms in the outward frame (the ghost-cell transplantation of Motheau's
T1/T4 -- one expression for lo and hi faces).  Tangential derivatives
come from the boundary cell's clamped neighbours; at a corner the
stencil collapses one-sided or to nothing, which is the measured
replacement for the AIAA corner-coupling machinery.

The beta blend is exact for a plane wave at incidence theta:
beta_opt = 1 - cos(theta)/(1 + cos(theta)) -- 0.5 head-on, toward 1 at
grazing -- and both measured optima in the COVO/pulse suite land on it.
The response is asymmetric (a wrong beta is worse than an absent one),
so the default stays 1: this PR is bit-inert until a problem opts in,
and every result of the previous PR is unchanged.

The clamp leaves a small measured seam residual where a characteristic
face meets a periodic direction, and that trade is guarded rather than
assumed: nscbc_check_periodic_wrap() measures the ghost-image mismatch
at startup, reports it beside the boundary-row spread (so a vacuous
pass is visible), and aborts above 1e-2 -- an order above the worst
known-good measurement and an order below what a broken stencil
produces.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XU8M23nucKsu1do2WxXFeq
What a flame does to a characteristic boundary, and the closures that
survive it -- all default-off, so the previous two PRs' results are
unchanged to the bit until a problem opts in.

- The reaction source enters the modelled incoming wave with
  +(1 - beta_s) S_p (Sutherland-Kennedy): a flame in the boundary cells
  raises pressure at a rate the relaxation has no model for, and
  without the term the mean sits off target by S_p/K.  The sign is PLUS
  -- the exact steady flame has dR_-/dn = +S_p/(rho c^2), and the
  driver PR carries a convention-free check of exactly that.  S_p is
  the compositional dp/dt at fixed (rho, e): closed form for ideal gas,
  a directional finite difference along the reaction path for SRK.

- extrap_temperature closes the lambda_0 family on temperature instead
  of the entropy invariant.  The diffusion operator forms boundary-face
  fluxes from these ghosts, so the ghost dT/dn IS the heat flux
  leaving; the entropy closure overstates a flame-like face gradient by
  40%.  This is the flag that lets a flame survive the outflow.

- extrap_material continues the material part of R_- into the ghost,
  bounded through the acoustically-blind entropy family (extrapolating
  R_-'s own gradient is positive feedback, measured 16x).  For fronts
  that SIT on the boundary; a transit over-vents with it on.

- backflow_material treats FIRM reversal as a local inflow of the
  Target's reservoir state, ramped over an outward-Mach band
  continuous with the reversal upwinding underneath -- without it a
  face in sustained recirculation feeds the domain its own exhaust.

Also the structure advisory: material structure sitting in outflow
boundary cells is counted, and the counter report prints the measured
flame-on-boundary recipe when it fires.  Measured guidance and the
sitting/transit tables live with the regression cases later in this
stack (NSCBC-FlameOutflow, README).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XU8M23nucKsu1do2WxXFeq
Verification/NSCBC1D is a standalone 1-D compressible solver (needs
only a 1-D AMReX) that compiles Source/NSCBC.H unmodified and runs it
against analytic and constructed references: checks C1-C14, self-gated,
covering uniform-state transparency, pulse reflection vs sigma, inflow
injection, the flame-on-boundary closures (sitting and in transit), the
reaction-source sign (a convention-free check), extrapolation-bias
bounds, profile-fit closures, the unified reversal closure, and
sustained-backflow flushing.  Four builds gate different physics: air,
LiDryer (reacting), two passive scalars, and SRK real gas.  Beyond the
checks: a sigma-reflection sweep, forced-duct modes measuring what a
value-relaxation inlet does to injected signals, and the register/
feed-forward gates for the stateful inlet/outlet repairs arriving later
in this stack (the driver holds its own registers, so those checks are
self-contained here).

Verification/NSCBCFields adds fielddump (flatten one plotfile variable
at full precision) and metrics.py (residual, circularity, sphericity)
for measuring PeleC fields against the driver's predictions.

CI gains an NSCBC-Driver job: builds a 1-D AMReX and runs all four
driver configurations green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XU8M23nucKsu1do2WxXFeq
Six cases, each with inputs, measurement scripts, and a README whose
tables are the record (regression gates in Tests/ compare gold files;
physics numbers live here):

- NSCBC-Acoustic: a pulse into a non-reflecting outflow, the
  end-to-end proof (R = 0.75% vs the hard boundary's 97%, driver
  cross-check to 7%).  Variants: 3-D, corners (wall meets outflow --
  invisible), AMR, EB, and a forced duct reproducing the driver's
  full injection-deterioration table to 1-4%.  Restart and n1-vs-n6
  decomposition are bit-identical.
- NSCBC-COVO: vortex and entropy-spot convection through the boundary,
  the transverse-term measurements behind beta's guidance, plus the
  periodic-seam wrap-gate exerciser.
- NSCBC-PMF: a reacting regression on a premixed-flame profile.
- NSCBC-FlameOutflow (+ -DRM): a flame front sitting on and crossing
  the outflow, H2 and CH4 -- the sitting and transit tables that
  settled the extrap_temperature/beta_s recipe and the "any sigma
  survives a transit" result.
- NSCBC-Chamber: the mini-SydGex -- a vented chamber as domain-wall
  duct and as interior EB box with a lateral plenum, plus a Sydney
  baffle (67% blockage).  The baffle produces the full Sydney
  phenomenology: 6x gap jet, 8.5x overpressure peak, sustained vent
  breathing through the unified reversal closure.  EB variants run
  MOL, surfaces sit off the grid lines.

The nscbc-acoustic-eb regression runs without FPE trapping (the same
treatment as eb-c3): eb_zero_body_state makes covered cells exact
zeros, which upstream's cut-cell stencils touch harmlessly untrapped.
The acoustic README's boundary-register section arrives with the
register PR next in this stack.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XU8M23nucKsu1do2WxXFeq
…pt-in

The two failure modes statelessness cannot fix, and the smallest state
that fixes them.  A value-relaxation inlet cannot inject a signal
faithfully (the wave the domain sends back is indistinguishable from
target error), and an outflow relaxation spends its authority fighting
the acoustics it should transmit.  The repair for both is a learned
reference mean: per boundary point, an EMA of the outgoing invariant
and of the pressure (tau = 3 acoustic transits), held in a small flat
replicated device store, updated once per level-0 advance outside every
fill path, and composed into the effective Target by BCfill -- the
kernel stays the pure function the first PR of this stack reviewed.

pelec.bc_nscbc_nri (inlets): the fill adds the learned incoming-wave
velocity to the target; with the hook's Target::dudt feed-forward this
holds Daviller's injection index near 1 at any stiffness and frequency,
including on resonance (driver gate: I_in in [0.85, 1.15] across the
matrix; PeleC duct point 0.970 vs the driver's 1.031, feed-forward
alone 2.4).

pelec.bc_nscbc_ndnr (outlets): the relaxation acts on the EMA-mean
deviation instead of the instantaneous pressure, collapsing sigma = 16
reflection 30.1% -> 3.7% while anchoring the mean TIGHTER (37 ppm vs
71 ppm), because it no longer fights the wave.

Two invariants paid for in measurement, recorded in the design note:
the register invariant is referenced to a slow-EMA impedance (an
instantaneous rho*c aliases the mean p/(rho c) into the invariant at
signal amplitude -- measured identically in both codes), and the store
records the domain it was sized for as its own level test.  Registers
ride in checkpoints (restart bit-identity gated); n1-vs-n6
decomposition is bit-identical including register faces split
tangentially across ranks.  Both flags default off: every earlier PR's
result is unchanged to the bit.

Docs/NSCBC-boundary-registers-design.md is the design note: why
registers, the architectural invariants, the measured prototype table,
and the implementation record.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XU8M23nucKsu1do2WxXFeq
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