Skip to content

Commit

Permalink
Removed flag update_annualLAImax as implementation was mutating param…
Browse files Browse the repository at this point in the history
…eters (bad practice) and not actually doing much anyways (simply capping underLAImax and LAImax after year 1).

Breaking change: The capping is now performed at year 0 unconditionally.
  • Loading branch information
marcadella committed Jan 8, 2025
1 parent 783339b commit 089d8f8
Show file tree
Hide file tree
Showing 13 changed files with 10 additions and 74 deletions.
4 changes: 1 addition & 3 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,6 @@
#' \item{steps_per_day}{Time resolution of the forcing (day-1).}
#' \item{do_U_shaped_mortality}{Flag indicating whether U-shaped
#' mortality is used.}
#' \item{update_annualLAImax}{Flag indicating whether updating
#' LAImax according to mineral N in soil.}
#' \item{do_closedN_run}{Flag indicating whether doing N closed
#' runs to recover N balance enforcing 0.2 kg N m-2 in the inorganic N pool.}
#' \item{code_method_photosynth}{String specifying the method of photosynthesis
Expand Down Expand Up @@ -285,7 +283,7 @@
#' \item{betaOFF}{Critical soil moisture for phenology offset.}
#' \item{seedlingsize}{Initial size of seedlings, in kg C per individual.}
#' \item{LNbase}{Basal leaf N per unit area, in kg N m\eqn{^{-2}}.}
#' \item{lAImax}{Maximum crown LAI (leaf area index).}
#' \item{lAImax}{Maximum crown LAI (leaf area index) (not used, see LAI_light).}
#' \item{Nfixrate0}{Reference N fixation rate (kg N kg C\eqn{^{-1}} root).}
#' \item{NfixCost0}{Carbon cost of N fixation (kg C kg N\eqn{^{-1}}).}
#' \item{phiCSA}{Ratio of sapwood area to leaf area.}
Expand Down
1 change: 0 additions & 1 deletion R/run_biomee_f_bysite.R
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ prepare_params_siml <- function(params_siml){
"nyeartrend",
"steps_per_day",
"do_U_shaped_mortality",
"update_annualLAImax",
"do_closedN_run",
"code_method_photosynth",
"code_method_mortality"
Expand Down
1 change: 0 additions & 1 deletion data-raw/generate_biomee_drivers.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ params_siml_gs_leuning <- tibble(
nyeartrend = 1,
steps_per_day = 24,
do_U_shaped_mortality = TRUE,
update_annualLAImax = TRUE,
do_closedN_run = TRUE,
method_photosynth = "gs_leuning",
method_mortality = "dbh"
Expand Down
Binary file modified data/biomee_gs_leuning_drivers.rda
Binary file not shown.
Binary file modified data/biomee_gs_leuning_output.rda
Binary file not shown.
Binary file modified data/biomee_p_model_drivers.rda
Binary file not shown.
Binary file modified data/biomee_p_model_output.rda
Binary file not shown.
9 changes: 4 additions & 5 deletions src/biomee.mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,16 @@ subroutine biomee_f( &

! Simulation parameters
myinterface%params_siml%do_U_shaped_mortality = int(params_siml(7)) /= 0
myinterface%params_siml%update_annualLAImax = int(params_siml(8)) /= 0
myinterface%params_siml%do_closedN_run = int(params_siml(9)) /= 0
myinterface%params_siml%do_closedN_run = int(params_siml(8)) /= 0

! this needs to be consistent with translation to code in run_biomee_f_bysite.R
if (int(params_siml(10)) == 1) then
if (int(params_siml(9)) == 1) then
myinterface%params_siml%method_photosynth = "gs_leuning"
else
myinterface%params_siml%method_photosynth = "pmodel"
end if

select case( int(params_siml(11)) )
select case( int(params_siml(10)) )
case (1)
myinterface%params_siml%method_mortality = "cstarvation"
case (2)
Expand Down Expand Up @@ -210,7 +209,7 @@ subroutine biomee_f( &
myinterface%params_species(:)%CNleafsupport = real( params_species(:,38))
myinterface%params_species(:)%rho_wood = real( params_species(:,39)) ! prescribed
myinterface%params_species(:)%taperfactor = real( params_species(:,40))
myinterface%params_species(:)%lAImax = real( params_species(:,41))
! myinterface%params_species(:)%lAImax = real( params_species(:,41)) ! overriden
myinterface%params_species(:)%tauNSC = real( params_species(:,42))
myinterface%params_species(:)%fNSNmax = real( params_species(:,43))
myinterface%params_species(:)%phiCSA = real( params_species(:,44))
Expand Down
2 changes: 0 additions & 2 deletions src/biosphere_biomee.mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,6 @@ subroutine biosphere_annual( &
! Annual calls
!----------------------------------------------------------------

if ( myinterface%params_siml%update_annualLAImax ) call vegn_annualLAImax_update( vegn )

!---------------------------------------------
! Get annual diagnostics and outputs in once.
! Needs to be called here
Expand Down
5 changes: 3 additions & 2 deletions src/datatypes_biomee.mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module datatypes_biomee
!=============== Number of parameters (out) ==============================================
integer, public, parameter :: nvars_forcing = 7
integer, public, parameter :: nvars_site_info = 3
integer, public, parameter :: nvars_params_siml = 11
integer, public, parameter :: nvars_params_siml = 10
integer, public, parameter :: nvars_params_tile = 19
integer, public, parameter :: nvars_init_soil = 4
integer, public, parameter :: nvars_init_cohorts = 9
Expand Down Expand Up @@ -863,7 +863,8 @@ subroutine initialize_PFT_data()
spdata%prob_g = 1.0
spdata%prob_e = 1.0

spdata%underLAImax = spdata%LAImax
spdata%LAImax = MAX(0.5, spdata%LAI_light)
spdata%underLAImax = MIN(spdata%LAImax, 1.2)

! specific root area
spdata%SRA = 2.0/(spdata%root_r*spdata%rho_FR)
Expand Down
2 changes: 1 addition & 1 deletion src/interface_biosphere_biomee.mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ module md_interface_biomee
real :: mortrate_d_u ! yearly mortality rate in understory

!===== Population level variables
real :: LAImax, underLAImax ! max. LAI - Mutated at runtime!!
real :: LAImax, underLAImax ! max. LAI - Overridden
real :: LAI_light ! light controlled maximum LAI
real :: internal_gap_frac ! fraction of internal gaps in the canopy

Expand Down
1 change: 0 additions & 1 deletion src/params_siml_biomee.mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ module md_params_siml_biomee

type(steering_parameters) :: steering
logical :: do_U_shaped_mortality
logical :: update_annualLAImax
logical :: do_closedN_run
character(len=30) :: method_photosynth
character(len=30) :: method_mortality
Expand Down
59 changes: 1 addition & 58 deletions src/vegetation_biomee.mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module md_vegetation_biomee
! public subroutines
public :: initialize_cohort_from_biomass, initialize_vegn_tile
public :: vegn_CNW_budget, vegn_phenology, vegn_growth_EW
public :: vegn_reproduction, vegn_annualLAImax_update
public :: vegn_reproduction
public :: vegn_nat_mortality, vegn_species_switch
public :: relayer_cohorts, vegn_mergecohorts, kill_lowdensity_cohorts
public :: kill_old_grass
Expand Down Expand Up @@ -1976,63 +1976,6 @@ subroutine init_cohort_allometry( cc )
end subroutine init_cohort_allometry


subroutine vegn_annualLAImax_update( vegn )
!////////////////////////////////////////////////////////////////
! used for updating LAImax according to mineral N in soil
! Potential problems:
! 1. All species LAImax are updated
! 2. For evergreen, LAImax can be less than current LAI.
! Weng, 2017-08-02
! Code from BiomeE-Allocation
!---------------------------------------------------------------
type(vegn_tile_type), intent(inout) :: vegn
! local variables
! type(cohort_type), pointer :: cc
real :: LAImin, LAIfixedN, LAImineralN
real :: LAI_Nitrogen
! real :: fixedN, rootN
logical:: fixedN_based
integer :: i
! Calculating LAI max based on mineral N or mineralN + fixed N
fixedN_based = .False. ! .True. !
LAImin = 0.5

!fixedN = 0.0
!do i = 1,vegn%n_cohorts
! cc => vegn%cohorts(i)
! fixedN = fixedN + cc%annualfixedN * cc%crownarea * cc%nindivs
!enddo
! Mineral+fixed N-based LAImax
! LAI_fixedN = sp%Nfixrate0 * sp%LMA * sp%CNleaf0 * sp%leafLS / sp%LMA
! cc%br_max = sp%phiRL*cc%bl_max/(sp%LMA*sp%SRA)

vegn%previousN = 0.8 * vegn%previousN + 0.2 * vegn%annualN
associate (spdata => myinterface%params_species )
do i=1,size(spdata)
associate (sp => spdata(i))

LAIfixedN = 0.5 * sp%Nfixrate0 * sp%CNleaf0 * sp%leafLS
LAImineralN = 0.5 * vegn%previousN * sp%CNleaf0 * sp%leafLS / sp%LMA

!LAImineralN = vegn%previousN/(sp%LMA/(sp%CNleaf0*sp%leafLS)+sp%phiRL*sp%alpha_FR/sp%SRA /sp%CNroot0)
LAI_nitrogen = LAIfixedN + LAImineralN
! spdata(i)%LAImax = MAX(LAImin, MIN(LAI_nitrogen, sp%LAI_light))

! turn off N limitation
sp%LAImax = MAX(LAImin, sp%LAI_light)

sp%underLAImax = MIN(sp%LAImax, 1.2)

! print*,'sp%LAI_light', sp%LAI_light

end associate

enddo
end associate

end subroutine vegn_annualLAImax_update


function leaf_area_from_biomass(bl,species) result (area)
!////////////////////////////////////////////////////////////////
! Code from BiomeE-Allocation
Expand Down

0 comments on commit 089d8f8

Please sign in to comment.