Tutorials › Physiologically-Based Pharmacokinetics (PBPK) › Explicit and Implicit Solvers for PBPK Systems

Numerical Implementation and Stiff Solvers · Tutorial 680 of 799

Explicit and Implicit Solvers for PBPK Systems

Use stability regions to understand why explicit and implicit solvers behave differently when a PBPK model contains both fast and slow processes.

Intermediate 11 min read

What You'll Learn

  • Define absolute stability for a numerical method applied to a decaying linear mode.
  • Derive the explicit Euler step-size restriction and the implicit Euler stability condition.
  • Interpret the negative-real-axis stability interval of classical fourth-order Runge–Kutta.
  • Explain how BDF methods handle decaying modes and why their stability properties depend on order.
  • Compare explicit and implicit solver behavior using a hypothetical PBPK system with fast and slow modes.
  • Distinguish numerical stability from accuracy and identify practical signs of solver difficulty.

Why Stability Matters in a PBPK Integration

A PBPK model is represented as a system of differential equations for its state variables, such as amounts or concentrations in compartments. A numerical solver advances those states in time using finite steps. The solver must do more than produce a plausible value at the end of a step: its numerical updates must not turn a genuinely decaying process into a growing one.

This issue is especially clear when a system contains processes on different time scales. For example, rapid exchange between blood and a tissue can coexist with much slower elimination. Even when the overall PBPK trajectory changes gradually, a numerical method may need a small step to handle the rapid mode. The linear test equation provides a simple way to see why.

