cngf-pf

continuum model for granular flows with pore-pressure dynamics (renamed from 1d_fd_simple_shear)
git clone git://src.adamsgaard.dk/cngf-pf # fast
git clone https://src.adamsgaard.dk/cngf-pf.git # slow
Log | Files | Refs | README | LICENSE Back to index

commit a76164dae745fe589ecd6aa0332bc78a670ae89b
parent 5843a3a1d804e22a751f9bc63a71cf54a88fbcdc
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Wed, 14 Jan 2026 09:38:17 +0100

fix(simulation): prevent singularity in cooperativity length calculation

Add minimum threshold of 1e-10 to prevent division by zero when stress approaches critical state.

Diffstat:
Msimulation.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/simulation.c b/simulation.c @@ -555,7 +555,8 @@ cooperativity_length(const double A, const double mu_s, const double C) { - return A * d / sqrt(fabs((mu - C / p) - mu_s)); + double denom = fmax(fabs((mu - C / p) - mu_s), 1e-10); + return A * d / sqrt(denom); } static void