From 3fbe03b0bccd8bda9df74d9058e237bb81c013c3 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Wed, 18 Dec 2024 10:28:55 -0700 Subject: [PATCH 1/2] Update vegetation temperature weighting convention during chill day calculation --- biogeochem/EDPhysiologyMod.F90 | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/biogeochem/EDPhysiologyMod.F90 b/biogeochem/EDPhysiologyMod.F90 index 8d689a759a..ffbb4d4486 100644 --- a/biogeochem/EDPhysiologyMod.F90 +++ b/biogeochem/EDPhysiologyMod.F90 @@ -966,6 +966,8 @@ subroutine phenology( currentSite, bc_in ) integer :: gddstart ! beginning of counting period for growing degree days. integer :: nlevroot ! Number of rooting levels to consider real(r8) :: temp_in_C ! daily averaged temperature in celsius + real(r8) :: temp_wgt ! canopy area weighting factor for daily average + ! vegetation temperature calculation real(r8) :: elongf_prev ! Elongation factor from previous time real(r8) :: elongf_1st ! First guess for elongation factor integer :: ndays_pft_leaf_lifespan ! PFT life span of drought deciduous [days]. @@ -1019,13 +1021,23 @@ subroutine phenology( currentSite, bc_in ) !Parameters, default from from SDGVM model of senesence temp_in_C = 0._r8 + temp_wgt = 0._r8 cpatch => CurrentSite%oldest_patch do while(associated(cpatch)) - temp_in_C = temp_in_C + cpatch%tveg24%GetMean()*cpatch%area + temp_in_C = temp_in_C + cpatch%tveg24%GetMean()*cpatch%total_canopy_area + temp_wgt = temp_wgt + cpatch%total_canopy_area cpatch => cpatch%younger end do - temp_in_C = temp_in_C * area_inv - tfrz - + if(cpatch%total_canopy_area>nearzero)then + temp_in_C = temp_in_C/temp_wgt - tfrz + else + ! If there is no canopy area, we use the veg temperature + ! of the first patch, which is the forcing air temperature + ! as defined in CLM/ELM. The forcing air temperature + ! should be the same among all patches. (Although + ! it is unlikely there are more than 1 in this scenario) + temp_in_C = CurrentSite%oldest_patch%tveg24%GetMean() - tfrz + end if !-----------------Cold Phenology--------------------! From efb14ac72b7f66e34330fa064a3d42a86443b7e5 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Wed, 18 Dec 2024 11:17:23 -0700 Subject: [PATCH 2/2] Fixed null pointer --- biogeochem/EDPhysiologyMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/biogeochem/EDPhysiologyMod.F90 b/biogeochem/EDPhysiologyMod.F90 index ffbb4d4486..ea0b7e02b7 100644 --- a/biogeochem/EDPhysiologyMod.F90 +++ b/biogeochem/EDPhysiologyMod.F90 @@ -1028,7 +1028,7 @@ subroutine phenology( currentSite, bc_in ) temp_wgt = temp_wgt + cpatch%total_canopy_area cpatch => cpatch%younger end do - if(cpatch%total_canopy_area>nearzero)then + if(temp_wgt>nearzero)then temp_in_C = temp_in_C/temp_wgt - tfrz else ! If there is no canopy area, we use the veg temperature