Skip to content

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

Open

Description

@lmoresi

What

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.

Activity

  1. lmoresi commented on Oct 7, 2026

    @lmoresi
    MemberAuthor

    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

    if not _parameter_is_zero(inner_self.strainrate_inv_II_min):
        edot = edot + inner_self.strainrate_inv_II_min

    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).

  2. lmoresi commented on Oct 18, 2026

    @lmoresi
    MemberAuthor

    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.

    • ViscoPlasticFlowModel, yield stress 0.5, sheared box, solve(zero_init_guess=True): converged (reason 2), finite, for yield_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 +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.


    Generated by Claude Code

  3. added
    fixed-in-developmentFix merged to development; the issue closes when it is released to main
    on Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixed-in-developmentFix merged to development; the issue closes when it is released to main

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions