Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Why the coupling scheme matters

The first tutorial showed that the active tension depends on the fibre stretch λ\lambda and on the stretch rate λ˙\dot\lambda. In a coupled simulation λ\lambda comes from the mechanics solve, and the mechanics solve needs the tension. Something has to decide, at every time step, which comes first.

The obvious answer is to take turns. Step the contraction model with the stretch of the last step, then solve mechanics with the resulting tension held fixed. This is a segregated (staggered) scheme. It lets each physics keep its own solver, mesh and time step.

It also fails, in a way that is easy to mistake for a solver problem.

Regazzoni & Quarteroni (CMAME 2021) showed that this scheme’s amplification factor tends to −Ka/Kp-K_a/K_p as Δt→0\Delta t \to 0. Here Ka=∂Ta/∂λK_a = \partial T_a / \partial\lambda is the active stiffness of the tissue and KpK_p the passive one. Once Ka>KpK_a > K_p, which is routine in contracting myocardium, the factor is below -1. The scheme is then not merely inaccurate but not convergent, and refining the time step makes it worse.

This tutorial reproduces their Test Case 1 in 0D, so it runs in seconds and needs no mesh. It compares three ways of coupling the same contraction model to the same tissue:

  • monolithic: contraction and mechanics solved together. This is the reference.

  • segregated: the naive staggered scheme.

  • stabilized: segregated, plus one consistent extra term.

The fix is small. Instead of treating the active tension as a dead load during the mechanics solve, treat it as what it physically is, crossbridges behaving as springs:

Pa=[Ta+Ka (λ−λn)]Ff0⊗f0∣Ff0∣.P_{a} = \left[T_a + K_a\,(\lambda - \lambda_{n})\right] \frac{\mathbf{F} f_0 \otimes f_0}{|\mathbf{F} f_0|}.

Here λn\lambda_n is the stretch of the last step, F\mathbf{F} the deformation gradient and f0f_0 the fibre direction. The added term is O(Δt)\mathcal{O}(\Delta t) and vanishes in the limit, so it does not change the problem being solved. It only makes the scheme stable.

Setting up

The tissue is R&Q’s 0D model, a single fibre whose strain e=λ−1e = \lambda - 1 balances

Me¨+σe˙+∂W∂e(e)+Ta=p(t),M\ddot e + \sigma \dot e + \frac{\partial W}{\partial e}(e) + T_a = p(t),

in the quasistatic regime they analyse (M=σ=0M = \sigma = 0). The contraction model is Land’s (2017), as in tutorial 1, here from the crossbridge package.

The passive stiffness Kp is the knob that decides everything. With a stiff tissue the naive scheme is fine, and with a soft one it is not. We run both.

simcardemsx.zero_d works in seconds and pascals, following the paper. The rest of simcardemsx uses milliseconds.

The drive is R&Q’s Eq. (57), an idealised calcium transient peaking at 1.6 µM.

<Figure size 600x240 with 1 Axes>

The stable case

With a stiff tissue, all three schemes agree. Nothing here suggests a problem, which is the trap.

monolithic   peak Ka/Kp =  0.17   error = 0.00e+00
segregated   peak Ka/Kp =  0.17   error = 3.64e-06
stabilized   peak Ka/Kp =  0.17   error = 3.76e-06

The unstable case

Soften the tissue so that the active stiffness overtakes the passive stiffness during the twitch, and the naive scheme comes apart.

monolithic   peak Ka/Kp =  5.73   oscillation = 0.008
segregated   peak Ka/Kp =  5.32   oscillation = 0.263
stabilized   peak Ka/Kp =  5.88   oscillation = 0.008
<Figure size 1100x600 with 4 Axes>

The right-hand column is the point. The naive scheme oscillates from one step to the next, while the stabilized one tracks the monolithic reference closely enough to be hard to tell apart from it.

Refinement does not save the naive scheme

This is what makes the instability worth understanding rather than just avoiding. A scheme that is merely inaccurate gets better as the time step is refined. This one does not.

      dt |  naive osc  naive err |  stab osc   stab err
   4e-03 |      0.313   2.59e-01 |     0.030   3.16e-03
   2e-03 |      0.276   3.51e-01 |     0.015   1.62e-03
   1e-03 |      0.263   3.53e-01 |     0.008   8.18e-04
/dolfinx-env/lib/python3.12/site-packages/simcardemsx/zero_d.py:69: RuntimeWarning: invalid value encountered in log1p
  return 0.5 * self.Kp * (np.log1p(e) + e / (1.0 + e))
   5e-04 |      0.661        nan |     0.004   4.11e-04
<Figure size 550x400 with 1 Axes>

The stabilized scheme converges at first order, as its consistency argument says it should. The naive one does not converge, and its error grows as the step shrinks: there is no time step small enough to fix it. At the smallest step the naive run breaks down altogether. Its strain passes -1, where the tissue’s energy is undefined (the RuntimeWarning above), so its error prints as nan and is missing from the plot.

What this means in practice

Any contraction model that responds to shortening velocity will do this when coupled naively to a soft enough tissue, and that is most of them, since the response is what produces the force-velocity relationship. The symptom is a solution that oscillates at the time-step frequency, which is easy to misread as a Newton tolerance problem or a mesh problem.

simcardemsx offers two ways out, and both are used in the next tutorial.

  • Monolithic: GeneratedActivation(..., scheme="monolithic"), the default, steps the contraction model inside the mechanics Newton iteration. The model is generated as UFL from the .ode file, so Newton differentiates through it. This needs no extra term, but it needs a model that can be written in UFL.

  • Stabilized: GeneratedActivation(..., scheme="stabilized"), or CrossbridgeSegregated for the NumPy models of the crossbridge package, which cannot be stepped inside Newton. Its stabilization is on by default:

    from simcardemsx.backends import CrossbridgeSegregated
    
    backend = CrossbridgeSegregated(f0, mesh, "Land2017", quadrature_degree=4)

scheme="segregated" and stabilized=False exist only to reproduce the failure shown above.