This commit is contained in:
Rainer Leit
2026-09-25 17:02:24 +03:00
parent cc43ed8dc8
commit 9597629951
2149 changed files with 460234 additions and 1770 deletions
@@ -152,7 +152,12 @@ func TestDiffuseNonlinearIsStable(t *testing.T) {
field[i] = 100 // flat base level, the mean of the checkerboard
}
}
for i := 0; i < 500; i++ {
// Two thousand steps, not five hundred. The nine-point stencil damps the checkerboard more slowly per
// step than the five-point did - the diagonal faces of a checkerboard are flat, so only the 4/6 of the
// stencil facing the cardinals sees the mode at all - and it is run at a Courant target of 0.3 rather
// than 0.2 because its stability limit is 0.375 rather than 0.25. Both of those are arguments on paper.
// A slow instability takes hundreds of steps to show, and a solve runs a thousand.
for i := 0; i < 2000; i++ {
g.DiffuseNonlinear(field, 0.02, sc, 0.95, 1500, 24)
}
lo, hi := float32(math.Inf(1)), float32(math.Inf(-1))
@@ -170,9 +175,9 @@ func TestDiffuseNonlinearIsStable(t *testing.T) {
}
}
}
t.Logf("after 500 steps the interior spans %.3f..%.3f m, from a 200 m checkerboard", lo, hi)
t.Logf("after 2000 steps the interior spans %.3f..%.3f m, from a 200 m checkerboard", lo, hi)
if hi-lo > 1 {
t.Errorf("the checkerboard is still %.1f m after 500 steps: it is not being damped", hi-lo)
t.Errorf("the checkerboard is still %.1f m after 2000 steps: it is not being damped", hi-lo)
}
}