Add growth/maturity actions to a g3 model

g3a_grow_lengthvbsimple(
        linf_f = g3_parameterized('Linf', by_stock = by_stock),
        kappa_f = g3_parameterized('K', by_stock = by_stock),
        by_stock = TRUE)

g3a_grow_weightsimple(
        alpha_f = g3_parameterized('walpha', by_stock = by_stock),
        beta_f = g3_parameterized('wbeta', by_stock = by_stock),
        by_stock = TRUE)

g3a_grow_impl_bbinom(
        delta_len_f = g3a_grow_lengthvbsimple(by_stock = by_stock),
        delta_wgt_f = g3a_grow_weightsimple(by_stock = by_stock),
        beta_f = g3_parameterized('bbin', by_stock = by_stock),
        maxlengthgroupgrowth,
        by_stock = TRUE)

g3a_growmature(stock, impl_f, maturity_f = ~0, output_stocks = list(), 
    output_ratios = rep(1/length(output_stocks), times = length(output_stocks)), 
    transition_f = ~cur_step_final, run_f = ~TRUE,
    run_at = g3_action_order$grow,
    transition_at = g3_action_order$mature)

Arguments

linf_f

A formula to substitute for \(L_\infty\).

kappa_f

A formula to substitute for \(\kappa\).

alpha_f

A formula to substitute for \(\alpha\).

beta_f

A formula to substitute for \(\beta\).

maxlengthgroupgrowth

An integer with the maximum length groups an individual can jump in one step.

stock

g3_stock to grow.

delta_len_f

A formula defining a non-negative vector for mean increase in length for stock for each lengthgroup, as defined by g3a_grow_lengthvbsimple.

delta_wgt_f

A formula defining the corresponding weight increase as a matrix of lengthgroup to lengthgroup delta for stock, as defined by g3a_grow_weightsimple.

by_stock

Change the default parameterisation (e.g. to be by 'species'), see g3_parameterized.

impl_f

A pair of formula objects, as defined by g3a_grow_impl_bbinom. Both define a matrix of length groups i to length group deltas j (0..maxlengthgroupgrowth), the values in the first indicate the proportion of individuals moving from i to i + j, the values in the second indicate the corresponding weight increase of individuals moving from i to i + j.

maturity_f

A maturity formula, as defined by g3a_mature_constant.

output_stocks

List of g3_stocks that maturing stock should move into.

output_ratios

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

transition_f

formula specifying a contition for running maturation steps as well as growth, default final step of year.

run_f

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

run_at

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

transition_at

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

Details

A model can have any number of g3a_growmature actions, so long as the calling arguments are different. For instance, run_f = ~age == 5 and run_f = ~age == 7.

impl_f's dependent variables are analysed to see what will affect growth. If nothing but cur_step_size will affect growth, then growth will only be recalculated when the step size changes.

Value

g3a_grow_lengthvbsimple

Returns a formula for use as delta_len_f:

$$ {{\Delta}L}_i = ( L_\infty - L_i )(1 - e^{-\kappa{\Delta}t}) $$

Where \( \Delta{t} \) is the length of the current timestep.

g3a_grow_weightsimple

Returns a formula for use as delta_wgt_f:

$$ {{\Delta}W}_{i,j} = \alpha ( (L_i + {{\Delta}L}_j)^\beta - {L_i}^\beta ) $$

Where \( \Delta{t} \) is the length of the current timestep, \( {{\Delta}L} \) is all possible length group increases i.e 0..maxlengthgroupgrowth.

g3a_grow_impl_bbinom

formula object converting mean growths using beta-binomia distribution. See https://gadget-framework.github.io/gadget2/userguide/chap-stock.html#beta-binomial

g3a_growmature

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

  1. Move any maturing individuals into temporary storage, stock__transitioning_num / stock__transitioning_wgt

  2. Calculate increase in length/weight using growth_f and impl_f

  3. Move the contents of the temporary storage into output_stocks

Examples

ling_imm <- g3_stock(c(species = 'ling', 'imm'), seq(20, 156, 4))
ling_mat <- g3_stock(c(species = 'ling', 'mat'), seq(20, 156, 4))

# Growth / maturity for immature ling
growth_action <- g3a_growmature(ling_imm,
    impl_f = g3a_grow_impl_bbinom(
        # Parameters will be ling.Linf, ling.K
        g3a_grow_lengthvbsimple(by_stock = 'species'),
        # Parameters will be ling_imm.walpha, ling_imm.wbeta
        g3a_grow_weightsimple(),
        maxlengthgroupgrowth = 15),
    maturity_f = g3a_mature_constant(
        alpha = g3_parameterized('ling.mat1', scale = 0.001),
        l50 = g3_parameterized('ling.mat2')),
        output_stocks = list(ling_mat))