From eb250643ba354689eb9f8c6453a49dc25c3cf9ef Mon Sep 17 00:00:00 2001 From: jessica needham Date: Fri, 25 Aug 2023 19:01:57 -0700 Subject: [PATCH 1/2] fix error with large size initialisation in nocomp mode Add a call to h_allom so that trees can be demoted in canopy_structure --- main/EDInitMod.F90 | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/main/EDInitMod.F90 b/main/EDInitMod.F90 index 6f7b649a4b..384f0d8103 100644 --- a/main/EDInitMod.F90 +++ b/main/EDInitMod.F90 @@ -61,6 +61,7 @@ module EDInitMod use FatesInterfaceTypesMod , only : nlevage use FatesAllometryMod , only : h2d_allom + use FatesAllometryMod , only : h_allom use FatesAllometryMod , only : bagw_allom use FatesAllometryMod , only : bbgw_allom use FatesAllometryMod , only : bleaf @@ -851,6 +852,14 @@ subroutine init_cohorts(site_in, patch_in, bc_in) patch_in%tallest => null() patch_in%shortest => null() + ! if any pfts are starting with large size then the whole site needs a spread of 0 + do pft = 1, numpft + if (EDPftvarcon_inst%initd(pft) < 0.0_r8) then + site_in%spread = init_spread_inventory + end if + end do + + ! Manage interactions of fixed biogeog (site level filter) and nocomp (patch level filter) ! Need to cover all potential biogeog x nocomp combinations ! 1. biogeog = false. nocomp = false: all PFTs on (DEFAULT) @@ -980,8 +989,15 @@ subroutine init_cohorts(site_in, patch_in, bc_in) ! Calculate the leaf biomass from allometry ! (calculates a maximum first, then applies canopy trim) call bleaf(dbh, pft, crown_damage, canopy_trim, efleaf_coh, & - c_leaf) + c_leaf) + ! calculate crown area of the cohort + call carea_allom(dbh, cohort_n, init_spread_inventory, pft, crown_damage, & + c_area) + + ! calculate height from diameter + call h_allom(dbh, pft, hite) + else write(fates_log(),*) 'Negative fates_recruit_init_density can only be used in no comp mode' call endrun(msg=errMsg(sourcefile, __LINE__)) From e402f0cb16dfca2a23014f4b03b7b5e977eda0b4 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Mon, 11 Sep 2023 12:07:52 -0400 Subject: [PATCH 2/2] Small quality of life update to cohort age in create_cohort --- main/EDInitMod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/EDInitMod.F90 b/main/EDInitMod.F90 index 384f0d8103..de80dd8920 100644 --- a/main/EDInitMod.F90 +++ b/main/EDInitMod.F90 @@ -846,7 +846,7 @@ subroutine init_cohorts(site_in, patch_in, bc_in) real(r8) :: stem_drop_fraction ! fraction of stem to absciss when leaves absciss real(r8) :: fnrt_drop_fraction ! fraction of fine roots to absciss when leaves absciss integer, parameter :: recruitstatus = 0 ! whether the newly created cohorts are recruited or initialized - + real(r8),parameter :: zero_co_age = 0._r8 ! The age of a newly recruited cohort is zero !------------------------------------------------------------------------------------- patch_in%tallest => null() @@ -1083,7 +1083,7 @@ subroutine init_cohorts(site_in, patch_in, bc_in) call prt%CheckInitialConditions() call create_cohort(site_in, patch_in, pft, cohort_n, & - hite, 0.0_r8, dbh, prt, efleaf_coh, & + hite, zero_co_age, dbh, prt, efleaf_coh, & effnrt_coh, efstem_coh, leaf_status, recruitstatus, & canopy_trim, c_area, 1, crown_damage, site_in%spread, bc_in)