Canonical RHS excerpt from the registered callable used for this benchmark cell. Expand it to verify the state equations; it is not a standalone runnable fixture.
Show canonical RHS excerpt
def rhs(t: float, y: np.ndarray) -> np.ndarray:
# y = amounts [mg] in each compartment
C = np.maximum(y, 0.0) / V # concentrations [mg/L]
C_art = C[0] # arterial concentration
dy = np.zeros(11)
# Arterial pool receives lung venous output, pumps to tissues
Q_co = Q[2] # cardiac output
# Lung compartment (mixes venous pool)
C_ven = C[1]
dy[2] = Q_co * (C_ven - C[2] / Kp[2])
# Liver: portal + arterial input, intrinsic clearance
Q_hep = Q[3] + Q[5] # hepatic blood flow (portal + gut)
dy[3] = Q[3] * C_art + Q[5] * C[5] / Kp[5] - Q_hep * C[3] / Kp[3] - CL_int * fuP * C[3] / Kp[3]
# Kidney: arterial input, renal clearance
dy[4] = Q[4] * (C_art - C[4] / Kp[4]) - CL_ren * fuP * C[4] / Kp[4]
# Gut: arterial input → into portal
dy[5] = Q[5] * (C_art - C[5] / Kp[5])
# Remaining perfused tissues (muscle, fat, brain, skin, RP)
for i in [6, 7, 8, 9, 10]:
dy[i] = Q[i] * (C_art - C[i] / Kp[i])
# Venous return (sum of tissue outflows)
Q_ven_return = sum(Q[i] * C[i] / Kp[i] for i in [3, 4, 6, 7, 8, 9, 10])
dy[1] = Q_ven_return - Q_co * C_ven
# Arterial: lung output
dy[0] = Q_co * (C[2] / Kp[2] - C_art)
return dy- Parameters
- CL_int = 30
- CL_ren = 10
- Kp = [1, 1, 2, 8, 4, 6, 3, 25, 2, 4, 5]
- Q = [0, 0, 390, 81, 60, 52, 101, 14, 43, 18, 21]
- V = [1.65, 3.3, 0.5, 1.8, 0.31, 1.1, 28, 14.5, 1.45, 3.5, 1]
- fuP = 0.05
- Initial condition
- y(0) = [100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
- Horizon
- t ∈ [0, 72]
Canonical RHS excerpt captured from the same registered callable used for the published benchmark. Frozen closure values are summarized below; helper imports and solver settings are intentionally omitted.