Skip to content

BiomeEP: expose additional parameters to R#328

Open
fabern wants to merge 40 commits into
biomee-attenuate-aggress-cohort-fusionfrom
biomee-redefine-parameters
Open

BiomeEP: expose additional parameters to R#328
fabern wants to merge 40 commits into
biomee-attenuate-aggress-cohort-fusionfrom
biomee-redefine-parameters

Conversation

@fabern

@fabern fabern commented Mar 16, 2026

Copy link
Copy Markdown
Member

This PR exposes additional BiomeEP parameters to R, making them amenable to calibration.

Status

Some of the inputs parameters were previously ignored [1], while other parameters and initial conditions were hardcoded [2],[3],[4].
For the initial conditions, many of them were derived based on parameter values for convenience. While this may seem convenient and pragmatic, it does not allow to stop and restart a simulation, since the user is not able to restart it by prescribing all the state variables. The convenience function have now been moved to the R part of the code. They are only triggered if the corresponding initial conditions are not explicitly provided. This allows to recover the former behavior by default but enables the users to control the initial conditions with more granularity if desired.
Lastly, a bug was present since init_cohort_nsc was not taken into account.

[1]: in params_species: phenotype,Vmax,alphaBM,leafLS,lAImax,CNleaf0,gamma_L,Vannual, betaON,betaOFF,leaf_size
[2]:

real :: beta = 146.0 ! Unit cost of carboxylation (dimensionless)
! Apply identical temperature ramp parameter for all PFTs
real :: tau_acclim = 30.0 ! acclimation time scale of photosynthesis (d)
real :: soilm_thetastar = 0.6 * 250
real :: soilm_betao = 0.0
real :: rd_to_vcmax = 0.014 ! Ratio of Rdark to Vcmax25, number from Atkin et al., 2015 for C3 herbaceous
real :: kc_jmax = 0.41 ! Jmax cost ratio
! these should be species-specific, temporary solution to put them here
real :: kphio = 0.05 ! quantum yield efficiency at optimal temperature, phi_0 (Stocker et al., 2020 GMD Eq. 10 and Eq. 20)
real :: kphio_par_a = 0.0 ! shape parameter of temperature-dependency of quantum yield efficiency
real :: kphio_par_b = 25.0 ! optimal temperature of quantum yield efficiency (deg C)

[3]: Initial states were not exposed to R in init_cohort: init_cohort_age and the nitrogen pools: init_cohort_bl_n14, init_cohort_br_n14, init_cohort_bsw_n14,init_cohort_bHW_n14,init_cohort_seedC_n14, init_cohort_nsc_n14
[4]: Initial states were not exposed to Rin init_soil: init_fast_soil_N, init_slow_soil_N, init_pmicr_C, init_pmicr_d13C, init_pmicr_N, init_wcl1, init_wcl2, init_wcl3, init_N0_ecosystem

Changes

Changes of this PR are summarized in NEWS.md.
They are breaking changes.

