imex_cnab_step

Contents

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 obtain y_prev at 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 time t.

  • y_prev (PyTree) – Previous state at time t - dt.

  • t (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Current time.

  • *args – Extra arguments forwarded to f_exp and f_imp.

  • max_iter (int) – Newton iterations for the implicit solve. One iteration is exact when f_imp is linear in y.

Returns:

The updated state y_{n+1}.

Return type:

PyTree