braincell.quad.cn_rk4_step

Contents

braincell.quad.cn_rk4_step#

braincell.quad.cn_rk4_step(target, t, dt, *args)[source]#

Advance a cell with Crank-Nicolson voltage and explicit RK4 channels.

Performs a two-stage operator-splitting update inside one dt:

  1. Channels and concentrations. With axial currents temporarily disabled, every non-voltage DiffEqState is advanced by rk4_step() (classical four-stage fourth-order Runge-Kutta).

  2. Cable voltage. A Crank-Nicolson step is then applied to the linear axial system \(dV/dt = A V\) via _crank_nicolson_for_axial_current(), which solves \((I - \tfrac{\Delta t}{2} A) V_{n+1} = (I + \tfrac{\Delta t}{2} A) V_n\).

The voltage solve is second-order accurate and unconditionally stable; the channel update is fourth-order accurate. The combined scheme is therefore second-order overall and well suited to dendrites where the cable equation dominates the stiffness budget.

Parameters:
  • target (DiffEqModule) – Multi-compartment cell to advance.

  • t (Quantity[s]) – Current simulation time.

  • dt (Quantity[s]) – Time step.

  • *args – Extra positional arguments forwarded to the channel and voltage solvers.

Returns:

target’s state is updated in place.

Return type:

None

Raises:

AssertionError – If target is not a braincell.Cell.

See also

cn_exp_euler_step

Same Crank-Nicolson voltage solve paired with exponential Euler channel updates.

implicit_rk4_step

Implicit Euler voltage solve paired with RK4 channels.