Wageningen University & Research | FEM-31806 | Models for Ecological Systems | FEM | PPS | WEC

Knowledge questions

Consider the IJsselmeer lake (with an area of 1133 km2 and an average depth of 4.4 m, resulting in a volume VV of 4.532 km3) with inflow from the IJssel river (with a flow rate FF of 265 m3/s). The lake has a constant volume and hence inflow rates equal outflow rates. The change in the amount of pollutant GG in the lake can be described with the following differential equation:

dGdt=(gcinGV)F\frac{dG}{dt} = (gc_{in} - \frac{G}{V} ) * F
Provide the time coefficient for this system.

Here the state is GG. The rate equation can be re-written as “something times GG”:

dGdt=gcinFGFV\frac{dG}{dt} = gc_{in} * F - G * \frac{F}{V}

When the inflow gcingc_{in} equals 0, the first part can be ignored. Then it is easy to see that the time coefficient for GG, TCGTC_G, equals VF\frac{V}{F}, or 1 divided by “what multiplies with the state”. This also looks like an negative exponential equation!

It can also be shown that this solution is correct with the general equation for the time coefficient and the equilibrium value for the state. The equilibrium value for GG:

dGdt=0GeqFV=gcinFGeq=gcinFVF\frac{dG}{dt}=0 \\ G_{eq} * \frac{F}{V} = gc_{in} * F \\ G_{eq} = gc_{in} * F * \frac{V}{F} \\

When using this value in the equation for the time coefficient:

TCG=gcinVGgcinFGFV=gcinVGFV(gcinVG)=1FV=VFTCG=VF=4532×109 m3265 m3 s1=17.1×109 seconds=542.30 yearsTC_G = \huge | \small \frac{gc_{in} * V - G}{gc_{in} * F - G * \frac{F}{V}} \huge | \small = \huge | \small \frac{gc_{in} * V - G}{\frac{F}{V} * (gc_{in} * V - G)} \huge | \small = \huge | \small \frac{1}{\frac{F}{V}} \huge | \small = \frac{V}{F} \\ TC_G = \frac{V}{F} = \frac{4532 × 10^9 \text{ m}^3}{265 \text{ m}^3 \text{ s}^{-1}} = 17.1 × 10^9 \text{ seconds} = 542.30 \text{ years}

Note that this TC value is based on the assumption that the lake is perfectly mixed and that GG is only removed by outflow (so no decomposition or net precipitation on the lake floor).

Explain why the delay time is the same as the average residence time of a pollutant GG.

This is an negative exponential system, most easy to see when inflow equals 0.

Explain what is meant by negative or positive feedbacks and indicate if this system has no, a positive or a negative feedback.

A negative feedback means stability i.e. the system returns to the same equilibrium when a small change in the value of the state is made. A positive feedback is instable, and a small change will move the system away from an equilibrium. This system has a negative feedback. When the amount of GG is changed, it returns to the same equilibrium GG, equal to gcinVgc_{in} * V. This because the outflow rate increases when GG increases, so reducing the amounts in the lake, and the outflow rate decreases when GG decreased, increasing the amounts in the lake when the inflow remains unchanged.

Exercise 5.1

We can measure photosynthesis of a leaf or crop in a closed chamber by measuring the decrease in carbon dioxide concentration in time (like to the situation sketched in Exercise 2.1). The equation for the rate of change of the amount of carbon dioxide (WW, in g CO2) is given as:

dWdt=PArea\frac{dW}{dt} = -P * Area

where PP is the rate of photosynthesis in g CO2 m-2 s-1, and AreaArea is the (single sided) surface area of a leaf or multiple leaves expressed in m2. PP is given by a so-called rectangular hyperbola:

P=vmCK+CP = v_m * \frac{C}{K + C}

where vmv_m is the maximum rate of photosynthesis, and CC is the actual carbon dioxide concentration in the chamber, and KK is the concentration at which the rate of photosynthesis is half as large as the maximum.

The concentration CC is calculated from:

C=WVolumeC = \frac{W}{Volume}

Where VolumeVolume stands for the volume of the chamber. The parameters of the model are given as:

Parameter Unit
Volume=0.1103Volume = 0.1 * 10^{-3} m3
Area=0.01Area = 0.01 m2
vm=0.001v_m = 0.001 g CO2 m-2 s-1
K=1.0K = 1.0 g CO2 m-3
Cini=10.0C_{ini} = 10.0 g CO2 m-3

