simmar is the main simulation engine for the marlin package.
Given initialised fauna and fleets objects, it advances the
age-structured, spatially explicit population forward in time for a
specified number of years, applying fishing mortality, natural mortality,
movement, and recruitment each time step.
Arguments
- fauna
Named list of critter objects from
create_critter. All critters must share the sametime_step(i.e. the same number ofseasons).- fleets
Named list of fleet objects from
create_fleet, tuned withtune_fleets.- manager
Named list of management actions. Supported elements:
mpasList with
$locations(a data frame with columnsx,y,mpa;mpa = TRUE= closed) and$mpa_year(integer year when closures are activated).quotasNamed numeric vector of annual catch caps per species (names match
fauna). Effort is scaled down by an optimised multiplier when the cap would be exceeded.effort_capNamed numeric vector capping total effort per fleet in open-access / sole-owner models.
closed_seasonsNamed list of integer vectors specifying which seasons are closed to fishing for each critter.
- habitat
Named list (one entry per critter) of time-varying habitat. Each entry is a list of
[ny, nx]matrices (one per year or per time step). When provided, the movement matrix is updated each step based on the difference in habitat quality between adjacent patches.- years
Numeric. Number of years to simulate. Ignored when
stepsis provided.- steps
Integer. Alternative to
years: number of time steps to simulate. Takes precedence overyearswhen notNA.- starting_season
Integer. Starting season within a year. Rarely needed; used when chaining partial-year runs.
- initial_conditions
Initial population state, typically
sim[[length(sim)]]from a previoussimmarcall. Defaults to the unfished equilibrium embedded in each critter object.- starting_step
Character. Step name of the form
"year_season"to start from. Controls step labelling when chaining runs.- keep_starting_step
Logical. If
TRUE(default), the starting (initial-conditions) step is included in the output.- log_rec_devs
Numeric matrix of pre-generated log recruitment deviates with rows = steps and columns = critters (names must match
fauna). WhenNULL(default), deviates are generated internally using each critter'ssigma_recandac_rec.- cor_rec
Numeric \(n \times n\) correlation matrix for recruitment deviates across species. Default
diag(length(fauna))(independent recruitment).
Value
A named list of length years / time_step (or steps),
where each element is named "year_season" and contains a named
sub-list (one per critter) with the population state at that step.
Each critter's state includes:
n_p_aNumbers by patch and age (matrix).
b_p_aBiomass by patch and age (matrix).
ssb_p_aSpawning stock biomass by patch and age (matrix).
c_p_aCatch in numbers by patch and age (matrix).
c_p_flCatch by patch and fleet (matrix).
r_p_flRevenue by patch and fleet (matrix).
prof_p_flProfit by patch and fleet (matrix).
e_p_flEffort by patch and fleet (data frame).
Pass output to process_marlin for tidying.
Details
Simulation loop (per time step)
Effort dynamics: For each fleet, total effort for this step is determined by the fleet model (
"constant_effort","open_access","sole_owner", or"manual"). Open-access and sole-owner fleets use a tanh-based normalised profitability signal derived from the previous step's revenues and costs.Spatial allocation:
allocate_effortredistributes each fleet's total effort across patches using a multiplicative velocity-field update driven by the chosenspatial_allocationmetric ("rpue","profit", etc.) from the previous step's buffet.Fishing & population dynamics: For each critter, age-structured fishing mortality \(F_{p,a}\) is applied, followed by natural mortality, movement, and Beverton-Holt recruitment.
Yield accounting:
allocate_yieldsandaggregate_yieldsbuild the per-fleet buffet of catch, revenue, profit, and CPUE by patch.Marginal values (if needed): When any fleet uses
spatial_allocation = "marginal_profit"or"marginal_revenue", orfleet_model = "sole_owner",calc_marginal_valueappends patch-level marginal returns to the buffet.Quota enforcement: If
manager$quotasis set for a species, a scalar effort multiplier is solved viaoptimto keep total catch at or below the quota.
Step naming
Steps are named "year_season" (e.g. "5_3" = year 5, season
3). Use clean_steps to strip any "step_" prefix.
Examples
if (FALSE) { # \dontrun{
# Basic run
sim <- simmar(fauna = fauna, fleets = fleets, years = 50)
# With MPA starting in year 10
mpa_locs <- expand_grid(x = 1:10, y = 1:10) |>
mutate(mpa = x <= 5)
sim_mpa <- simmar(
fauna = fauna,
fleets = fleets,
years = 50,
manager = list(
mpas = list(locations = mpa_locs, mpa_year = 10)
)
)
# Chain: baseline + policy scenario
sim_base <- simmar(fauna = fauna, fleets = fleets, years = 50)
sim_policy <- simmar(fauna = fauna, fleets = fleets, years = 20,
initial_conditions = sim_base[[length(sim_base)]],
manager = list(quotas = list(tuna = 500)))
} # }