Add spawning to a g3 model

g3a_spawn_recruitment_fecundity(p0, p1, p2, p3, p4)

g3a_spawn_recruitment_simplessb(mu)

g3a_spawn_recruitment_ricker(mu, lambda)

g3a_spawn_recruitment_bevertonholt(mu, lambda)

g3a_spawn_recruitment_hockeystick(r0, blim)

g3a_spawn(
        stock,
        recruitment_f,
        proportion_f = 1,
        mortality_f = 0,
        weightloss_f = 0,
        output_stocks = list(),
        output_ratios = rep(1 / length(output_stocks), times = length(output_stocks)),
        mean_f = g3a_renewal_vonb_t0(by_stock = by_stock),
        stddev_f = g3_parameterized('rec.sd', value = 10, by_stock = by_stock),
        alpha_f = g3_parameterized('walpha', by_stock = wgt_by_stock),
        beta_f = g3_parameterized('wbeta', by_stock = wgt_by_stock),
        by_stock = TRUE,
        wgt_by_stock = TRUE,
        run_step = NULL,
        run_f = ~TRUE,
        run_at = g3_action_order$spawn,
        recruit_at = g3_action_order$renewal)

Arguments

p0,p1,p2,p3,p4

Substituted into g3a_spawn_recruitment_fecundity formula, see below.

mu,lambda,r0,blim

Substituted into g3a_spawn_recruitment_* formula, see below.

stock

The mature g3_stock that will spawn in this action.

recruitment_f

A list of formula generated by one of the g3a_spawn_recruitment_* functions, containing

s

Formula run for each subset of stock

r

Final formula for calculating number of recruits for spawning action

proportion_f

formula generated by one of the g3_suitability_* functions, describing the proportion of stock that will spawn at this timestep.

mortality_f

formula generated by one of the g3_suitability_* functions, describing the proportion of spawning stock that will die during spawning.

weightloss_f

formula generated by one of the g3_suitability_* functions, describing the overall weight loss during spawning.

output_stocks

List of g3_stocks that will be spawned into.

output_ratios

Vector of proportions for how to distribute into output_stocks, summing to 1, default evenly spread.

mean_f,stddev_f,alpha_f,beta_f

formula substituted into stock structure calculations, see g3a_renewal_normalparam for details.

run_step

Which step to perform renewal in, or NULL for continuous spawning. Adds cur_step == (run_step) into default run_f.

run_f

formula specifying a condition for running this action, default always runs.

run_at

Integer order that spawning actions will be run within model, see g3_action_order.

recruit_at

Integer order that recruitment from spawning will be run within model, see g3_action_order.

by_stock,wgt_by_stock

Controls how parameters are grouped, see g3_parameterized

Details

To restrict spawning to a particular step in a year, or a particular area, use run_f. For example:

cur_step == 1

Spawning will happen on first step of every year

cur_step == 1 && cur_year >= 1990

Spawning will happen on first step of every year after 1990

cur_step == 2 && area = 1

Spawning will happen on second step of every year, in the first area

The action will define the following stock instance variables for each given stock and output_stock:

stock__spawnprop

Proportion of (stock) that are spawning in this spawning event

stock__spawningnum

Numbers of (stock) that are spawning in this spawning event

output_stock__spawnednum

Numbers of (output_stock) that will be produced in this spawning event

Value

g3a_spawn_recruitment_fecundity

A pair of formula objects: $$ S = l ^{p_{1}} a^{p_{2}} (p N_{al})^{p_{3}} W_{al}^{p_{4}} $$ $$ R = p_{0} S $$

\(N_{al}\)

Number of parent stock

\(W_{al}\)

Weight of parent stock

\(p\)

Proportion of parent stock spawning, from proportion_f

\(p_{0..4}\)

Arguments provided to function

g3a_spawn_recruitment_simplessb

A pair of formula objects: $$ S = N_{al} p W_{al} $$ $$ R = \mu S $$

\(N_{al}\)

Number of parent stock

\(W_{al}\)

Weight of parent stock

\(p\)

Proportion of parent stock spawning, from proportion_f

μ

Argument provided to function

g3a_spawn_recruitment_ricker

A pair of formula objects: $$ S = N_{al} p W_{al} $$ $$ R = \mu S e^{-\lambda S} $$

\(N_{al}\)

Number of parent stock

\(W_{al}\)

Weight of parent stock

\(p\)

Proportion of parent stock spawning, from proportion_f

μ

Argument provided to function

λ

Argument provided to function

g3a_spawn_recruitment_bevertonholt

A pair of formula objects: $$ S = N_{al} p W_{al} $$ $$ R = \frac{\mu S}{\lambda + S} $$

\(N_{al}\)

Number of parent stock

\(W_{al}\)

Weight of parent stock

\(p\)

Proportion of parent stock spawning, from proportion_f

μ

Argument provided to function

λ

Argument provided to function

g3a_spawn_recruitment_hockeystick

A pair of formula objects: $$ S = N_{al} p W_{al} $$ $$ R = R_0 \min{( S / B_{lim}, 1)} $$

\(N_{al}\)

Number of parent stock

\(W_{al}\)

Weight of parent stock

\(p\)

Proportion of parent stock spawning, from proportion_f

\(R_0\)

Argument r0 provided to function

\(B_{lim}\)

Argument blim provided to function

NB: This formula is differentiable, despite using min() in the definition above.

g3a_spawn

An action (i.e. list of formula objects) that will, for the given stock...

  1. Use proportion_f to calculate the total parent stock that will spawn

  2. Use recruitment_f to derive the total newly spawned stock

  3. Apply weightloss_f and mortality_f to the parent stock

... then, at recruitment stage ...

  1. Recruit evenly into output_stocks, using mean_f, stddev_f, alpha_f, beta_f as-per g3a_renewal_normalparam

Examples

ling_imm <- g3_stock('ling_imm', seq(20, 156, 4)) %>% g3s_age(3, 10)
ling_mat <- g3_stock('ling_mat', seq(20, 156, 4)) %>% g3s_age(3, 10)

spawn_action <- g3a_spawn(
    # Spawn from ling_mat
    ling_mat,
    # Use Ricker Recruitment Function to calculate # of recruits from total biomass
    recruitment_f = g3a_spawn_recruitment_ricker(
        g3_parameterized("ricker.mu"),
        g3_parameterized("ricker.lambda")),
    # Proportion of ling_mat spawning exponential relationship based on length
    proportion_f = g3_suitability_exponentiall50(
        alpha = g3_parameterized("spawn.prop.alpha", scale = -1),
        l50 = g3_parameterized("spawn.prop.l50")),
    # Proportion of ling_mat dying during spawning linear relationship to length
    mortality_f = g3_suitability_straightline(
        alpha = g3_parameterized("spawn.mort.alpha"),
        beta = g3_parameterized("spawn.mort.beta")),
    # Weightloss of ling_mat during spawning a constant
    weightloss_f = g3_parameterized("spawn.weightloss"),
    # Spawn into ling_imm
    output_stocks = list(ling_imm),
    # Spawned stock structure, as-per g3a_renewal_normalparam()
    mean_f = 50,
    stddev_f = 0.9,
    alpha_f = 1,
    beta_f = 1,
    # Spawning should happen on the first step of every year
    run_f = ~cur_step==1)