Where CiniC_{ini} is the initial CO2 concentration in the closed chamber.

5.1 a
Implement the above described model in R, in a script that you call CUVET1.r. You can use the provided templates for that. Use “CUVET1” as the model name (thus, define the functions InitCUVET1, ParmsCUVET1, and RatesCUVET1).

The implementation of CUVET1:

# Define a function that returns a named vector with initial state values
InitCUVET1 <- function(W = 0){
  # Gather function arguments in a named vector
  y <- c(W = W)
  
  # Return the named vector
  return(y)
}

# Define a function that returns a named vector with parameter values
ParmsCUVET1 <- function(Volume = 0.0001, # volume of the chamber, m3
                        Area   = 0.01,   # area of leaves, m2
                        Vm   = 0.001,    # Maximum rate of photosynthesis VM in g of CO2 m-2 s-1
                        K      = 1.0,    # K is the M-M constant of photosynthesis
                                         # with respect to CO2 in same units as C
                        Cini   = 10.0){  # initial CO2 concentration in g CO2 m-3
  # Gather function arguments in a named vector
  y <- c(Volume = Volume, 
         Area = Area, 
         Vm = Vm, 
         K = K, 
         Cini = Cini)
  
  # Return named vector with values
  return(y)
}

# Define the function returning the rates of change of the state variables with respect to time
RatesCUVET1 <- function(t, y, parms){
  with(as.list(c(y, parms)),{
    # Compute auxiliary/helper functions

    # Concentration of CO2 inside the chamber
    C   <- W / Volume  
    # Net rate of photosynthesis (no respiration assumed)
    P <- Vm * C / (K + C)
    
    # Compute rate equations
    
    # Net rate of change of amount of CO2 in chamber
    dWdt <- - P * Area
    
    # Gather all rates of change in a vector
    # - the rates should be in the same order as the states (as specified in 'y')
    # - it can be a named vector, but does not need to be
    RATES <- c(dWdt = dWdt)
    
    # Optional: get in/out flow used to compute mass balances (or set MB <- NULL)
    # not included here (thus here use MB <- NULL), see template 3
    MB <- NULL

    # Optional: gather auxiliary variables that should be returned (or set AUX <- NULL)
    # - this should be a named vector or list!
    AUX <- c(C = C, P = P)
    
    # Return result as a list
    # - the first element is a vector with the rates of change (in the same order as 'y')
    # - all other elements are (optional) extra output, which should be named
    outList <- list(c(RATES, MB), # the rates of change
                    AUX) # additional output per time step
    return(outList)
  })
}
5.1 b
Solve the implemented model numerically using the ode function with KK values of 1, 10 and 0.1, and test if your model implementation works properly. The code below gives a starting point for how to do this.

# Set parameter values that influence the initial value of W
Volume <- 0.0001  # 0.1*10^-3 m3
Cini   <- 10.0    # initial CO2 concentration in g CO2 m-3

# Solve model numerically with specified parameter values and variation in parameter K
states_ode45_K1 <- ode(
  y = InitCUVET1(W = Volume * Cini),
  times = seq(0, 2000, by = 1),
  func = RatesCUVET1,
  parms = ParmsCUVET1(K = 1, 
                      Volume = Volume, 
                      Cini = Cini), # all others at their default values
  method = "ode45")

# Solve for other values of K
# ...


# Tips for plotting

# Plot dynamics of C as function of K:
plot(states_ode45_K10[, "time"], states_ode45_K10[, "C"],
  type = "l", xlim = c(0, 200), ylim = c(0, 11),
  xlab = "Time", ylab = "Conc. CO2", col = "black")

# tip to add lines to this graph, use the function lines() 
# provide the x and y details in a similar fashion as in the plot() function

# If you want to save your plot, you can do this in many file types. Here is an example for storig your plot as pdf
# you first create a pdf using pdf(), then you write the code that creates your plot, and then you close the file with dev.off()

# As an example:
pdf("CUVET1_comparingKvalues.pdf") # name of the pdf file with the plot

plot(states_ode45_K1[,"time"], states_ode45_K1[,"W"],      
     type = "l", xlim = c(0,200), ylim = c(0,11),
     xlab = "Time", ylab = "Amount of CO2", col = "black")

dev.off() # Close plotting devices

