This is an experimental second-order time stepping variant of project_n().
It first predicts the new consumer densities with project_n(), optionally
recalculates rates from that prediction, and then applies a Crank-Nicolson
corrector using midpoint rates.
Usage
project_n_2(
params,
r,
n,
dt,
a,
b,
c,
S,
idx,
w_min_idx_array_ref,
no_sp,
no_w,
rates_fns = NULL,
n_pp = NULL,
n_other = NULL,
t = 0,
effort = NULL,
r_hat = NULL,
r_mid = NULL,
...
)Arguments
- params
A MizerParams object.
- r
A list of rates as returned by
mizerRates().- n
An array (species x size) with the number density at the current time step.
- dt
Time step.
- a
A matrix (species x size) used in the solver (transport term).
- b
A matrix (species x size) used in the solver (diagonal term).
- c
A matrix (species x size) used in the solver (transport term).
- S
A matrix (species x size) used in the solver (source term).
- idx
Index vector for size bins (excluding the first one).
- w_min_idx_array_ref
Index vector for the start of the size spectrum for each species.
- no_sp
Number of species.
- no_w
Number of size bins.
- rates_fns
Optional named list of rate functions, as used by
mizerRates(). If supplied together withn_pp,n_otherandeffort, provisional end-of-step rates are calculated from the predicted densities.- n_pp
Resource abundance used when recalculating provisional rates.
- n_other
Other ecosystem components used when recalculating provisional rates.
- t
Current time.
- effort
Fishing effort used when recalculating provisional rates.
- r_hat
Optional provisional end-of-step rates. If supplied, these are used instead of recalculating them.
- r_mid
Optional midpoint rates. If supplied, these are used directly in the Crank-Nicolson corrector.
- ...
Further arguments passed to the rate functions.
Details
If the rate recalculation arguments are not supplied, the corrector uses the supplied rates as fixed rates. In that case the corrector is second order only for the frozen-rate transport problem, not for the full nonlinear mizer dynamics.
