# NOT RUN {
#######################################################################
#Example 1: Different thermal tolerance ranges (scenario RCP2.6).
#######################################################################
temp_cmin <- 291
# Temperature that occurs before the minimum simulation time.
temp_i <- 295
time_end <- 2100
# Temperature that occurs in the maximum time of the simulation.
temp_max <- get_RCP2.6(time_end)+temp_i
# Simulation thermal range.
RS <- temp_max-temp_cmin
temp_cmax1 <- 4/3*RS+temp_cmin
temp_cmax2 <- 2/3*RS+temp_cmin
temp_cmax3 <- 1/3*RS+temp_cmin
temp_ini <- (temp_cmin+temp_cmax3)/2
age_structure(y_ini = c(N1 = 800, N1 = 800, N1 = 800,
N2 = 600, N2 = 600, N2 = 600,
N3 = 400, N3 = 400, N3 = 400),
temp_ini = rep(temp_ini,3),
temp_cmin = rep(temp_cmin,3),
temp_cmax = c(temp_cmax1,temp_cmax2,temp_cmax3),
ro = rep(0.7,3),
lambda1 = c(0.00002,0,0),
lambda2 = c(0,0.00004,0.00003),
lambda3 = c(0,0.00003,0.00004),
alpha1 = rep(0.3,3),
alpha2 = rep(0.4,3),
d2 = rep(0.004,3),
d3 = rep(0.005,3),
Ad2 = rep(0.5,3),
Ad3 = rep(0.75,3),
Tr2 = rep(298,3),
Tr3 = rep(298,3),
RCP = 2.6,
time_start = 2005,
time_end = time_end,
leap = 1/50)
#######################################################################
#Example 2: Different thermal tolerance ranges (scenario RCP8.5).
#######################################################################
temp_cmin <- 291
# Temperature that occurs before the minimum simulation time.
temp_i <- 295
time_end <- 2100
# Temperature that occurs in the maximum time of the simulation.
temp_max <- get_RCP8.5(time_end)+temp_i
# Simulation thermal range.
RS <- temp_max-temp_cmin
temp_cmax1 <- 4/3*RS+temp_cmin
temp_cmax2 <- 2/3*RS+temp_cmin
temp_cmax3 <- 1/3*RS+temp_cmin
temp_ini <- (temp_cmin+temp_cmax3)/2
age_structure(y_ini = c(N1 = 800, N1 = 800, N1 = 800,
N2 = 600, N2 = 600, N2 = 600,
N3 = 400, N3 = 400, N3 = 400),
temp_ini = rep(temp_ini,3),
temp_cmin = rep(temp_cmin,3),
temp_cmax = c(temp_cmax1,temp_cmax2,temp_cmax3),
ro = rep(0.7,3),
lambda1 = c(0.00002,0,0),
lambda2 = c(0,0.00004,0.00003),
lambda3 = c(0,0.00003,0.00004),
alpha1 = rep(0.3,3),
alpha2 = rep(0.4,3),
d2 = rep(0.004,3),
d3 = rep(0.003,3),
Ad2 = rep(0.5,3),
Ad3 = rep(0.6,3),
Tr2 = rep(298,3),
Tr3 = rep(298,3),
RCP = 8.5,
time_start = 2005,
time_end = time_end,
leap = 1/50)
# }
Run the code above in your browser using DataLab