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) )
i | Either an integer, or a range giving the day(s) of simulation needed. Match the row index, so |
---|---|
S | The simulation list (see |
verbose | Boolean. Prints progress bar if |
Period | (Initalization) The maximum period that will be simulated (given at initialization) |
Inpath | (Initalization) Path to the input parameter list folder, Default: |
FileName | (Initalization) A list of input file names :
Default input files are provided with the package as an example parameterization. |
Either an initialized simulation list (if S is null) or the modified simulation list S
The simulation needs to be initialized first (for one year minimum), and then the model can be called day after day (see 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. }