This PR reduces the number of parameters required in the drivers for BiomeEP:

  • params_tile$par_mort_under and params_tile$par_mort are removed and have to be replaced by params_species%mortrate_d_u and params_species%mortrate_d_c
  • previously ignored parameters [1] were removed from the default driver. If a user still provides them they have to be NA, otherwise an error is thrown.
    • in params_species this concerns: phenotype,Vmax,alphaBM,leafLS,lAImax,CNleaf0,gamma_L,Vannual, betaON,betaOFF,`leaf_size

This PR also allows to optionally provide additional parameters/initial values in the drivers for BiomeEP:

  • previously hardcoded parameters [2,3,4] can now optionally be prescribed in the driver. If they are not given, the former default values are automatically set in run_biomee_f_by_site()
    • in params_species this concerns: kphio,beta,rd_to_vcmax,kc_jmax,kphio_par_a,kphio_par_b
    • in params_tile this concerns: tau_acclim
    • in init_cohort this concerns: init_cohort_age and the nitrogen pools: init_cohort_bl_n14, init_cohort_br_n14, init_cohort_bsw_n14,init_cohort_bHW_n14,init_cohort_seedC_n14, init_cohort_nsc_n14.
    • in init_soils this concerns: init_fast_soil_N, init_slow_soil_N, init_pmicr_C,
      init_pmicr_d13C, init_pmicr_N, init_wcl1, init_wcl2, init_wcl3, init_N0_ecosystem

Lastly, this PR fixes the bug that init_cohort_nsc was not taken into account.init_cohort_nsc was made optional. Not providing init_cohort_nsc also recovers former default value.

@fabern fabern changed the title BiomeEP: expose additional paramters to R BiomeEP: expose additional parameters to R Mar 16, 2026
@fabern fabern force-pushed the biomee-redefine-parameters branch 2 times, most recently from 6b685b3 to 9ddabd9 Compare March 16, 2026 15:32
fabern added 5 commits March 16, 2026 18:41
This streamlines the input preparation of the BiomeEP simulation
Namely: 'phenotype','Vmax','alphaBM','leafLS','lAImax','CNleaf0'
Namely: 'phenotype','Vmax','alphaBM','leafLS','lAImax','CNleaf0'
@fabern fabern force-pushed the biomee-redefine-parameters branch from 9ddabd9 to 40f8f0d Compare March 16, 2026 22:38
I.e. store them as part of the params_species_biomee and params_tile_biomee. Currently still hardcoded, but this allows for exposure of these in a next step.
@fabern

fabern commented Mar 18, 2026

Copy link
Copy Markdown
Member Author

Strategy for calibration

(as discussed, from memory, feel free to modify)

There are three kinds of parameter with respect to calibration:

  • measurable, species-dependent traits, relatively static -> species-specific priors specified from observational data compilations (TRY, BAAD, ...)

    • wood density
    • SLA = 1/LMA
    • allometric coefficients and exponents (alpha, theta, ...)
  • Not directly measurable, but emergent properties of the ecosystem configuration, that we believe are implicitly calibratable at ecosystem-level through the used target data

    • P-model parameters (calibrated in Paredes et al., 2026)
    • respiration scaling parameter
    • mortality scaling parameter
    • root-shoot ratio (phiRL)
    • phenology model parameters
    • ...
  • model-specific, hardcoded

    • seedling properties
    • internal gap fraction
    • shape parameters of various functions
    • ...

… API)

This change is currently undocumented, since without specifying these parameters, BiomeEP continues to use the former hardcoded values as default.

This concerns parameters:
 ("kphio","beta","rd_to_vcmax","kc_jmax","kphio_par_a","kphio_par_b") in params_species and ("tau_acclim") in params_tile.

Small fix
@fabern fabern force-pushed the biomee-redefine-parameters branch from 825ba82 to 05a4bb8 Compare March 30, 2026 12:24
@fabern fabern marked this pull request as ready for review April 2, 2026 07:58
@fabern fabern requested a review from stineb April 2, 2026 07:58
@fabern

fabern commented Apr 2, 2026

Copy link
Copy Markdown
Member Author

@stineb: could you please have a quick look at the summarized changes from the first message in this PR. Is this streamlining of input parameters in your intent? I will base the calibration on this PR.

This allows to use gdb instead of lldb. lldb has some shortcomings with Fortran, namely it can't explore variables at a breakpoint. The recommendation is therefore to use gdb. Since this is not available for arm-based "M4" Macs, we run an arm-based Linux in a Docker container. Use VSCode extension "Dev Containers" together with the specified Docker file. Step 1: "Dev Containers: Reopen in Container"
Step 2: set a breakpoin in code. Step 3: go to the debug Tab in VSCode and click Play on the correct debug action "(gdb) Launch - MacBook Air M4".
@fabern fabern force-pushed the biomee-redefine-parameters branch from 81f2d91 to 22b4b81 Compare April 9, 2026 14:14
fabern added 6 commits April 9, 2026 14:40
…ohort_age`)

If not provided it recovers old default of 0 years old at initialization.
This has no effect with the default parametrization that anyway uses 0.1 for sp%internal_gap_frac and thus corresponds to the previously hardcoded f_gap=0.1
fabern added 3 commits April 12, 2026 21:14
This concerns parameters:
("extinct", "kappa", "f_gap", "A_mort", "B_mort", "f_LFR_max") in params_species and ("CN0metabolicL","CN0structuralL") in  params_tile.

Note that there is still some redundundancy in "extinct" and "kappa", and in "f_gap" and "internal_gap_frac"

This change is currently undocumented (like 05a4bb8), since without specifying these parameters, BiomeEP continues to use the former hardcoded values as default.

Passed parameters are now stored as part of the params_species_biomee and params_tile_biomee.
…micsLayer()

This results is slightly larger evaporation of soil water from forest floor.
By specifying min version of dplyr as "1.2.0" and by adding dplyr::
@fabern fabern force-pushed the biomee-redefine-parameters branch from 0520567 to bb86f57 Compare April 13, 2026 12:13
fabern added 6 commits April 15, 2026 11:29
…ward comaptibility with defaults

Previously `init_cohort_nsc` was provided but overwritten, rendering this input parameter obsolete.

With this commit `init_cohort_nsc` is correctly taken into account, if provided.

To ensure backward compatibility:
- `init_cohort_nsc` is made optional: falling back on previous behavior as a default if not provided
- `init_cohort_nsc` is removed from the default drivers (to trigger previous behavior)

NOTE: changes to biomee_gs_leuning_output.rda, biomee_p_model_luluc_output.rda and biomee_p_model_output are minor.
And add remark for other potential bug
@fabern fabern marked this pull request as draft April 16, 2026 10:09
fabern added 2 commits April 16, 2026 13:12
Previously, default initial values were derived inside of Fortran code. This has now been moved to R in case the user does not provide initial values of N pools.

Bottom line: The default recovers former default initialization.
@fabern fabern force-pushed the biomee-redefine-parameters branch from 97ae49e to b678e2d Compare April 17, 2026 14:15
…tional)

Previously, default initial values were derived inside of Fortran code. This has now been moved to R in case the user does not provide initial values for the soil pools.

Bottom line: The default recovers former default initialization.
@fabern fabern force-pushed the biomee-redefine-parameters branch from b678e2d to b5125f1 Compare April 17, 2026 14:18
…imits)

Except: on Windows CI testing: test failed since it appeared to be slightly outside of the tolerance limits. Thus we update the snapshot
@fabern fabern marked this pull request as ready for review April 19, 2026 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant