Using DynACof one iteration after another. Allows to run a DynACof simulation step by step to e.g. modify a variable simulated by DynACof using another model for model coupling

dynacof_i(
  i,
  S = NULL,
  verbose = TRUE,
  Period = NULL,
  Inpath = NULL,
  FileName = list(Site = "1-Site.R", Meteo = NULL, Soil = "3-Soil.R", Coffee =
    "4-Coffee.R", Tree = NULL)
)

Arguments

i

Either an integer, or a range giving the day(s) of simulation needed. Match the row index, so i=366 make a simulation for the row number 366 of Sim and Met (i.e. the 366th day).

S

The simulation list (see DynACof()). If NULL, the function initialize one.

verbose

Boolean. Prints progress bar if TRUE (default).

Period

(Initalization) The maximum period that will be simulated (given at initialization)

Inpath

(Initalization) Path to the input parameter list folder, Default: NULL (take package values)

FileName

(Initalization) A list of input file names :

Site

Site parameters file name, see details. Default: '1-Site.R'

Meteo

Meteo parameters file name, see details. Default: '2-Meteorology.txt'

Soil

Soil parameters file name, see details. Default: '3-Soil.R'

Coffee

Coffee parameters file name, see details. Default: '4-Coffee.R'

Tree

Shade tree parameters file name, see details. Default: NULL

Default input files are provided with the package as an example parameterization.

Value

Either an initialized simulation list (if S is null) or the modified simulation list S

Details

The simulation needs to be initialized first (for one year minimum), and then the model can be called day after day (see examples).

Examples

if (FALSE) { Sys.setenv(TZ="UTC") # First, initialize a simulation: S= dynacof_i(1:365,Period= as.POSIXct(c("1979-01-01", "1980-12-31"))) # Then, compute the simulation for the next day: S= dynacof_i(366,S) # We can modifiy the value of some variables before computing the next day and compare with # unmodified value: # Make a copy of the simulation list: S2= S # Changing the value of Tair in the meteorology for day 367 for S2: S2$Meteo$Tair[367]= S2$Meteo$Tair[367]+10.0 # Make a computation for each: S= dynacof_i(367,S) S2= dynacof_i(367,S2) # Compare the values of e.g. the maitenance respiration: S$Sim$Rm[367] S2$Sim$Rm[367] # To run DynACof for several days, use a range for i: S= dynacof_i(368:nrow(S$Meteo),S) # NB: nrow(S$Meteo) is the maximum length we can simulate. To increase a simulation, # initialize it with a wider range for the "Period" argument. }