This Rmarkdown file is part of the rsofun package (vignettes/versions_pmodel.Rmd).

Environment

Load the rsofun package. This contains all the necessary wrapper functions to set up and run SOFUN and read its output.

## Warning: replacing previous import 'dplyr::intersect' by
## 'lubridate::intersect' when loading 'rsofun'
## Warning: replacing previous import 'dplyr::union' by 'lubridate::union'
## when loading 'rsofun'
## Warning: replacing previous import 'dplyr::setdiff' by 'lubridate::setdiff'
## when loading 'rsofun'
## Warning: replacing previous import 'purrr::invoke' by 'rlang::invoke' when
## loading 'rsofun'
## Warning: replacing previous import 'purrr::flatten_int' by
## 'rlang::flatten_int' when loading 'rsofun'
## Warning: replacing previous import 'purrr::flatten_dbl' by
## 'rlang::flatten_dbl' when loading 'rsofun'
## Warning: replacing previous import 'purrr::list_along' by
## 'rlang::list_along' when loading 'rsofun'
## Warning: replacing previous import 'purrr::%||%' by 'rlang::%||%' when
## loading 'rsofun'
## Warning: replacing previous import 'purrr::flatten_chr' by
## 'rlang::flatten_chr' when loading 'rsofun'
## Warning: replacing previous import 'purrr::prepend' by 'rlang::prepend'
## when loading 'rsofun'
## Warning: replacing previous import 'purrr::flatten' by 'rlang::flatten'
## when loading 'rsofun'
## Warning: replacing previous import 'Metrics::ll' by 'rlang::ll' when
## loading 'rsofun'
## Warning: replacing previous import 'purrr::rep_along' by 'rlang::rep_along'
## when loading 'rsofun'
## Warning: replacing previous import 'purrr::splice' by 'rlang::splice' when
## loading 'rsofun'
## Warning: replacing previous import 'purrr::modify' by 'rlang::modify' when
## loading 'rsofun'
## Warning: replacing previous import 'purrr::flatten_lgl' by
## 'rlang::flatten_lgl' when loading 'rsofun'
## Warning: replacing previous import 'purrr::as_function' by
## 'rlang::as_function' when loading 'rsofun'
## Warning: replacing previous import 'purrr::%@%' by 'rlang::%@%' when
## loading 'rsofun'
## Warning: package 'dplyr' was built under R version 3.3.2

Run different implementations

## R, Vcmax based on Wang Han's formulation
pmodel_wanghan <- purrr::map( as.list( seq( 0, 35, length.out = 100 ) ), 
  ~rpmodel( tc = ., vpd = 1000, co2 = 400, elv = 0, kphio = 0.05, fapar = 1.0, ppfd = 800, method="wanghan", do_ftemp_kphio = FALSE ) 
  )

pmodel_smith <- purrr::map( as.list( seq( 0, 35, length.out = 100 ) ), 
  ~rpmodel( tc = ., vpd = 1000, co2 = 400, elv = 0, kphio = 0.257, fapar = 1.0, ppfd = 800, method="smith", do_ftemp_kphio = FALSE ) 
  )

## Vcmax based on Nick's code
source("~/optimal_vcmax_R/calc_optimal_vcmax.R")
pmodel_smithcode <- purrr::map( as.list( seq( 0, 35, length.out = 100 ) ), 
  ~calc_optimal_vcmax( tg_c = ., z = 0, vpdo = 1, cao = 400, paro = 800, q0 = 0.257, theta = 0.85 )
  )

Evaluation

Below, I’m comparing different variables calculated in the different implementations, as a function of temperature (to which it’s acclimated to). ‘rsofun standard’ refers to what is implemented in rsofun, based on Wang Han et al., 2017 and originally adopted from the GePiSaT code. ‘Smith my implementation’ is based on Beni’s adoptation of Nick’s code within rsofun, ‘Smith original’ is Nick Smith’s code from github (run with PAR and VPD not additionally adjusted for elevation-effects). The temperature-dependence of quantum yield efficiency is not accounted for in any of the calculations.

Michaelis-Menten K

kmm_smithcode <- pmodel_smithcode %>% purrr::map_dbl("km")
kmm_wanghan   <- pmodel_wanghan   %>% purrr::map_dbl("kmm")
kmm_smith     <- pmodel_smith     %>% purrr::map_dbl("kmm")

plot(  seq( 0, 35, length.out = 100 ), kmm_wanghan, type = "l", xlab = "Temperature (deg C)", ylab = "Michaelis-Menten K", lwd=6 )
lines( seq( 0, 35, length.out = 100 ), kmm_smith, col="blue", lwd=3 )
lines( seq( 0, 35, length.out = 100 ), kmm_smithcode, col="red" )
legend( "topright", c("rsofun standard", "Smith my implementation", "Smith original"), lty = 1, col = c("black", "blue", "red"), lwd=c(6,3,1), bty = "n")

\(c_i\)

ci_smithcode <- pmodel_smithcode %>% purrr::map_dbl("ci")
ci_wanghan   <- pmodel_wanghan   %>% purrr::map_dbl("ci")
ci_smith     <- pmodel_smith     %>% purrr::map_dbl("ci")

plot(  seq( 0, 35, length.out = 100 ), ci_wanghan, type = "l", xlab = "Temperature (deg C)", ylab = "ci", lwd=6 )
lines( seq( 0, 35, length.out = 100 ), ci_smith, col="blue", lwd=3 )
lines( seq( 0, 35, length.out = 100 ), ci_smithcode, col="red" )
legend( "topright", c("rsofun standard", "Smith my implementation", "Smith original"), lty = 1, col = c("black", "blue", "red"), lwd=c(6,3,1), bty = "n")

