imex_cnab_step#
- class braintools.quad.imex_cnab_step(f_exp, f_imp, y, y_prev, t, *args, max_iter=2, **kwargs)#
CNAB (Crank–Nicolson / Adams–Bashforth) IMEX step (second order).
Advances using explicit AB2 for the nonstiff part and trapezoidal rule for the stiff part:
y_{n+1} = y_n + dt * [ 3/2 f_exp(y_n, t_n) - 1/2 f_exp(y_{n-1}, t_{n-1}) ] + dt/2 * [ f_imp(y_{n+1}, t_{n+1}) + f_imp(y_n, t_n) ]
This is a two-step method: start it with a one-step method (for example
imex_ars222_step()) to obtainy_prevat the first step.- Parameters:
f_exp (
Callable[...,PyTree]) – Explicit and implicit functions.f_imp (
Callable[...,PyTree]) – Explicit and implicit functions.y (
PyTree) – Current state at timet.y_prev (
PyTree) – Previous state at timet - dt.t (
Array|ndarray|bool|number|bool|int|float|complex|Quantity) – Current time.*args – Extra arguments forwarded to
f_expandf_imp.max_iter (
int) – Newton iterations for the implicit solve. One iteration is exact whenf_impis linear iny.
- Returns:
The updated state
y_{n+1}.- Return type:
PyTree