geco-bern / rsofun

Implements the Simulating Optimal FUNctioning framework for site-scale simulations of ecosystem processes, including model calibration. It contains Fortran 90 modules for the P-model, SPLASH, and BiomeE models.
https://geco-bern.github.io/rsofun/
GNU General Public License v3.0
21 stars 28 forks source link

Bug in AET #205

Closed stineb closed 6 months ago

stineb commented 6 months ago

We have a bug in AET. This is shown in its annual pattern. It cannot - by definition - be larger than PET.

Run this to reproduce:

library(rsofun)
library(dplyr)
library(ggplot2)

params_modl <- list(
  kphio              = 0.04998,    # setup ORG in Stocker et al. 2020 GMD
  kphio_par_a        = 0.0,        # set to zero to disable temperature-dependence of kphio
  kphio_par_b        = 1.0,
  soilm_thetastar    = 0.6 * 240,  # to recover old setup with soil moisture stress
  soilm_betao        = 0.0,
  beta_unitcostratio = 146.0,
  rd_to_vcmax        = 0.014,      # value from Atkin et al. 2015 for C3 herbaceous
  tau_acclim         = 30.0,
  kc_jmax            = 0.41
)

# run the model for these parameters
output <- rsofun::runread_pmodel_f(
  p_model_drivers,
  par = params_modl
)

ggplot(aes(x = date),
       data = output$data[[1]] |>
         slice(1:365)) +
  geom_line(aes(y = aet), color = "royalblue") +
  geom_line(aes(y = pet), color = "tomato")
Screenshot 2024-02-27 at 13 32 11
stineb commented 6 months ago

The bug is related to the use of prescribed net radiation. I'm on it...

stineb commented 6 months ago

I could not find out why this happens. The calculation of tile_fluxes%canopy%daet in waterbal_splash.mod.f90 does not use any variable that is not properly defined when using net radiation from forcing, as far as I can see. Yet, values are completely bonkers. I'm deactivating the option to use prescribed net radiation in combination with the SPLASH water balance.