Files
CelerisLab/docs/shifted_blocked_candidate.md

62 lines
3.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Opt-in shifted blocked candidate
This candidate is based on fbe7377. The default remains unshifted. Enable with
`LBMConfig(ddf_shifting=True)` only on the supported routes below.
| Route | Candidate support |
|---|---|
| PeriodicBlockStepper, FP32 D2Q9 SRT double-buffer, no LES | shifted or unshifted |
| FixedPatchStepper, every level blocked and same representation | shifted or unshifted |
| Passive stationary circular BFL boundary and raw exchange | supported candidate scope |
| Synchronized three-level child remap | private raw shifted snapshot, exact overlap/copy |
| Dense root/refinement or mixed representation | rejected for shifted |
| Slot/reservoir, surface actuation, velocity Jet | existing public shifted exclusion retained |
| Other collision/lattice/storage/streaming/LES combinations | existing exclusions retained |
The D2Q9 equilibrium helper accepts a retained density offset only in shifted
compilation. BlockStep computes delta=sum(g) before adding the unit density;
velocity uses the existing macro calculation. The existing SRT collision and
all unshifted expressions remain. No global precision type or duplicate
collision implementation is introduced. Ordinary shifted Simulation callers
still use the existing rho−1 overload; this candidate does not change their
numerical method.
Public initialize receives physical populations and performs shifted subtraction
in FP64 before the one FP32 storage cast. Public shifted download returns FP64
physical populations with exact-rational D2Q9 background weights. Internal raw
snapshots retain FP32 g and a representation tag; runtime remap never decodes
and re-encodes overlap. Exact mass is interpreted as 1+sum(g), and momentum as
sum(c*g); analyses should use raw values for tiny perturbation budgets. The
FP32 BFL force constants have their own arithmetic rounding; no exact global
conservation claim follows from shifting.
Planar helper formulas include their shifted reference-density offsets and have
actual-header host tests. Their public shifted route remains excluded until a
separate test-gated migration. Next velocity-Jet work must validate physical
wall density, incoming/outgoing populations, raw force/mass, ownership and
transfer interactions before relaxing that restriction.
Evidence so far: selected-cell CUDA replay favored retained-delta shifting;
this is not full-solver validation. Host algebra/storage/remap tests and staged
GPU continuation, three-grid cylinder physics, raw budgets, Couette helper
stress and measured runtime are separate gates. Original failed experiments
remain evidence; no acceptance threshold is relaxed.
## Direct-input-momentum equilibrium candidate
The shifted BlockStep now constructs the linear equilibrium term from input
momentum j, without reconstructing rho*u. For opposite axis pairs the odd term
is j/3; for diagonal pairs it is (jx +/- jy)/12, evaluated with explicit
round-to-nearest division. The even term is
w*[delta + 4.5*(c dot j)*(c dot u) - 1.5*(j dot u)].
This is the same second-order D2Q9 equilibrium in exact arithmetic. Original SRT,
storage, boundaries, and transfers are unchanged. No collision residual or force
is corrected afterward. Existing four/five-argument equilibrium APIs are retained;
only shifted blocked collision calls the new six-argument momentum helper.
The all-fluid read-only CUDA replay reduced signed x-momentum error by 120–2285x
at five sampled states, with lower mass/momentum and second-moment RMS errors.
Signed mass bias was larger (~1e-12/cell/hop), so full evolving mass budgets remain
mandatory. This local evidence does not establish physical convergence or speed.
The unshifted default and its arithmetic path remain unchanged.