# The plot is saved to the working directory. Call getwd() to check!
# You can add as many things to the plot as you want:
# Once you call pdf() the file is created, and it only closes when dev.off() is run


Above in the example code you find the ode function call for a KK value of 1 (the restult of which is stored to an object with name states_ode45_K1). Evaluate this code and test if it works properly. Now model the change in CO2 concentration over time with a KK value of 10 and 0.1. To do so, copy-paste the ode function, change the name of the ode output (so that you don’t store the new results over the previous model run), and adjust the KK values.

# Set parameter values that influence the initial value of W
Volume <- 0.0001  # 0.1*10^-3 m3
Cini   <- 10.0    # initial CO2 concentration in g CO2 m-3

# Solve model numerically with specified parameter values and variation in parameter K
states_ode45_K1 <- ode(
  y = InitCUVET1(W = Volume * Cini),
  times = seq(0, 2000, by = 1),
  func = RatesCUVET1,
  parms = ParmsCUVET1(K = 1, 
                      Volume = Volume, 
                      Cini = Cini), # all others at their default values
  method = "ode45")

states_ode45_K10 <- ode(
  y = InitCUVET1(W = Volume * Cini),
  times = seq(0, 2000, by = 1),
  func = RatesCUVET1,
  parms = ParmsCUVET1(K = 10, 
                      Volume = Volume, 
                      Cini = Cini), # all others at their default values
  method = "ode45")

states_ode45_K.1 <- ode(
  y = InitCUVET1(W = Volume * Cini),
  times = seq(0, 2000, by = 1),
  func = RatesCUVET1,
  parms = ParmsCUVET1(K = 0.1, 
                      Volume = Volume, 
                      Cini = Cini), # all others at their default values
  method = "ode45")

# Plot dynamics of C as function of K:
plot(states_ode45_K10[, "time"], states_ode45_K10[, "C"],
  type = "l", xlim = c(0, 200), ylim = c(0, 11),
  xlab = "Time", ylab = "Conc. CO2", col = "black")
lines(states_ode45_K1[, "time"], states_ode45_K1[, "C"], col = "blue")
lines(states_ode45_K.1[, "time"], states_ode45_K.1[, "C"], col = "red")

# add legend without a box
legend("topright", legend = c("K = 10", "K = 1", "K = 0.1"),
       col = c(" black", "blue", "red"), lty = c(1, 1, 1), bty = "n")

5.1 c
What are the consequences of a lower KK value in terms of the photosynthetic rate of the leaf inside the chamber?

When KK is high (e.g. 10), photosynthesis is relatively slow which can be seen from the slow decrease in CO2 over time but also from the equation of PP (P=...P=...)– larger KK leads to a small value of C/(C+K)C/(C+K), in turn leading to a smaller P. The smaller the K, the faster the photosynthesis which can be seen from the faster drop in CO2 over time but also from the equation of P – the closer KK gets to 0, the larger the value of (C/(C+K)(C/(C+K), in turn leading to a larger PP.

5.1 d
Is it possible that the concentration in the chamber becomes negative? Answer this question for the real system and speculate whether or when for the model would return negative CO2 values.

Negative concentrations are not physically possible. However, in the model it is possible! You may try this by setting the parameter CiniC_{ini} to a negative value.

5.1 e
Let’s set KK to 0. What happens to the specific photosynthetic rate of the leaf inside the chamber? Please give your answer in relation to the equation for PP and describe in your own words what happens.

When K equals 0, K drops out of the ratio (C/(C+K)C/(C+K)) in the photosynthesis equation, and this ratio becomes 1 since C is in both the numerator and denominator, making P independent of the CO2 concentration in the chamber. One exception exist, which is when C is 0, then the ratio cannot be determined and will produce an error due to the division by zero. In other words, the photosynthesis rate P equals the maximum rate of photosynthesis vmv_m when K=0K = 0.

5.1 f
Verify your answers by adding a new scenario to your code where K=0K=0. Add this result to your graph. Is this the response you expected? Why (not)?

states_ode45_K0 <- ode(
  y = InitCUVET1(W = Volume * Cini),
  times = seq(1, 2000, by = 1),
  func = RatesCUVET1,
  parms = ParmsCUVET1(Volume = Volume, Cini = Cini, K = 0), 
  method = "ode45"
)

plot(x = states_ode45_K1[, "time"], y = states_ode45_K1[, "C"],
  type = "l", xlim = c(0, 200), ylim = c(0, 11),
  xlab = "Time", ylab = "Conc. CO2", col = "blue")
lines(x = states_ode45_K10[, "time"], y =states_ode45_K10[, "C"], col = "black")
lines(x = states_ode45_K.1[, "time"], y =states_ode45_K.1[, "C"], col = "red")
lines(x = states_ode45_K0[, "time"], y =states_ode45_K0[, "C"], col = "green3")

# add legend without a box
legend("topright", legend = c("K = 10", "K = 1", "K = 0.1", "K = 0"),
  col = c("black", "blue", "red", "green3"), lty = 1, bty = "n")

Exercise 5.2

As already explained in exercise 2.2, we measure leaf photosynthesis in a flow-through chamber. To this purpose the difference between the carbon dioxide concentration in the inflow and the outflow is measured in time. The rate of change of CO2 in the chamber becomes:

dWdt=q1q2PAreaq1=cinflowq2=Cflow\frac{dW}{dt} = q_1 - q_2 - P * Area \\ q_1 = c_{in} * flow \\ q_2 = C * flow

Here, CC is the concentration in the chamber and therefore also the CO2 concentration in the outflowing air. The new parameters of the model are set with the following default values:

  • flowflow = 10.0 * 10-6 m3 s-1 (this can e set by the equipment)
  • cinc_{in} = 1.0 g CO2 m-3
  • CiniC_{ini} = 0.0 g CO2 m-3, which is the initial CO2 concentration in the chamber at t=0.
5.2 a
Copy the CUVET1.r file and rename it CUVET2.r. Change the model name to CUVET2 and adapt the model accordingly.

The implementation of CUVET2:

# Define a function that returns a named vector with initial state values
InitCUVET2 <- function(W = 0){
  # Gather function arguments in a named vector
  y <- c(W = W)
  
  # Return the named vector
  return(y)
}

# Define a function that returns a named vector with parameter values
ParmsCUVET2 <- function(Volume = 0.0001,  # volume of the chamber, m3
                        Area   = 0.01,    # area of leaves, m2
                        Flow   = 0.00001, # through flow of air, m3/s
                        Cin    = 1.0,     # CO2 concentration of the air flowing in (g CO2 m-3)
                        Vm     = 0.001,   # Maximum rate of photosynthesis VM in g of CO2 m-2 s-1
                        K      = 1.0,     # K is the M-M constant of photosynthesis
                                          # with respect to CO2 in same units as C
                        Cini   = 10.00){  # initial CO2 concentration in g CO2 m-3
  # Gather function arguments in a named vector
  y <- c(Volume = Volume, 
         Area = Area, 
         Flow = Flow, 
         Cin = Cin, 
         Vm = Vm, 
         K = K, 
         Cini = Cini)
  
  # Return named vector with values
  return(y)
}

# Define the function returning the rates of change of the state variables with respect to time
RatesCUVET2 <- function(t, y, parms){
  with(as.list(c(y, parms)),{
    # Compute auxiliary/helper functions
    
    # Concentration of CO2 inside the chamber
    C <- W / Volume  
    # Net rate of photosynthesis (no respiration assumed)
    P <- Vm * C / (K + C)
    
    CIN  <- Cin * Flow # Inflow
    COUT <- C * Flow   # Outflow

    # Compute rate equations
    
    # Net rate of change of amount of CO2 in chamber
    dWdt <- CIN - COUT - P * Area        

    # Gather all rates of change in a vector
    RATES <- c(dWdt)
    
    # Optional: get in/out flow used to compute mass balances (or set MB <- NULL)
    MB <- NULL
    
    # Optional: gather auxiliary variables (as named vector) that should be returned
    AUX <- c(C = C, P = P, CIN = CIN, COUT = COUT)
    
    # Return result as a list
    outList <- list(c(RATES, MB), # first element: the rates of change
                    AUX) # additional output per time step
    return(outList)
  })
}
5.2 b

Test whether the updated CUVET2 model runs, and solve the model for model for some different KK values, e.g. K=1K=1; K=10K=10; K=0.1K=0.1 (for this see exercise 5.1b). Plot the restults in a plot like the one constructed in exercise 5.1b (thus: time on the x-axis, concentration CO2 on the y-axis, and separate lines for the separate values of K).

What are the implications of these values for the CC concentration in the chamber, and for leaf photosynthesis when concentrations become constant? Explain.

Solving the model for different values of KK:

# Set parameter values that influence the initial value of W
Volume <- 0.0001 # m3
Cini   <- 0.0    # initial CO2 concentration in g CO2 m-3

# Solve model numerically with specified parameter values and variation in parameter K
states_ode45_K1 <- ode(
  y = InitCUVET2(W = Volume * Cini),
  times = seq(0, 200, by = 1),
  func = RatesCUVET2,
  parms = ParmsCUVET2(K = 1,
                      Volume = Volume,
                      Cini = Cini), # all others at their default values
  method = "ode45")

states_ode45_K10 <- ode(
  y = InitCUVET2(W = Volume * Cini),
  times = seq(0, 200, by = 1),
  func = RatesCUVET2,
  parms = ParmsCUVET2(K = 10,
                      Volume = Volume,
                      Cini = Cini), # all others at their default values),
  method = "ode45")

states_ode45_K.1 <- ode(
  y = InitCUVET2(W = Volume * Cini),
  times = seq(0, 200, by = 1),
  func = RatesCUVET2,
  parms = ParmsCUVET2(K = 0.1,
                      Volume = Volume,
                      Cini = Cini), # all others at their default values),
  method = "ode45")

# Plot dynamics of C as function of K:
plot(states_ode45_K10[, "time"], states_ode45_K10[, "C"],
  type = "l", xlim = c(0, 200), ylim = c(0, 1.2),
  xlab = "Time", ylab = "Conc. CO2", col = "black")
lines(states_ode45_K1[, "time"], states_ode45_K1[, "C"], col = "blue")
lines(states_ode45_K.1[, "time"], states_ode45_K.1[, "C"], col = "red")

# add legend without a box
legend("topright", legend = c("K = 10", "K = 1", "K = 0.1"),
       col = c(" black", "blue", "red"), lty = c(1, 1, 1), bty = "n")

With a larger KK value, the photosynthetic rate becomes smaller, hence the uptake rate of CO2 from the air by the leaf in the chamber is smaller. When the system is in a (dynamic) equilibrium the resulting concentrations of CO2 will therefore be higher.

5.2 c

The expression for the dynamic equilibrium value of WW, i.e. the CequilC_{equil} concentration, can be rewritten in the form of a quadratic function, which can be solved by the so-called “a-b-c” formula:

x1,2=b±b24ac2ax_{1,2} = \frac{-b \pm \sqrt{b^2 - 4 * a * c}}{2 * a}

Derivation:

dWdt=q1q2PArea\frac{dW}{dt} = q_1 - q_2 - P * Area Set rate to zero and fill in the equations:

0=flowcinflowCvmCC+KArea0 = flow * c_{in} - flow * C - v_m * \frac{C}{C + K} * Area Multiply by (K+C) to eliminate C:

0=flowcin(C+K)flowC(C+K)vmCArea0 = flow * c_{in} * (C + K) - flow * C * (C + K) - v_m * C * Area

Eliminate parenthesis:

0=flowcinC+flowcinKflowC2flowCKvmCArea0 = flow * c_{in} * C + flow * c_{in} * K - flow * C^2 - flow * C * K - v_m * C * Area

Divide by flow to simplify:

0=cinC+cinKC2CKvmCAreaflow0 = c_{in} * C + c_{in} * K - C^2 - C * K - \frac{v_m * C * Area}{flow}

Re-arrange and combine terms:

0=C2+(cinKvmAreaflow)C+cinK0 = -C^2 + (c_{in} - K - \frac{v_m * Area}{flow}) * C + c_{in} * K

This is a so-called quadratic function with the form ax2+bx+ca * x^2 + b * x + c, which can be solved with the abc-formula. Note that the variable (Capital!) CC (equilibrium C concentration) equals x1,2x_{1,2} in the abc-formula, and that in the abc formula a=1a = - 1, b=CinKvmAreaflowb = C_{in} - K - \frac{v_m * Area}{flow}, and c=CinKc = C_{in} * K.

Program the calculation of CequilC_{equil} (make first a separate equation for bb, that simplifies a bit) in a separate function with the name “EquilCUVET2” that accepts the model parameters as argument. Then calculate the equilibria for the KK values 0.1, 1 and 10 (as done for question b) and add these to the corresponding plot using the lines function. Ensure to use arguments lty = 2 and lwd = 2 to display a thick dashed line. Does your analytical solution for the equilibrium CO2 in the chamber indeed fit with the simulated dynamics?

First, define a function (EquilCUVET2) that returns the equilibria (given parameter values as input):

EquilCUVET2 <- function(param){
  with(as.list(param),{
    # algebraic solution of the steady state equation (C-equilibrium)
    B   <- K - Cin + Vm * Area / Flow
    CEQUIL <- -B/2.0 + sqrt((B/2.0)^2 + Cin * K)
    return(CEQUIL)
  })
}

Then, compute the equilibria for the K values 0.1, 1 and 10:

Volume <- 0.0001 # m3
Cini   <- 0.0      # initial CO2 concentration in g CO2 m-3
EqK0.1 <- EquilCUVET2(ParmsCUVET2(K = 0.1, Volume = Volume, Cini = Cini))
EqK1.0 <- EquilCUVET2(ParmsCUVET2(K = 1,   Volume = Volume, Cini = Cini))
EqK10  <- EquilCUVET2(ParmsCUVET2(K = 10,  Volume = Volume, Cini = Cini))

Lastly, plot the results

par(mfrow = c(2, 1), # 2 rows, 1 column
    mar = c(2, 4, 0.1, 0.1)) # with margins = c(bottom, left, top, right)

plot(states_ode45_K10[, "time"], states_ode45_K10[, "C"],
  type = "l", xlim = c(0, 50), ylim = c(0, 1.2), 
  xlab = "Time", ylab = "Conc. CO2", lty = 1, lwd = 1, col = "black")
lines(c(-1E6, 1E6), c(EqK10, EqK10), lty = 2, lwd = 2, col = "black")
lines(states_ode45_K1[, "time"], states_ode45_K1[, "C"], lty = 1, lwd = 1, col = "blue")
lines(c(-1E6, 1E6), c(EqK1.0, EqK1.0), lty = 2, lwd = 2, col = "blue")
lines(states_ode45_K.1[, "time"], states_ode45_K.1[, "C"], lty = 1, lwd = 1, col = "red")
lines(c(-1E6, 1E6), c(EqK0.1, EqK0.1), lty = 2, lwd = 2, col = "red")

legend("topleft", legend = c("K=10", "K=1.0", "K=0.1"), 
       col = c("black", "blue", "red"), lty = 1, bty = "n")

par(mar = c(4, 4, 0.1, 0.1))
plot(states_ode45_K10[, "time"], states_ode45_K10[, "P"],
  type = "l", xlim = c(0, 50), ylim = c(0, 8e-4), 
  xlab = "Time", ylab = "Rate of photosynthesis", col = "black")
lines(states_ode45_K1[, "time"], states_ode45_K1[, "P"], col = "blue")
lines(states_ode45_K.1[, "time"], states_ode45_K.1[, "P"], col = "red")

legend("topleft", legend = c("K=10", "K=1.0", "K=0.1"), 
       col = c("black", "blue", "red"), lty = 1, bty = "n")

Eventually, the dynamic simulations result in the same equilibrium as the analytic result, providing confidence in the result. Note that the system reaches the equilibrium quicker when KK is 0.1 when compared to a KK of 10.

Exercise 5.3

What is the time coefficient for our system (see scripts developed for exercise 5.1) in a closed chamber? In this case, the equilibrium situation is achieved when the air in the cuvet does not contain CC anymore, i.e. C=0C=0.

5.3 a
First, estimate the time coefficient by assuming that specific photosynthesis rates are equal to vmv_m, irrespective of the amount of CC (WW) in the chamber.

The time coefficient of depletion can be estimated in various ways, depending on the precision of the definition. When assuming that the leaf photosynthesizes is equal to the maximum rate Vm all the time, irrespective of the CO2 concentration, we can estimate TC as follows: The initial amount of CO2 equals VolumeCiniVolume * C_{ini} or 1 * 10-3 g. The rate of depletion then equals vmAreav_m * Area or 1 * 10-5 g s-1. The time to reach the equilibrium is then calculated from the ratio: TC = 100 s.

5.3 b
This approximation is incorrect since leaf specific photosynthesis rates decreases when WW gradually becomes lower in the leaf chamber. Therefore, find an analytical expression for the time coefficient. Hint: this time coefficient TC will change (with time) since it responds to a decrease in WW. Rewrite the rate equation for dWdt\frac{dW}{dt} and express the equation as function of WW. For this you need to rework the equation to recognize the component that is multiplied with WW.

However, dW/dt is not constant and TC varies because WW decreases over time. To account for this, with TC=WdW/dtTC = \frac{W}{dW/dt}, we rewrite dW/dt as a function of WW:

P×AreaP × Area

or

Area×vm×C(C+K)\frac{Area × v_m × C}{(C + K)}

or

Area×vm×(W/Volume)(W/Volume)+K\frac{Area × v_m × (W/Volume)}{(W/Volume ) + K}

if we multiply by 1, or more precisely by VOLUME/VOLUME, we get:

Area×vm×WW+K×Volume\frac{Area × v_m × W}{W + K × Volume}

since:

WdW/dt=W(Area×vm×W)/(W+K×Volume)\frac{W}{dW/dt} = \frac{W}{(Area × v_m × W) / (W + K × Volume)}

and thus:

TC=W(Area×vm×W)/(W+K×Volume)TC = \frac{W}{(Area × v_m × W) / (W + K × Volume)}

where W cancels:

TC=1(Area×vm×1)/(W+K×Volume)TC = \frac{1}{(Area × v_m × 1) / (W + K × Volume)}

or,

TC=W+K×VolumeArea×vmTC = \frac{W + K × Volume}{Area × v_m}

Remarkably, the value of the time coefficient (τ\tau) decreases as W decreases, instead of being constant.

5.3 c
Once you have this equation, you can estimate the upper and lower limits of TC. Hint: Do not use code yet but take a good look at the equation and see how WW and KK affect the TC.

The upper asymptotic level for τ\tau, so where KK is very small, is W/(Areavm)W/(Area * v_m) which is identical to our earlier calculation, because W=VolumeCiniW = Volume * C_{ini}. The lower asymptotic limit for τ\tau, so where WW has become very small, is (KVolume)/(Areavm)(K * Volume) / (Area * v_m). For the smallest value of KK (=0.1) this is equal to 1 second. We may conclude that, although the model is quite simple, the determination of the time coefficient of the model and the appropriate time step is not easy and depends on parameter values. This is especially important to know when we would use Euler as integration method.

5.3 d

Add the formula for the TC as an auxiliary variable to the RatesCUVET1 function you have created above (exercise 5.1a). Ensure that you add this TC variable to the named list (as auxiliary information) that is returned by the function.

Solve the model for all default values, but with KK values 0.1, 1 and 10. Check exercise 5.1b on how this was done. Make 4 informative plots (also check exercise 5.1b for this): (1) with time (on the x-axis) vs. CO2 concentration in the chamber; (2) with the CO2 concentration on x-axis and rate of photosynthesis (PP) on the y-axis; (3) with time on the x-axis and TC on the y-axis; and (4) with WW vs. TCTC. Make sure that all plots have 3 lines, one for each of the three KK values (0.1, 1 and 10).

Added parts to function RatesCUVET1 as already defined above in exercise 5.1a):

# Compute the time coefficient
TC <- (W + K * Volume ) / (Area * Vm)

# Gather auxiliary information
AUX <- c(C = C, P = P, TC = TC)

Full function definition with these lines added:

# Define the function returning the rates of change of the state variables with respect to time
RatesCUVET1 <- function(t, y, parms){
  with(as.list(c(y, parms)),{
    # Compute auxiliary/helper functions

    # Concentration of CO2 inside the chamber
    C   <- W / Volume  
    # Net rate of photosynthesis (no respiration assumed)
    P <- Vm * C / (K + C)
    
    # Compute rate equations
    
    # Net rate of change of amount of CO2 in chamber
    dWdt <- - P * Area
    
    # Gather all rates of change in a vector
    # - the rates should be in the same order as the states (as specified in 'y')
    # - it can be a named vector, but does not need to be
    RATES <- c(dWdt = dWdt)
    
    # Optional: get in/out flow used to compute mass balances (or set MB <- NULL)
    # not included here (thus here use MB <- NULL), see template 3
    MB <- NULL

    # Compute the time coefficient
    TC <- (W + K * Volume ) / (Area * Vm)

    # Optional: gather auxiliary variables that should be returned (or set AUX <- NULL)
    # - this should be a named vector or list!
    AUX <- c(C = C, P = P, TC = TC)
    
    # Return result as a list
    # - the first element is a vector with the rates of change (in the same order as 'y')
    # - all other elements are (optional) extra output, which should be named
    outList <- list(c(RATES, MB), # the rates of change
                    AUX) # additional output per time step
    return(outList)
  })
}

We can plot the TC after solving the model in the same way we did in exercise 5.1b):

Volume <- 0.0001 # m3
Cini   <- 10.0   # initial CO2 concentration in g CO2 m-3

states_ode45_K1 <- ode(
  y = InitCUVET1(W = Volume * Cini),
  times = seq(0, 2000, by = 1),
  func = RatesCUVET1,
  parms = ParmsCUVET1(K = 1, 
                      Volume = Volume, 
                      Cini = Cini), # all others at their default values
  method = "ode45")

states_ode45_K10 <- ode(
  y = InitCUVET1(W = Volume * Cini),
  times = seq(0, 2000, by = 1),
  func = RatesCUVET1,
  parms = ParmsCUVET1(K = 10, 
                      Volume = Volume, 
                      Cini = Cini), # all others at their default values
  method = "ode45")

states_ode45_K.1 <- ode(
  y = InitCUVET1(W = Volume * Cini),
  times = seq(0, 2000, by = 1),
  func = RatesCUVET1,
  parms = ParmsCUVET1(K = 0.1, 
                      Volume = Volume, 
                      Cini = Cini), # all others at their default values
  method = "ode45")

Now we can plot it:

par(mfrow = c(2, 2), mar = c(4, 4, 1, 1)) # with mar=c(bottom, left, top, right)

plot(states_ode45_K10[, "time"], states_ode45_K10[, "C"],
  type = "l", xlim = c(0, 200), ylim = c(0, Cini), xlab = "Time", ylab = "CO2, g/m3", col = "black")
lines(states_ode45_K1[, "time"], states_ode45_K1[, "C"], col = "blue")
lines(states_ode45_K.1[, "time"], states_ode45_K.1[, "C"], col = "red")

plot(states_ode45_K10[, "C"], states_ode45_K10[, "P"],
  type = "l", xlim = c(0, 10), ylim = c(0, 10E-4),
  xlab = "Conc. CO2", ylab = "Rate of photosynthesis", lty = 1, lwd = 1, col = "black")
lines(states_ode45_K1[, "C"], states_ode45_K1[, "P"], lty = 1, lwd = 1, col = "blue")
lines(states_ode45_K.1[, "C"], states_ode45_K.1[, "P"], lty = 1, lwd = 1, col = "red")

plot(states_ode45_K10[, "time"], states_ode45_K10[, "TC"],
  type = "l", xlim = c(0, 200), ylim = c(0, 200),
  xlab = "Time", ylab = "Time coefficient", lty = 1, lwd = 1, col = "black")
lines(states_ode45_K1[, "time"], states_ode45_K1[, "TC"], lty = 1, lwd = 1, col = "blue")
lines(states_ode45_K.1[, "time"], states_ode45_K.1[, "TC"], lty = 1, lwd = 1, col = "red")

# add legend without a box
legend("right", legend = c("K = 10", "K = 1", "K = 0.1"), 
       col = c(" black", "blue", "red"), lty = c(1, 1, 1), bty = "n")

plot(states_ode45_K10[, "W"], states_ode45_K10[, "TC"],
  type = "l", xlim = c(0, Volume * Cini), ylim = c(0, 200),
  xlab = "W", ylab = "Time coefficient", lty = 1, lwd = 1, col = "black")
lines(states_ode45_K1[, "W"], states_ode45_K1[, "TC"], lty = 1, lwd = 1, col = "blue")
lines(states_ode45_K.1[, "W"], states_ode45_K.1[, "TC"], lty = 1, lwd = 1, col = "red")

The plot of chamber concentration CC versus time, which shows a decreasing pattern with the abscissa (“x-axis”) as asymptote. The smaller the KK-value, the steeper the curve. For a very small value of KK, an almost linear decrease occurs until the CO2 is practically depleted. The plot of PP versus CC shows the three hyperbolic Michaelis-Menten relationships, as they evolve over the time of the simulation period. There is a numerical problem connected with the fact that numerically negative values of CC may occur, even though this is physically not possible. In the negative range of CC the hyperbolic relationship has a vertical asymptote at C=KC=-K. For even more negative values of CC, the function value becomes positive again other “leg” of the hyperbola).

Solutions as R script

Download here the code as shown on this page in a separate .r file.