This function tunes the detritus and algae biomass after running mizer's
default projectToSteady() function on the fish sub-model.
Usage
reefSteady(
params,
d_func = NULL,
t_max = 100,
t_per = 1.5,
dt = 0.1,
tol = 0.1 * dt,
return_sim = FALSE,
preserve = c("reproduction_level", "erepro", "R_max"),
progress_bar = TRUE,
...
)Arguments
- params
A MizerParams object
- d_func
Optional. A function that will be called after every t_per years with both the previous and the new state and that should return a number that in some sense measures the distance between the states. By default this uses the function distanceSSLogN() that you can use as a model for your own distance function.
- t_max
The maximum number of years to run the simulation. Default is 100.
- t_per
The simulation is broken up into shorter runs of
t_peryears, after each of which we check for convergence. Default value is 1.5. This should be chosen as an odd multiple of the timestepdtin order to be able to detect period 2 cycles.- dt
The time step to use in
project().- tol
The simulation stops when the relative change in the egg production RDI over
t_peryears is less thantolfor every species.- return_sim
If TRUE, the function returns the MizerSim object holding the result of the simulation run. If FALSE (default) the function returns a MizerParams object with the "initial" slots set to the steady state.
- preserve
Specifies whether the
reproduction_levelshould be preserved (default) or the maximum reproduction rateR_maxor the reproductive efficiencyerepro. SeesetBevertonHolt()for an explanation of thereproduction_level.- progress_bar
A shiny progress object to implement a progress bar in a shiny app. Default FALSE.
- ...
unused
Value
An object of type MizerParams
Details
Algae and detritus are treated differently while the fish sub-model
converges. Detritus is frozen at its current biomass throughout (its
other_dynamics is temporarily replaced with constant_dynamics()),
because its production genuinely depends on a not-yet-tuned external
flux (see tuneUR()/tuneUR_cc(), getDetritusProduction()) that
isn't set until the very end. Algae, by contrast, is left live and
evolving via its own dynamics function
(algae_dynamics()/algae_dynamics_cc()) throughout the loop, because
algae production is a fixed, literature-informed constant (see
setAlgaeParams()) that never needs retuning – letting it co-adapt
with the fish sub-model as it converges lets the two reach a genuine
joint steady state together. (This matters because mizer's own
convergence check, distanceSSLogN(), only looks at fish abundances,
not at the resource pools – freezing algae and then moving it in one
shot at the very end, as used to happen, could leave fish not actually
adapted to the final algae biomass.) Algae is frozen instead, like
detritus, when new_refuge == TRUE, matching the fact that the final
tuning step is also skipped in that case (see new_refuge in
newReefParams()).
After the fish sub-model converges, tuneUR() or tuneUR_cc() (chosen
based on whether the model uses the carrying-capacity resource
formulation) is called once to bring detritus to its own steady state
and to make algae's (already live-evolved) biomass exact, unless
new_refuge == TRUE, in which case algae and detritus are left
completely untouched.
Examples
data(caribbean_3_model)
params <- reefSteady(caribbean_3_model)
#> Convergence was achieved in 1.5 years.
#> Warning: The flux of external detritus is negative.
