Skip to content

DEVSS adds its artificial viscosity without subtracting it when the model does not re-setup #754

Closed

Description

@lmoresi

What

devss_viscosity adds 2 eta_a (E - D) to the momentum flux, where D is a lagged projection of the strain rate (_devss_flux, solvers.py). The pair is supposed to cancel, leaving the elastic-stress stabilisation without changing the rheology.

D is only refreshed here (SNES_Stokes.solve, ~line 1099):

if not self.constitutive_model._solver_is_setup:
    self._needs_function_rewire = True
    self.DFDt.psi_fn = ...
    self._devss_refresh()

So the refresh happens only on a solve where the constitutive model asks to be set up again. On a steady solve that is the first solve only, when the velocity is still zero, so D = 0 and the term is a straight 2 eta_a E: pure extra viscosity, forever.

Measured

Planar 4:1 contraction, ViscousFlowModel, eta = 1, devss_viscosity = 0.25, four successive solve() calls. The downstream channel is fully developed, so dp/dx has the exact value -3 eta U / H^2 = -3:

PASS 1: downstream dp/dx = -3.75004   ratio 1.2500
PASS 2: downstream dp/dx = -3.75004   ratio 1.2500
PASS 3: downstream dp/dx = -3.75004   ratio 1.2500
PASS 4: downstream dp/dx = -3.75004   ratio 1.2500

Exactly 1 + eta_a/eta. It does not decay with repeated solves, because the branch that refreshes D is not re-entered.

The viscoelastic path is not affected: the same mesh and the same devss_viscosity = 0.25 with an Oldroyd-B model stepping in time gives a fitted far-field gradient of -2.99994 against the analytic -3.00000, because each step re-sets up the model and so refreshes D.

Why it matters

  • A steady Stokes solve with DEVSS on silently runs at eta (1 + eta_a/eta). Stokes is linear in viscosity so the velocity field is unchanged, which is exactly why this hides: only a pressure- or stress-scale diagnostic reveals it. Our Newtonian contraction reference was computed this way and the drag/vortex numbers survived only because they are ratios or viscosity-independent.
  • Anyone using DEVSS to stabilise a nonlinear viscous problem gets a different rheology than they asked for, with no warning.

Suggested fix

Refresh D per solve rather than per setup, or better, inside the nonlinear iteration so the lagged pair converges: the term is meant to vanish at convergence, and a D fixed at its initial value cannot do that. A guard would also help — if devss_viscosity is set on a model with no stress history, say so, since DEVSS has nothing to stabilise there.

Activity

  1. lmoresi commented on Sep 18, 2026

    @lmoresi
    MemberAuthor

    Fixed on feature/stress-transport-ddt (9485e8e7), where DEVSS lives — it does not exist on development, so this could not be a standalone bugfix PR there. It will reach development with the stress-transport feature PR.

    The first fix was incomplete, and the new test caught it. Refreshing D after the plain Stokes solve makes the second call correct but leaves the first wrong, because D starts at zero and a steady problem is solved once. The committed fix lag-iterates inside the call instead: refresh D from the velocity just found, re-solve, repeat until the pair has settled, bounded at four passes. A time-stepping viscoelastic run already gets its catch-up across steps and exits after the check solve.

    Measured on a fully developed channel, eta = 1, eta_a = 0.25, exact gradient −12:

    dp/dx
    before, solves 1–4 −15.00004 each time (ratio 1.2500)
    after −12.00000

    Test. test_devss_cancels_on_a_plain_stokes_solve_too in tests/test_1059_stress_transport.py, pinned against the exact fully developed gradient rather than a comparison, and it solves twice because the defect survived repeated solves. Verified failing before the fix (−15.000000152925557 against −12.0) and passing after. The pre-existing DEVSS test covers only the stress-history path, which is why this hid.

    Full viscoelastic suites pass: 29 tests across test_1059, test_1050 and test_1051.

    One consequence worth recording for anyone reading the benchmark numbers: the Newtonian 4:1 contraction reference computed with DEVSS on was running at eta + eta_a. The Couette correction it produced, 0.4673, looked like a match to the literature 0.4653 but was the true value 0.3738 inflated by exactly 1.25. Coincidental agreement, not agreement.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions