Particles: XSPH runs only when a material has viscosity, and walks fluid rows only

ymir_particles_substep gates fluid_viscosity on live_fluid > 0 and a viscous material (one scan of the material lanes a
substep); walk_half takes a required row phase bit and viscosity_pair's walk passes FLUID, so no solid row is walked.
The per-pair c == 0 early-out stays for mixed materials. Addresses finding fluid-cost-5x-target (Soul's probe: skipping
XSPH 4.7 -> 3.7 ms at 512). Shear ratio unchanged 0.7799; M5 and Mv read 1.0000. FluidHashes move with this and are
re-pinned in commit 3.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-11-25 01:33:16 +01:00
commit 3af239e7da
2 changed files with 21 additions and 7 deletions

View file

@ -406,7 +406,7 @@ public sealed class Box3DSoaFluidTests
Assert.True(Math.Abs(after - before) * 1e6 <= ClumpBound, line);
}
// Variance ratio, viscosity 0.1 over 0: shipped 0.7799, M5 (XSPH skipped) 1.0000: bound sqrt(0.7799 x 1.0000) = 0.883, separation 1.28.
// Variance ratio, viscosity 0.1 over 0: shipped 0.7799, M5 (XSPH skipped) and Mv (the viscous-material scan finds none, so the skip flag ignores the materials) 1.0000: bound sqrt(0.7799 x 1.0000) = 0.883, separation 1.28.
private const double ShearBound = 0.883;
[Fact]