You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A yielding model started from rest divides by zero: strainrate_inv_II_min defaults to 0 while the plastic viscosity is tau_y/(2 edot_II) #776
ViscoPlasticFlowModel / ViscoElasticPlasticFlowModel form the plastic viscosity as
eta_yield = yield_stress / (2 * edot_II)
and strainrate_inv_II_min defaults to 0. So a model with a yield stress, started from
rest, divides by zero on its first residual evaluation — before any iteration:
SNES solve diverged after 0 iterations: DIVERGED_FUNCTION_NANORINF
Starting from rest is not an exotic initial condition. It is what a standard benchmark
prescribes: Duretz, de Borst & Le Pourhiet (2019) state "All initial stress and strain
components are set equal to zero", and every incremental-loading setup begins the same way.
Why the default is the problem
The singularity is unconditional, not problem-dependent: tau_y/(2 edot_II) has no finite
limit as edot_II -> 0 for any non-zero yield stress. So the zero default guarantees a NaN
for a whole class of legitimate models, and the failure gives no hint of its cause — the
reason string names NANORINF, not the rate floor.
The fix is one line in a driver (Parameters.strainrate_inv_II_min = <small>), but the
user has to know it exists, and nothing in the error points there.
Note on what does NOT fix it
A Picard/fixed-point first iteration does not help: the NaN is in the RESIDUAL, not the
Jacobian, and Picard changes only the Jacobian. (Raised separately: solve(picard=0) is
the default, so there is no automatic fixed-point first step either — but that is a
distinct question.)
Suggested fix
Either:
default strainrate_inv_II_min to a small positive value derived from the model's own
scales rather than 0 — it exists precisely to regularise this and defaulting it off
makes the singular case the default; or
raise a clear error when a yield stress is set and the rate floor is zero, naming the
parameter, instead of letting PETSc report NANORINF.
The second is the more conservative change and still removes the silent trap.
Acceptance
A test that builds a yielding model with zero initial conditions and solves: it must either
converge, or fail with a message that names strainrate_inv_II_min.
Confirmed live on development (7c9cbbfd): strainrate_inv_II_min is 0 [1/second] on a fresh ViscoPlasticFlowModel, so the divide-by-zero from rest stands.
#794 touches this line but may not fix it. It changes the guard to
which skips a zero floor rather than applying one — so with the default still 0, edot is unchanged and tau_y / (2 edot_II) from rest is still 0/0. Worth re-probing on that branch rather than assuming either way; we have not built it.
Checked in the untouched-issue triage (15 days, no activity).
Probed on development (262a296): a yielding model started from rest with strainrate_inv_II_min at its default 0 no longer gives DIVERGED_FUNCTION_NANORINF.
ViscoElasticPlasticFlowModel, BDF and ETD, same box, two steps from rest: converged (reason 2), finite, every step.
eta_pl = tau_y/(2 edot_II) is +inf at edot_II = 0, which the Min and both smooth yield families carry to the viscous branch. Labelled fixed-in-development; it closes when the fix is in a release on main.
Activity
lmoresi commentedon Oct 7, 2026
Confirmed live on
development(7c9cbbfd):strainrate_inv_II_minis0 [1/second]on a freshViscoPlasticFlowModel, so the divide-by-zero from rest stands.#794 touches this line but may not fix it. It changes the guard to
which skips a zero floor rather than applying one — so with the default still 0,
edotis unchanged andtau_y / (2 edot_II)from rest is still 0/0. Worth re-probing on that branch rather than assuming either way; we have not built it.Checked in the untouched-issue triage (15 days, no activity).
lmoresi commentedon Oct 18, 2026
Probed on
development(262a296): a yielding model started from rest withstrainrate_inv_II_minat its default 0 no longer givesDIVERGED_FUNCTION_NANORINF.ViscoPlasticFlowModel, yield stress 0.5, sheared box,solve(zero_init_guess=True): converged (reason 2), finite, foryield_mode"min" (1 iteration), "softmin" (9) and "harmonic" (15).ViscoElasticPlasticFlowModel, BDF and ETD, same box, two steps from rest: converged (reason 2), finite, every step.eta_pl = tau_y/(2 edot_II)is+infatedot_II = 0, which the Min and both smooth yield families carry to the viscous branch. Labelled fixed-in-development; it closes when the fix is in a release onmain.Generated by Claude Code