\(c_i:c_a\)

chi_smithcode <- pmodel_smithcode %>% purrr::map_dbl("chi")
chi_wanghan   <- pmodel_wanghan   %>% purrr::map_dbl("chi")
chi_smith     <- pmodel_smith     %>% purrr::map_dbl("chi")

plot(  seq( 0, 35, length.out = 100 ), chi_wanghan, type = "l", xlab = "Temperature (deg C)", ylab = "ci:ca", lwd=6 )
lines( seq( 0, 35, length.out = 100 ), chi_smith, col="blue", lwd=3 )
lines( seq( 0, 35, length.out = 100 ), chi_smithcode, col="red" )
legend( "topright", c("rsofun standard", "Smith my implementation", "Smith original"), lty = 1, col = c("black", "blue", "red"), lwd=c(6,3,1), bty = "n")

m (=mj)

m_smith     <- pmodel_smith     %>% purrr::map_dbl("m")
m_smithcode <- pmodel_smithcode %>% purrr::map_dbl("m")

plot(  seq( 0, 35, length.out = 100 ), m_smith, type = "l", xlab = "Temperature (deg C)", ylab = "m", lwd=6 )
lines( seq( 0, 35, length.out = 100 ), m_smithcode, col="red" )
legend( "topright", c("Smith my implementation", "Smith original"), lty = 1, col = c("black", "red"), lwd=c(6,1), bty = "n")

mc

m_smith     <- pmodel_smith     %>% purrr::map_dbl("mc")
m_smithcode <- pmodel_smithcode %>% purrr::map_dbl("mc")

plot(  seq( 0, 35, length.out = 100 ), m_smith, type = "l", xlab = "Temperature (deg C)", ylab = "m", lwd=6 )
lines( seq( 0, 35, length.out = 100 ), m_smithcode, col="red" )
legend( "topright", c("Smith my implementation", "Smith original"), lty = 1, col = c("black", "red"), lwd=c(6,1), bty = "n")

\(\omega\)

omega_smith     <- pmodel_smith     %>% purrr::map_dbl("omega")
omega_smithcode <- pmodel_smithcode %>% purrr::map_dbl("omega")

plot(  seq( 0, 35, length.out = 100 ), omega_smith, type = "l", xlab = "Temperature (deg C)", ylab = "m", lwd=6 )
lines( seq( 0, 35, length.out = 100 ), omega_smithcode, col="red" )
legend( "topright", c("Smith my implementation", "Smith original"), lty = 1, col = c("black", "red"), lwd=c(6,1), bty = "n")

\(\omega^\ast\)

omega_star_smith     <- pmodel_smith     %>% purrr::map_dbl("omega_star")
omega_star_smithcode <- pmodel_smithcode %>% purrr::map_dbl("omega_star")

plot(  seq( 0, 35, length.out = 100 ), omega_star_smith, type = "l", xlab = "Temperature (deg C)", ylab = "m", lwd=6 )
lines( seq( 0, 35, length.out = 100 ), omega_star_smithcode, col="red" )
legend( "topright", c("Smith my implementation", "Smith original"), lty = 1, col = c("black", "red"), lwd=c(6,1), bty = "n")

f\(_{temp}\)

ftemp_inst_vcmax_smith     <- pmodel_smith     %>% purrr::map_dbl("ftemp_inst_vcmax")
ftemp_inst_vcmax_smithcode <- pmodel_smithcode %>% purrr::map_dbl("ftemp_vcmax")

plot(  seq( 0, 35, length.out = 100 ), ftemp_inst_vcmax_smith, type = "l", xlab = "Temperature (deg C)", ylab = "m", lwd=6 )
lines( seq( 0, 35, length.out = 100 ), ftemp_inst_vcmax_smithcode, col="red" )
legend( "topleft", c("Smith my implementation", "Smith original"), lty = 1, col = c("black", "red"), lwd=c(6,1), bty = "n")

Vcmax

vcmax_smithcode <- pmodel_smithcode %>% purrr::map_dbl("vcmax_star")
vcmax_wanghan   <- pmodel_wanghan   %>% purrr::map_dbl("vcmax")
vcmax_smith     <- pmodel_smith     %>% purrr::map_dbl("vcmax_star")

plot(  seq( 0, 35, length.out = 100 ), vcmax_smith, type = "l", xlab = "Temperature (deg C)", ylab = "Vcmax", lwd=6, ylim=c(0,max(vcmax_smith)) )
lines( seq( 0, 35, length.out = 100 ), vcmax_wanghan, col="blue", lwd=3 )
lines( seq( 0, 35, length.out = 100 ), vcmax_smithcode, col="red" )
legend( "topleft", c("Smith my implementation", "rsofun standard, with Jmax limitation (Wang Han)", "Smith original"), lty = 1, col = c("black", "blue", "red"), lwd=c(6,3,1), bty = "n" )

Light use efficiency

lue_wanghan   <- pmodel_wanghan   %>% purrr::map_dbl("lue")
lue_smith     <- pmodel_smith     %>% purrr::map_dbl("lue")

plot(  seq( 0, 35, length.out = 100 ), lue_smith, type = "l", xlab = "Temperature (deg C)", ylab = "lue", lwd=6, ylim=c(0,max(lue_smith)) )
lines( seq( 0, 35, length.out = 100 ), lue_wanghan, col="blue", lwd=3 )
legend( "topright", c("Smith my implementation", "rsofun standard, with Jmax limitation (Wang Han)"), lty = 1, col = c("black", "blue", "red"), lwd=c(6,3,1), bty = "n")