8  Define Scenarios & Experiments

if any changes are made, need to re-run qmd_to_r_script() at end, in console

Purpose: This script defines parameter sets for each scenario/experiment.

8.1 Default parameters

Set the default/base parameter values that each experiment will adjust. Note that both the habitat and simulation parameters are rolled into a single list here.

Code
base_params <- list(

  # ── Timeline ──────────────────────────────────────────
  nyears_burnin     = 40,
  nyears_experiment = 60,
  ramp_years        = 60, # ramp years should almost always be set to the same as nyears_experiment
  mindate           = as.Date("2001-05-01"),

  # ── Temperature — warm patch ───────────────────────────
  base_temp_warm  = 11,
  amplitude_warm  = 14,
  peak_doy_warm   = 196,
  temp_min_warm   = 0.5,
  temp_noise_warm = 0,

  # ── Temperature — cold patch ───────────────────────────
  base_temp_cold  = 6.6,
  amplitude_cold  = 8.4,
  peak_doy_cold   = 196,
  temp_min_cold   = 0.3,
  temp_noise_cold = 0,

  # ── Patch burn-in values ───────────────────────────────
  pcmax_warm = 0.5,  pcmax_cold = 0.5,
  A_warm     = 1.0,  A_cold     = 1.0,
  K_warm     = 200,  K_cold     = 200,  # reduced from 500; needed for density signal in critical-period function
  S_max_warm = 0.9994, S_max_cold = 0.9994,

  # ── Experiment targets (NA = no change) ───────────────
  pcmax_warm_target = NA,  pcmax_cold_target = NA,
  A_warm_target     = 2,   A_cold_target     = 0,
  K_warm_target     = NA,  K_cold_target     = NA,
  S_max_warm_target = NA,  S_max_cold_target = NA,

  # ── Behavioural / movement ─────────────────────────────
  move_stochastic   = "prob",
  food_densdepen    = "hyperbolic",
  sense_environment = "density_current",

  # ── Population ─────────────────────────────────────────
  n_fish_per_strat  = 50,
  start_wt          = 0.5,
  wt_sd             = 0.05,

  # ── Movement cost ──────────────────────────────────────
  movecost_c   = 0.1,
  movecost_b   = 0.3,
  sigma_bold   = 0.002,
  tau          = 0.001,

  # ── Survival ──────────────────────────────────────────
  T1_mort           = 30,
  T9_mort           = 25.8,
  K9_starv          = 0.55,
  K1_starv          = 0.45,
  MaxDensity4Growth = 50,

  # Critical-period consumption-based survival (Elliott 1989)
  # Applies fncSurviveConsumption() to age-0 fry for their first crit_period_days.
  # Parameterised so that sustained pcmax_dd ≤ crit_pcmax_lo ≈ 1% 60-day survival;
  # sustained pcmax_dd ≥ crit_pcmax_hi ≈ 99% 60-day survival (negligible cost).
  crit_pcmax_lo    = 0.30,
  crit_pcmax_hi    = 0.40,
  crit_period_days = 60L,
  
  # ── Competition ───────────────────────────────────────
  dominance_beta             = 1,
  age_structured_competition = TRUE,

  # ── Reproduction ──────────────────────────────────────
  egg_wt       = 0.07,
  repro_cost   = 0.2,
  sigma_fecund = 0.085,
  egg_surv     = 0.1,  # reduced from 0.1; prevents overcompensatory recruitment cycles (see diagnostic session)

  # ── Seeds ─────────────────────────────────────────────
  hab_seed = 123,
  sim_seed = 7843
)

8.2 Define scenarios

Define scenarios as variants on the default parameters

Code
scenarios <- list(
  null_cold                   = modifyList(base_params, list(A_warm = 0, 
                                                             A_warm_target = NA)),
  temp_mult                   = base_params,
  temp_offset                 = modifyList(base_params, list(base_temp_warm  = 15,
                                                             amplitude_warm  = 9.5,
                                                             temp_min_warm   = 0.5,
                                                             base_temp_cold  = 6.6,
                                                             amplitude_cold  = 8.4,
                                                             temp_min_cold   = 0)),
  temp_offset_diffP           = modifyList(base_params, list(base_temp_warm  = 15,
                                                             amplitude_warm  = 9.5,
                                                             temp_min_warm   = 0.5,
                                                             base_temp_cold  = 6.6,
                                                             amplitude_cold  = 8.4,
                                                             temp_min_cold   = 0,
                                                             pcmax_warm      = 0.6,
                                                             pcmax_cold      = 0.4))
)

8.2.1 Plot scenario habitat specs.

8.2.1.1 Null: cold habitat only

  • Cold habitat only; warm habitat total unavailable. This is effectively equivalent to running a simulation with only resident fish.

Note that we specify warm habitat conditions (temp, food availability, survival, etc.), these have no bearing on the results because area is always 0; fish can never occupy the warm habitat

Code
plot_habitat(build_habitat(scenarios[["null_cold"]]), exp_start_date = scenarios[["null_cold"]]$mindate + years(scenarios[["null_cold"]]$nyears_burnin))

8.2.1.2 Multiplicative temperature

  • Thermal regimes are ~multiplicative of each other: maximum thermal heterogeneity during summer, but heterogeneity collapses to ~0 during winter (everything is cold).
  • Habitat area is equal during burn-in; cold habitat is entirely replaced by warm habitat over experiment
Code
plot_habitat(build_habitat(scenarios[["temp_mult"]]), exp_start_date = scenarios[["temp_mult"]]$mindate + years(scenarios[["temp_mult"]]$nyears_burnin))

8.2.1.3 Offset temperature

  • Thermal regimes are offset of each other: warm habitat is 5-10 degrees warmer than the cold habitat. Warm habitat persists overwinter
  • Everything else the same as is base parameter set
Code
plot_habitat(build_habitat(scenarios[["temp_offset"]]), exp_start_date = scenarios[["temp_offset"]]$mindate + years(scenarios[["temp_offset"]]$nyears_burnin))

8.2.1.4 Pcmax: warm-high, cold-low

  • As above, thermal regimes are offset of each other: warm habitat is 5-10 degrees warmer than the cold habitat. Warm habitat persists overwinter
  • Threshold Pcmax is high in the warm habitat and low in the cold habitat (gradients/controls on food availability and foraging opportunity)
Code
plot_habitat(build_habitat(scenarios[["temp_offset_diffP"]]), exp_start_date = scenarios[["temp_offset_diffP"]]$mindate + years(scenarios[["temp_offset_diffP"]]$nyears_burnin))

8.3 Write R file

Code
file.remove("ScenarioDefs.R")
quarto::qmd_to_r_script("ScenarioDefs.qmd")