embedded3 item 10b: virtual merging of small cells in the projection (fraction < 0.1 → master = largest active face neighbour; off-stencil links on the fine Poisson level; merged rhs, anchor, mass residual and source scale); static sphere rows within 0.02 %, loads 9.4/10.4 %; stadium falsifier spikes 39–54× below the binary wall (circle 6–8×), energy per event 6–9× lower
CI / Distributed Training Tests (push) Blocked by required conditions
CI / Python Bindings (maturin) (macos-latest) (push) Blocked by required conditions
CI / Python Bindings (maturin) (ubuntu-latest) (push) Blocked by required conditions
CI / WASM Build + Size Check (push) Blocked by required conditions
CI / Test (macos-latest) (push) Blocked by required conditions
CI / Test (ubuntu-latest) (push) Blocked by required conditions
CI / Build (macos-latest) (push) Waiting to run
CI / CI Success (push) Blocked by required conditions
Performance Benchmarks / Run Benchmarks (push) Failing after 4s
CI / Clippy Check (push) Failing after 3s
CI / Build (ubuntu-latest) (push) Failing after 3s
CI / Format Check (push) Failing after 4s
Documentation / Build User Guide (push) Successful in 6s
Documentation / Build API Documentation (push) Failing after 19s
CI / Build CPU-Only (Explicit) (push) Failing after 1m21s

Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
Omar Sobh
2026-09-17 16:41:29 -05:00
co-authored by Claude Fable 5.1
parent 5b1621e6ad
commit 0fa05f2056
7 changed files with 281 additions and 16 deletions
@@ -25,6 +25,9 @@ use super::wall::{FaceKind, Mask};
pub(super) const INERTIA_FLOOR: f64 = 0.1;
/// The wall-distance floor of a face, in units of the smallest spacing.
pub(super) const DISTANCE_FLOOR: f64 = 0.05;
/// Virtual merging: a cell whose fluid fraction (at either end of the
/// step) stays below this shares its pressure unknown with a neighbour.
pub(super) const MERGE_FRACTION: f64 = 0.1;
/// Lattice addressing of faces and cells with the periodic wrap in z as
/// data: a face of component `c` at `p = [i, j, k]` (its own coordinate is
@@ -175,7 +178,7 @@ impl Mask {
}
}
}
Ok(Self {
let mut mask = Self {
grid: g,
periodic_z: periodic,
cell_fluid,
@@ -190,7 +193,53 @@ impl Mask {
cut: Some(cut),
step_apertures: None,
step_open: None,
})
merge_master: Vec::new(),
};
mask.compute_merging(None);
Ok(mask)
}
/// The virtual merging map: a small cell (fraction < `MERGE_FRACTION`
/// at both ends of the step) takes as master its active face
/// neighbour of largest fraction that is not small itself; a small
/// cell without such a neighbour keeps its own row.
pub(super) fn compute_merging(&mut self, old: Option<&Mask>) {
let Some(cut) = self.cut.as_ref() else {
return;
};
let g = self.grid;
let n = g.cells();
let lat = self.lattice();
let frac = |idx: usize| {
let v = cut.vol[idx];
old.and_then(|o| o.cut.as_ref())
.map_or(v, |oc| v.max(oc.vol[idx]))
};
let small: Vec<bool> = (0..n)
.map(|idx| self.cell_active(idx) && frac(idx) < MERGE_FRACTION)
.collect();
let mut master = vec![usize::MAX; n];
for idx in (0..n).filter(|&i| small[i]) {
let (k, j, i) = g.kji(idx);
let p = [i as i64, j as i64, k as i64];
let mut best: Option<(f64, usize)> = None;
for d in 0..3 {
for side in [-1i64, 1] {
let mut q = p;
q[d] += side;
if let Some(nb) = lat.cell(q) {
let v = cut.vol[nb];
if self.cell_active(nb) && !small[nb] && best.is_none_or(|b| v > b.0) {
best = Some((v, nb));
}
}
}
}
if let Some((_, m)) = best {
master[idx] = m;
}
}
self.merge_master = master;
}
/// Set the step-averaged apertures and the space-time classification
@@ -214,6 +263,7 @@ impl Mask {
.collect();
self.step_open = Some((open(&au), open(&av), open(&aw), active));
self.step_apertures = Some((au, av, aw));
self.compute_merging(Some(old));
}
pub(super) fn lattice(&self) -> Lattice {