Definition: The linear test equation is \(y'=\lambda y\), where \(y\) is a scalar state and \(\lambda\) is a constant. For \(\lambda<0\), the exact solution decays as \(y(t+h)=e^{z}y(t)\), where \(z=h\lambda\) and \(h\) is the step size. A method is absolutely stable at \(z\) if its numerical update does not amplify this decaying mode: for a one-step method with amplification factor \(R(z)\), this means \(|R(z)|\leq 1\).

For a PBPK system, the test equation is not a replacement for the full model. It describes what can happen to a mode of the system, such as a fast exchange mode, when the equations are linearized. The eigenvalues of the linearized dynamics play the role of \(\lambda\). Stable decaying modes have negative real parts; a mode with a large negative eigenvalue is particularly restrictive for many explicit methods.

Explicit and Implicit Euler: Two Stability Conditions

Explicit Euler evaluates the derivative at the start of a step. Applied to \(y'=\lambda y\), it gives \(y_{n+1}=y_n+h\lambda y_n\), so the amplification factor is \(R(z)=1+z\). Its absolute-stability condition is the disk \(|1+z|\leq 1\), centered at \(-1\) with radius 1. For a negative real \(\lambda\), this reduces to a direct upper bound on \(h\).

Result: For explicit Euler on a decaying real mode with \(\lambda<0\), absolute stability requires \(0\leq h\leq 2/|\lambda|\). The condition prevents step-to-step growth, but it does not guarantee that the numerical solution is accurate.

Implicit Euler instead evaluates the derivative at the end of the step. Its update is \(y_{n+1}=y_n+h\lambda y_{n+1}\), so \(R(z)=1/(1-z)\). The stability condition is \(|1-z|\geq 1\). Every \(z\) with negative real part satisfies this inequality, so implicit Euler is stable for any positive step on a decaying real mode. It is also stable throughout the left half of the complex plane, a property called A-stability.

Worked Example: The Explicit Euler Step Limit

Suppose a mode in a hypothetical PBPK model decays according to \(y'=-80y\), with time measured in hours. Find the largest explicit Euler step allowed by absolute stability.

Here \(\lambda=-80\ \mathrm{h}^{-1}\). The condition \(h\leq 2/|\lambda|\) gives

$$ h \leq \frac{2}{80\ \mathrm{h}^{-1}}=0.025\ \mathrm{h}. $$

At \(h=0.025\ \mathrm{h}\), \(z=-2\) and \(R(z)=1-2=-1\). The numerical mode alternates sign without increasing in magnitude. For a larger step, such as \(h=0.03\ \mathrm{h}\), \(z=-2.4\), so \(R(z)=-1.4\) and \(|R(z)|=1.4>1\). The numerical solution grows in magnitude even though the exact solution decays. Thus \(0.025\ \mathrm{h}\) is a stability limit, not a recommended accuracy step.

Runge–Kutta and Backward Differentiation Methods

Runge–Kutta methods take several derivative evaluations within a step and combine them to advance the state. For the classical explicit fourth-order Runge–Kutta method, the amplification factor on the test equation is

$$ R(z)=1+z+\frac{z^2}{2}+\frac{z^3}{6}+\frac{z^4}{24}. $$

On the negative real axis, this method is stable approximately for \(-2.785\leq z\leq 0\). That interval is wider than explicit Euler's \([-2,0]\), but it is still bounded. A sufficiently fast decaying mode therefore forces an explicit Runge–Kutta solver to use small steps, even if the slower states change little over those steps.

Backward differentiation formulas (BDFs) use the current derivative and several past state values. They are implicit: at each step, the new state must be found from an equation involving that state. BDF1 is implicit Euler. BDF2, for a constant step \(h\), uses

$$ \frac{3y_{n+1}-4y_n+y_{n-1}}{2h}=\lambda y_{n+1}. $$

For a BDF method, stability is assessed by checking the roots of its characteristic equation, rather than by a single amplification factor. For BDF2 on the test equation, those roots satisfy \((3-2z)r^2-4r+1=0\). BDF1 and BDF2 are A-stable: they can stably integrate modes with negative real eigenvalues without the explicit methods' finite negative-real-axis step restriction. Higher-order BDF methods do not all retain A-stability; their stability regions cover sectors of the left half-plane rather than the whole half-plane.

Implicit stability does not remove the need to choose a suitable step. A method can remain stable while representing a rapidly changing transient poorly. Nor does stability alone ensure the PBPK solution is physiologically plausible or accurate. The distinction is central: stability concerns unwanted numerical amplification, while accuracy concerns how closely the numerical trajectory approximates the differential-equation solution.

Worked Example: Comparing Runge–Kutta Stability at Two Steps

Consider a hypothetical mode with \(\lambda=-100\ \mathrm{h}^{-1}\). Evaluate the classical fourth-order Runge–Kutta stability factor for \(h=0.01\ \mathrm{h}\) and \(h=0.03\ \mathrm{h}\).

At \(h=0.01\ \mathrm{h}\), \(z=-1\), so

$$ R(-1)=1-1+\frac{1}{2}-\frac{1}{6}+\frac{1}{24} =0.375. $$

The exact one-step multiplier is \(e^{-1}\approx 0.3679\). The numerical multiplier has magnitude below 1 and is reasonably close to the exact multiplier for this one step.

At \(h=0.03\ \mathrm{h}\), \(z=-3\), and

$$ R(-3)=1-3+\frac{9}{2}-\frac{27}{6}+\frac{81}{24} =1.375. $$

Now \(|R(-3)|=1.375>1\): the computed mode grows by 37.5% in one step, although its exact multiplier is \(e^{-3}\approx 0.04979\). The step exceeds the method's approximate stability limit \(h\leq 2.785/100=0.02785\ \mathrm{h}\). This comparison illustrates why a higher-order explicit method can still fail on a sufficiently fast mode.

A PBPK System with Fast and Slow Modes

Consider a hypothetical PBPK system whose linearized dynamics can be expressed in modal coordinates as two independent decaying components:

$$ q_f'=-100q_f,\qquad q_s'=-0.1q_s. $$

Here \(q_f\) and \(q_s\) are modal amplitudes in mg, and time is in hours. They represent a fast and a slow mode of a coupled system, not necessarily the amount in any one physical compartment. Let \(q_f(0)=q_s(0)=1\ \mathrm{mg}\). This simplified example isolates the numerical effect of widely separated rates.

Worked Example: Explicit and Implicit Updates for Fast and Slow Processes

Take one step of \(h=0.1\ \mathrm{h}\). For the fast mode, \(z_f=h(-100\ \mathrm{h}^{-1})=-10\). For the slow mode, \(z_s=h(-0.1\ \mathrm{h}^{-1})=-0.01\).

With explicit Euler, the fast-mode multiplier is \(1+z_f=-9\), giving \(q_f(0.1)=-9\ \mathrm{mg}\). The exact value is \(e^{-10}\ \mathrm{mg}\approx 0.00004540\ \mathrm{mg}\). The numerical value is not only inaccurate but outside the method's stability region. For the slow mode, the explicit multiplier is \(0.99\), giving \(0.99\ \mathrm{mg}\), close to the exact \(e^{-0.01}\ \mathrm{mg}\approx 0.99005\ \mathrm{mg}\).

With implicit Euler, the multiplier is \(1/(1-z)\). The fast-mode result is \(1/11\ \mathrm{mg}\approx 0.09091\ \mathrm{mg}\), compared with the exact \(0.00004540\ \mathrm{mg}\). The implicit update is stable, but it substantially under-represents the fast decay over this large step. The slow-mode result is \(1/1.01\ \mathrm{mg}\approx 0.99010\ \mathrm{mg}\), close to its exact value.

For BDF2, the fast-mode roots at \(z=-10\) satisfy \(23r^2-4r+1=0\), so \(r=(2\pm i\sqrt{19})/23\). Each root has magnitude \(\sqrt{1/23}\approx 0.2085\), less than 1. This indicates stable decay of the fast mode; the method still needs an initial value for its history, and the step's accuracy must be assessed separately. In contrast, classical explicit RK4 at this step has \(R(-10)=291\), so it would amplify the fast mode dramatically. The slow mode alone would not expose that instability.

The example shows the practical trade-off. An explicit method is straightforward to apply, but its stability may impose many small steps to carry a slow process across a long time interval. An implicit BDF method can often take larger stable steps in the presence of rapidly decaying modes, but each step requires solving an implicit equation. For nonlinear PBPK equations, this generally means solving a system of nonlinear equations, which has computational cost and can itself require careful implementation.

Choosing and Checking a Solver

Explicit Runge–Kutta methods are a natural choice when the relevant dynamics allow steps large enough for efficient integration and explicit evaluations are inexpensive. Implicit BDF methods are useful when decaying fast modes constrain explicit steps and a solver can efficiently handle the required implicit solves. Implicit Runge–Kutta methods are another option, but their implicit stage calculations can be more involved. No method is universally best: the equations, required accuracy, and computational cost matter.

Several numerical warning signs merit investigation. Unexpected oscillations or negative compartment amounts can indicate an overly large step or a method poorly suited to the dynamics, though they can also arise from model definitions or inputs. Repeatedly rejected steps or a solver that must take extremely small steps can signal that an explicit method is constrained by a fast mode. A stable-looking trajectory is not proof of accuracy: for example, implicit Euler gave a stable but poor fast-mode value in the worked example. Comparing results after reducing the step, or comparing an explicit and an implicit method at adequate accuracy, can help reveal numerical sensitivity.

These checks do not substitute for verifying the PBPK model itself. A numerical method integrates the equations supplied to it; it cannot correct an incorrect flow coupling, a missing process, or an implausible parameter. Likewise, changing to an implicit solver does not guarantee the solution will preserve every desirable property, such as nonnegative amounts, at every step. Stability regions describe behavior for the linear test equation, and provide guidance—not a universal guarantee for a nonlinear, time-varying PBPK system.

Deriving the Explicit Euler Restriction

The step restriction follows directly by requiring the numerical multiplier to have magnitude no greater than 1. For explicit Euler with a real decaying rate \(\lambda<0\), the update is \(y_{n+1}=(1+h\lambda)y_n\). Absolute stability therefore requires

$$ |1+h\lambda|\leq 1 \quad\Longleftrightarrow\quad -1\leq 1+h\lambda\leq 1. $$

Subtracting 1 gives \(-2\leq h\lambda\leq 0\). Since \(\lambda<0\) and \(h\geq 0\), dividing by \(\lambda\) reverses the inequality that gives the upper bound, yielding \(0\leq h\leq -2/\lambda=2/|\lambda|\). This is the explicit Euler stability condition. The restriction is more severe for modes with larger \(|\lambda|\), which explains the challenge of explicit integration when a PBPK system has a very fast process alongside a slow one.

Key takeaway: Explicit solvers have bounded stability regions, so fast decaying PBPK modes can force small steps. A-stable implicit methods can avoid that stability restriction for decaying modes, but stability is not accuracy: large steps can still miss important dynamics.

Check Your Understanding

Use the stability conditions and distinctions developed above to answer each question.

  1. A decaying mode has \(\lambda=-40\ \mathrm{h}^{-1}\). What is the largest explicit Euler step allowed by absolute stability?
  2. For a mode with \(\lambda=-5\ \mathrm{h}^{-1}\), is classical RK4 stable at \(h=0.2\ \mathrm{h}\)? Explain using \(z\).
  3. Why does an implicit Euler result that remains bounded not necessarily provide an accurate estimate of a fast transient?
  4. At \(h=0.1\ \mathrm{h}\), the fast mode in the two-mode example has \(z=-10\). Why is that a problem for explicit Euler and RK4, but not an absolute-stability violation for BDF2?

Solutions. (1) \(h\leq 2/40=0.05\ \mathrm{h}\). (2) \(z=h\lambda=-1\), which lies in RK4's negative-real stability interval; its multiplier is \(R(-1)=0.375\), so the step is stable. (3) Stability only limits numerical amplification. At a large step, implicit Euler can decay much more slowly than the exact solution, as the fast-mode calculation showed. (4) Explicit Euler has multiplier \(1-10=-9\), and RK4 has \(R(-10)=291\), both with magnitude greater than 1. The BDF2 characteristic roots at \(z=-10\) each have magnitude \(1/\sqrt{23}<1\), so its fast mode is stable, though this alone does not establish accuracy.