SSPRK = Strong Stability Preserving Runge-Kutta (Shu & Osher, 1988).
Supported schemes: 'euler' — Explicit Euler (1st order) 'ssprk22' — SSPRK(2,2) (Shu & Osher, 1988) 'rk3' — TVD-RK3 (Shu & Osher, 1988) [default] 'rk4' — Classic RK4 'ssprk54' — SSPRK(5,4) (Spiteri & Ruuth, 2002) 'beuler' — Backward Euler with Newton-Raphson (implicit, 1st order) 'bdf2' — BDF2 with Newton-Raphson (implicit, 2nd order)
Implicit banded solver selection is controlled per-instance via state%cfg%lapack_solver = .true. (default) — LAPACK dgbsv (pivoted, faster) state%cfg%lapack_solver = .false. — built-in Gaussian elimination (no pivoting) Abstract interface satisfied by every single-step stepper.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| procedure(stepper_iface), | public, | pointer | :: | step | => | null() |
Procedure pointer to the active time-stepping scheme. Initialised to null; set once by init_time_scheme() before the time loop. |
| integer, | private, | parameter | :: | n_newton | = | 3 |
Maximum Newton-Raphson iterations per time step (beuler and bdf2). 3 iterations is sufficient for BDF2 at CFL ≤ 10; increase for stiff problems. |
| real(kind=wp), | private, | parameter | :: | tol_newton | = | 1.0e-10_wp |
Newton convergence tolerance: max-norm of correction ΔQ must fall below this. 1e-10 gives full convergence well below solver tolerance for double precision. |
| real(kind=wp), | private, | parameter | :: | eps_jac | = | 1.0e-7_wp |
Finite-difference step size for Jacobian column approximation. ≈ √(machine ε) ≈ √(2.2e-16) ≈ 1.5e-8; balances FD truncation error (O(h)) against floating-point cancellation error (O(ε/h)). |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_state_t), | intent(inout) | :: | state |
Resolve a scheme name to a specific stepper procedure pointer.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| procedure(stepper_iface), | intent(out), | pointer | :: | stepper | ||
| character(len=*), | intent(in) | :: | scheme |
Bind the procedure pointer @p step to the requested scheme.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | scheme |
Advance the solution by one time step using the TVD-RK3 scheme.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_state_t), | intent(inout) | :: | state |
Advance the solution by one time step using the SSPRK(5,4) scheme.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_state_t), | intent(inout) | :: | state |
Advance the solution by one time step using the explicit Euler scheme.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_state_t), | intent(inout) | :: | state |
Advance the solution by one time step using the SSPRK(2,2) scheme.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_state_t), | intent(inout) | :: | state |
Advance the solution by one time step using the classic RK4 scheme.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_state_t), | intent(inout) | :: | state |
Compute banded-storage dimensions for the Newton-step Jacobian.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_state_t), | intent(in) | :: | state |
Solver state (reads n_pt and cfg%lapack_solver). |
||
| integer, | intent(out) | :: | n_dof |
Total degrees of freedom (neq * n_pt) |
||
| integer, | intent(out) | :: | kl |
Total degrees of freedom (neq * n_pt) Lower bandwidth |
||
| integer, | intent(out) | :: | ku |
Total degrees of freedom (neq * n_pt) Lower bandwidth Upper bandwidth |
||
| integer, | intent(out) | :: | ldab |
Total degrees of freedom (neq * n_pt) Lower bandwidth Upper bandwidth Leading dimension of band matrix |
||
| integer, | intent(out) | :: | diag_row |
Total degrees of freedom (neq * n_pt) Lower bandwidth Upper bandwidth Leading dimension of band matrix Band-storage row that holds the diagonal |
Banded linear solver using LAPACK dgbsv.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(inout) | :: | ab(2*kl+ku+1,n) | |||
| integer, | intent(in) | :: | kl |
Lower bandwidth |
||
| integer, | intent(in) | :: | ku |
Lower bandwidth Upper bandwidth |
||
| integer, | intent(in) | :: | n |
Lower bandwidth Upper bandwidth Matrix order (number of unknowns) |
||
| real(kind=wp), | intent(inout) | :: | b(n) | |||
| integer, | intent(out) | :: | info |
LAPACK return code (0 = success) |
Advance the solution by one time step using backward (implicit) Euler.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_state_t), | intent(inout) | :: | state |
Advance the solution by one time step using the BDF2 (Gear) scheme.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_state_t), | intent(inout) | :: | state |
Flatten a (neq x n_pt) field into a length-neq*n_pt 1-D array. Ordering: (eq=1,cell=1), (eq=2,cell=1), ..., (eq=neq,cell=n_pt).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | src(nq,np) | |||
| real(kind=wp), | intent(out) | :: | dst(nq*np) | |||
| integer, | intent(in) | :: | nq | |||
| integer, | intent(in) | :: | np |
Add a flattened 1-D correction to a (neq x n_pt) 2-D field in place.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | src(nq*np) | |||
| real(kind=wp), | intent(inout) | :: | dst(nq,np) | |||
| integer, | intent(in) | :: | nq | |||
| integer, | intent(in) | :: | np |
Store one Jacobian column into band storage AB(diag_row_loc+i-j, j) = J(i,j). Works for both the custom (diag_row_loc = ku+1) and LAPACK (diag_row_loc = kl+ku+1) storage layouts.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(inout) | :: | ab_loc(:,:) | |||
| integer, | intent(in) | :: | j_col | |||
| real(kind=wp), | intent(in) | :: | col(n) | |||
| integer, | intent(in) | :: | kl_loc | |||
| integer, | intent(in) | :: | ku_loc | |||
| integer, | intent(in) | :: | diag_row_loc | |||
| integer, | intent(in) | :: | n |
Banded Gaussian elimination without pivoting. Band storage: AB(ku+1+i-j, j) = A(i,j). On exit x = A^{-1} b. The matrix ab_loc is overwritten with LU factors.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(inout) | :: | ab_loc(kl_loc+ku_loc+1,n) | |||
| integer, | intent(in) | :: | n | |||
| integer, | intent(in) | :: | kl_loc | |||
| integer, | intent(in) | :: | ku_loc | |||
| real(kind=wp), | intent(in) | :: | b(n) | |||
| real(kind=wp), | intent(out) | :: | x(n) |
Accumulate the global L2 norm of the residual into state%resid_glob.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_state_t), | intent(inout) | :: | state |