bdf2_step Subroutine

public subroutine bdf2_step(state)

Advance the solution by one time step using the BDF2 (Gear) scheme.

Second-order two-step implicit formula (Gear, 1971):

Q^{n+1} = 4/3 * Q^n - 1/3 * Q^{n-1} + (2/3) * dt * R(Q^{n+1})

Solved via Newton-Raphson with the same banded-LU infrastructure as beuler_step(). LHS: A = I - (2/3)dtJ. RHS: b = (2/3)dtR(Q^k) - (Q^k - 4/3Q^n + 1/3Q^{n-1})

Bootstrap: the very first call performs one backward Euler step (A = I - dt*J, standard beuler RHS) to produce Q^1 from Q^0, storing Q^0 in state%bdf2_ub_prev so that subsequent calls can use the BDF2 formula.

At -np > 1: gather Q^n (and bdf2_ub_prev when past bootstrap) to rank 0, temporarily switch state into a single-rank decomp on rank 0, run bdf2_step_serial_body on the global vector, scatter Q^{n+1} and the updated bdf2_ub_prev back to per-rank slices, then call compute_resid_glob from every rank (so the par_sum_real inside it is a proper collective).

References: C.W. Gear, "Numerical Initial Value Problems in Ordinary Differential Equations," Prentice-Hall, 1971.

Arguments

Type IntentOptional Attributes Name
type(solver_state_t), intent(inout), target :: state