sim_area_single_concept_with_risk {care4cmodel}R Documentation

sim_area_single_concept_with_risk

Description

Low-level simulation function for area-phase dynamics, available for users who want to compose simulations out of the single steps. Regular users are recommended to use the function simulate_single_concept.

Usage

sim_area_single_concept_with_risk(
  state_vars,
  parms,
  event_times,
  time_span = 100L,
  time_frac = 4L,
  integ_method = "lsoda"
)

Arguments

state_vars

list of state variable(s) (vectors), all initialized

parms

list of parameter(s) (vectors)

event_times

vector of integers specifying the points in time when damage events can happen. Usually all numbers between (and including) zero and the endpoint of the simulation (i.e. c(0, time_span)).

time_span

simulation time span, integer, in the chosen time unit (typically years)

time_frac

integer >= 1, defines the time step to be used for numerical integration (time step = 1 / time_frac), i.e. one time unit will be split into time_frac substeps. Too small values of time_frac may cause the model showing chaotic dynamics, too large values increase computation time without meaningful gains in precision. The default value of 4 is mostly a good choice; in doubt, increase time_frac until the results do not change meaningfully anymore (risk events should be turned off during that procedure).

integ_method

integration method, passed to ode

Value

an object of class deSolve

Examples

  # Work with the example data pine_thinning_from_above_1
  # Initialize state variables (areas per stand development phase)
  state_vars <- setup_statevars(pine_thinning_from_above_1,
                                c(1000, 0, 0, 0, 0, 0))

  # Set time frame
  time_span          <- 200

  # Initialize parameters
  parms     <- setup_parms(pine_thinning_from_above_1)

  # Build risk matrix and add it to parms
  parms$risk_mat <- setup_risk_events(
    time_span, avg_event_strength = 1, parms$risk
  )

  # Simulate
  sim_area_single_concept_with_risk(
    state_vars,
    parms       = parms,
    event_times = c(0:time_span),
    time_span   = time_span
  )


[Package care4cmodel version 1.0.1 Index]