From f0558b64628c27dc50cb0e8e0f16d92389771421 Mon Sep 17 00:00:00 2001 From: ckoven Date: Thu, 6 Jul 2017 11:44:52 -0700 Subject: [PATCH 1/5] added 6 new vars to track growth and mortality rates conditional on size, age, and canopy position --- main/FatesHistoryInterfaceMod.F90 | 54 ++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/main/FatesHistoryInterfaceMod.F90 b/main/FatesHistoryInterfaceMod.F90 index 8c73b95642..fcb7b51e08 100644 --- a/main/FatesHistoryInterfaceMod.F90 +++ b/main/FatesHistoryInterfaceMod.F90 @@ -82,6 +82,12 @@ module FatesHistoryInterfaceMod ! Indices to site by size-class by pft variables integer, private :: ih_nplant_si_scag + integer, private :: ih_nplant_canopy_si_scag + integer, private :: ih_nplant_understory_si_scag + integer, private :: ih_ddbh_canopy_si_scag + integer, private :: ih_ddbh_understory_si_scag + integer, private :: ih_mortality_canopy_si_scag + integer, private :: ih_mortality_understory_si_scag ! Indices to (site) variables integer, private :: ih_nep_si @@ -1258,7 +1264,13 @@ subroutine update_history_dyn(this,nc,nsites,sites) hio_cwd_bg_out_si_cwdsc => this%hvars(ih_cwd_bg_out_si_cwdsc)%r82d, & hio_crownarea_si_cnlf => this%hvars(ih_crownarea_si_cnlf)%r82d, & hio_crownarea_si_can => this%hvars(ih_crownarea_si_can)%r82d, & - hio_nplant_si_scag => this%hvars(ih_nplant_si_scag)%r82d) + hio_nplant_si_scag => this%hvars(ih_nplant_si_scag)%r82d, & + hio_nplant_canopy_si_scag => this%hvars(ih_nplant_canopy_si_scag)%r82d, & + hio_nplant_understory_si_scag => this%hvars(ih_nplant_understory_si_scag)%r82d, & + hio_ddbh_canopy_si_scag => this%hvars(ih_ddbh_canopy_si_scag)%r82d, & + hio_ddbh_understory_si_scag => this%hvars(ih_ddbh_understory_si_scag)%r82d, & + hio_mortality_canopy_si_scag => this%hvars(ih_mortality_canopy_si_scag)%r82d, & + hio_mortality_understory_si_scag => this%hvars(ih_mortality_understory_si_scag)%r82d) ! --------------------------------------------------------------------------------- @@ -1450,6 +1462,11 @@ subroutine update_history_dyn(this,nc,nsites,sites) ! update SCPF/SCLS- and canopy/subcanopy- partitioned quantities if (ccohort%canopy_layer .eq. 1) then + hio_nplant_canopy_si_scag(io_si,iscag) = hio_nplant_canopy_si_scag(io_si,iscag) + ccohort%n + hio_mortality_canopy_si_scag(io_si,iscag) = hio_mortality_canopy_si_scag(io_si,iscag) + & + (ccohort%bmort + ccohort%hmort + ccohort%cmort + ccohort%imort + ccohort%fmort) * ccohort%n + hio_ddbh_canopy_si_scag(io_si,iscag) = hio_ddbh_canopy_si_scag(io_si,iscag) + & + ccohort%ddbhdt*ccohort%n hio_bstor_canopy_si_scpf(io_si,scpf) = hio_bstor_canopy_si_scpf(io_si,scpf) + & ccohort%bstore * ccohort%n hio_bleaf_canopy_si_scpf(io_si,scpf) = hio_bleaf_canopy_si_scpf(io_si,scpf) + & @@ -1509,6 +1526,11 @@ subroutine update_history_dyn(this,nc,nsites,sites) hio_yesterdaycanopylevel_canopy_si_scls(io_si,scls) + & ccohort%canopy_layer_yesterday * ccohort%n else + hio_nplant_understory_si_scag(io_si,iscag) = hio_nplant_understory_si_scag(io_si,iscag) + ccohort%n + hio_mortality_understory_si_scag(io_si,iscag) = hio_mortality_understory_si_scag(io_si,iscag) + & + (ccohort%bmort + ccohort%hmort + ccohort%cmort + ccohort%imort + ccohort%fmort) * ccohort%n + hio_ddbh_understory_si_scag(io_si,iscag) = hio_ddbh_understory_si_scag(io_si,iscag) + & + ccohort%ddbhdt*ccohort%n hio_bstor_understory_si_scpf(io_si,scpf) = hio_bstor_understory_si_scpf(io_si,scpf) + & ccohort%bstore * ccohort%n hio_bleaf_understory_si_scpf(io_si,scpf) = hio_bleaf_understory_si_scpf(io_si,scpf) + & @@ -2912,6 +2934,36 @@ subroutine define_history_vars(this, initialize_variables) avgflag='A', vtype=site_scag_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_nplant_si_scag ) + call this%set_history_var(vname='NPLANT_CANOPY_SCAG',units = 'plants/ha', & + long='number of plants per hectare in canopy in each size x age class', use_default='inactive', & + avgflag='A', vtype=site_scag_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_nplant_canopy_si_scag ) + + call this%set_history_var(vname='NPLANT_UNDERSTORY_SCAG',units = 'plants/ha', & + long='number of plants per hectare in understory in each size x age class', use_default='inactive', & + avgflag='A', vtype=site_scag_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_nplant_understory_si_scag ) + + call this%set_history_var(vname='DDBH_CANOPY_SCAG',units = 'cm/yr/ha', & + long='growth rate of canopy plantsnumber of plants per hectare in canopy in each size x age class', use_default='inactive', & + avgflag='A', vtype=site_scag_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_ddbh_canopy_si_scag ) + + call this%set_history_var(vname='DDBH_UNDERSTORY_SCAG',units = 'cm/yr/ha', & + long='growth rate of understory plants in each size x age class', use_default='inactive', & + avgflag='A', vtype=site_scag_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_ddbh_understory_si_scag ) + + call this%set_history_var(vname='MORTALITY_CANOPY_SCAG',units = 'plants/ha/yr', & + long='mortality rate of canopy plants in each size x age class', use_default='inactive', & + avgflag='A', vtype=site_scag_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_mortality_canopy_si_scag ) + + call this%set_history_var(vname='MORTALITY_UNDERSTORY_SCAG',units = 'plants/ha/yr', & + long='mortality rate of understory plantsin each size x age class', use_default='inactive', & + avgflag='A', vtype=site_scag_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_mortality_understory_si_scag ) + ! Carbon Flux (grid dimension x scpf) (THESE ARE DEFAULT INACTIVE!!! ! (BECAUSE THEY TAKE UP SPACE!!! From 6bd2ffcca279fd9b15812620383b49b9e0f83c11 Mon Sep 17 00:00:00 2001 From: ckoven Date: Fri, 7 Jul 2017 09:42:30 -0700 Subject: [PATCH 2/5] adding all biomass tendency terms to cohort fusion handling --- biogeochem/EDCohortDynamicsMod.F90 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/biogeochem/EDCohortDynamicsMod.F90 b/biogeochem/EDCohortDynamicsMod.F90 index feade6481b..c9ec3b69e5 100755 --- a/biogeochem/EDCohortDynamicsMod.F90 +++ b/biogeochem/EDCohortDynamicsMod.F90 @@ -860,6 +860,12 @@ subroutine fuse_cohorts(patchptr, bc_in) currentCohort%npp_bseed = (currentCohort%n*currentCohort%npp_bseed + nextc%n*nextc%npp_bseed)/newn currentCohort%npp_store = (currentCohort%n*currentCohort%npp_store + nextc%n*nextc%npp_store)/newn + ! biomass and dbh tendencies + currentCohort%ddbhdt = (currentCohort%n*currentCohort%ddbhdt + nextc%n*nextc%ddbhdt)/newn + currentCohort%dbalivedt = (currentCohort%n*currentCohort%dbalivedt + nextc%n*nextc%dbalivedt)/newn + currentCohort%dbdeaddt = (currentCohort%n*currentCohort%dbdeaddt + nextc%n*nextc%dbdeaddt)/newn + currentCohort%dbstoredt = (currentCohort%n*currentCohort%dbstoredt + nextc%n*nextc%dbstoredt)/newn + do i=1, nlevleaf if (currentCohort%year_net_uptake(i) == 999._r8 .or. nextc%year_net_uptake(i) == 999._r8) then currentCohort%year_net_uptake(i) = & From 6c0ee5fc141ed9885e91c96710bf16cdc19e7f45 Mon Sep 17 00:00:00 2001 From: ckoven Date: Wed, 19 Jul 2017 16:48:17 -0700 Subject: [PATCH 3/5] pulled in impact mortality bugfix and some other diagnostic variables form presecribed_physiology branch --- biogeochem/EDCohortDynamicsMod.F90 | 4 +++ main/EDTypesMod.F90 | 2 ++ main/FatesHistoryInterfaceMod.F90 | 39 +++++++++++++++++++++++++----- 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/biogeochem/EDCohortDynamicsMod.F90 b/biogeochem/EDCohortDynamicsMod.F90 index feade6481b..b5c6e7b567 100755 --- a/biogeochem/EDCohortDynamicsMod.F90 +++ b/biogeochem/EDCohortDynamicsMod.F90 @@ -1242,6 +1242,10 @@ subroutine copy_cohort( currentCohort,copyc ) if( use_fates_plant_hydro ) call CopyCohortHydraulics(n,o) + ! indices for binning + n%size_class = o%size_class + n%size_by_pft_class = o%size_by_pft_class + !Pointers n%taller => NULL() ! pointer to next tallest cohort n%shorter => NULL() ! pointer to next shorter cohort diff --git a/main/EDTypesMod.F90 b/main/EDTypesMod.F90 index bd874869f9..89eb6c58d4 100755 --- a/main/EDTypesMod.F90 +++ b/main/EDTypesMod.F90 @@ -24,6 +24,8 @@ module EDTypesMod integer, parameter :: numpft_ed = 2 ! number of PFTs used in ED. + integer, parameter :: maxCohortsPerPatch = nclmax * numpft_ed * nlevleaf ! maximum number of cohorts to live on a patch + ! TODO: we use this cp_maxSWb only because we have a static array q(size=2) of ! land-ice abledo for vis and nir. This should be a parameter, which would ! get us on track to start using multi-spectral or hyper-spectral (RGK 02-2017) diff --git a/main/FatesHistoryInterfaceMod.F90 b/main/FatesHistoryInterfaceMod.F90 index 8c73b95642..e6c56bf30a 100644 --- a/main/FatesHistoryInterfaceMod.F90 +++ b/main/FatesHistoryInterfaceMod.F90 @@ -169,6 +169,8 @@ module FatesHistoryInterfaceMod integer, private :: ih_trimming_understory_si_scls integer, private :: ih_crown_area_canopy_si_scls integer, private :: ih_crown_area_understory_si_scls + integer, private :: ih_ddbh_canopy_si_scls + integer, private :: ih_ddbh_understory_si_scls ! lots of non-default diagnostics for understanding canopy versus understory carbon balances integer, private :: ih_rdark_canopy_si_scls @@ -1186,6 +1188,8 @@ subroutine update_history_dyn(this,nc,nsites,sites) hio_nplant_understory_si_scpf => this%hvars(ih_nplant_understory_si_scpf)%r82d, & hio_ddbh_canopy_si_scpf => this%hvars(ih_ddbh_canopy_si_scpf)%r82d, & hio_ddbh_understory_si_scpf => this%hvars(ih_ddbh_understory_si_scpf)%r82d, & + hio_ddbh_canopy_si_scls => this%hvars(ih_ddbh_canopy_si_scls)%r82d, & + hio_ddbh_understory_si_scls => this%hvars(ih_ddbh_understory_si_scls)%r82d, & hio_gpp_canopy_si_scpf => this%hvars(ih_gpp_canopy_si_scpf)%r82d, & hio_gpp_understory_si_scpf => this%hvars(ih_gpp_understory_si_scpf)%r82d, & hio_ar_canopy_si_scpf => this%hvars(ih_ar_canopy_si_scpf)%r82d, & @@ -1456,7 +1460,7 @@ subroutine update_history_dyn(this,nc,nsites,sites) ccohort%bl * ccohort%n hio_canopy_biomass_pa(io_pa) = hio_canopy_biomass_pa(io_pa) + n_density * ccohort%b * g_per_kg hio_mortality_canopy_si_scpf(io_si,scpf) = hio_mortality_canopy_si_scpf(io_si,scpf)+ & - (ccohort%bmort + ccohort%hmort + ccohort%cmort + ccohort%imort + ccohort%fmort) * ccohort%n + (ccohort%bmort + ccohort%hmort + ccohort%cmort + ccohort%fmort) * ccohort%n hio_nplant_canopy_si_scpf(io_si,scpf) = hio_nplant_canopy_si_scpf(io_si,scpf) + ccohort%n hio_nplant_canopy_si_scls(io_si,scls) = hio_nplant_canopy_si_scls(io_si,scls) + ccohort%n hio_trimming_canopy_si_scls(io_si,scls) = hio_trimming_canopy_si_scls(io_si,scls) + & @@ -1470,11 +1474,13 @@ subroutine update_history_dyn(this,nc,nsites,sites) ! growth increment hio_ddbh_canopy_si_scpf(io_si,scpf) = hio_ddbh_canopy_si_scpf(io_si,scpf) + & ccohort%ddbhdt*ccohort%n + hio_ddbh_canopy_si_scls(io_si,scls) = hio_ddbh_canopy_si_scls(io_si,scls) + & + ccohort%ddbhdt*ccohort%n ! sum of all mortality hio_mortality_canopy_si_scls(io_si,scls) = hio_mortality_canopy_si_scls(io_si,scls) + & - (ccohort%bmort + ccohort%hmort + ccohort%cmort + ccohort%imort + ccohort%fmort) * ccohort%n + (ccohort%bmort + ccohort%hmort + ccohort%cmort + ccohort%fmort) * ccohort%n hio_canopy_mortality_carbonflux_si(io_si) = hio_canopy_mortality_carbonflux_si(io_si) + & - (ccohort%bmort + ccohort%hmort + ccohort%cmort + ccohort%imort + ccohort%fmort) * & + (ccohort%bmort + ccohort%hmort + ccohort%cmort + ccohort%fmort) * & ccohort%b * ccohort%n * g_per_kg * days_per_sec * years_per_day * ha_per_m2 ! hio_leaf_md_canopy_si_scls(io_si,scls) = hio_leaf_md_canopy_si_scls(io_si,scls) + & @@ -1515,7 +1521,7 @@ subroutine update_history_dyn(this,nc,nsites,sites) ccohort%bl * ccohort%n hio_understory_biomass_pa(io_pa) = hio_understory_biomass_pa(io_pa) + n_density * ccohort%b * g_per_kg hio_mortality_understory_si_scpf(io_si,scpf) = hio_mortality_understory_si_scpf(io_si,scpf)+ & - (ccohort%bmort + ccohort%hmort + ccohort%cmort + ccohort%imort + ccohort%fmort) * ccohort%n + (ccohort%bmort + ccohort%hmort + ccohort%cmort + ccohort%fmort) * ccohort%n hio_nplant_understory_si_scpf(io_si,scpf) = hio_nplant_understory_si_scpf(io_si,scpf) + ccohort%n hio_nplant_understory_si_scls(io_si,scls) = hio_nplant_understory_si_scls(io_si,scls) + ccohort%n hio_trimming_understory_si_scls(io_si,scls) = hio_trimming_understory_si_scls(io_si,scls) + & @@ -1529,11 +1535,13 @@ subroutine update_history_dyn(this,nc,nsites,sites) ! growth increment hio_ddbh_understory_si_scpf(io_si,scpf) = hio_ddbh_understory_si_scpf(io_si,scpf) + & ccohort%ddbhdt*ccohort%n + hio_ddbh_understory_si_scls(io_si,scls) = hio_ddbh_understory_si_scls(io_si,scls) + & + ccohort%ddbhdt*ccohort%n ! sum of all mortality hio_mortality_understory_si_scls(io_si,scls) = hio_mortality_understory_si_scls(io_si,scls) + & - (ccohort%bmort + ccohort%hmort + ccohort%cmort + ccohort%imort + ccohort%fmort) * ccohort%n + (ccohort%bmort + ccohort%hmort + ccohort%cmort + ccohort%fmort) * ccohort%n hio_understory_mortality_carbonflux_si(io_si) = hio_understory_mortality_carbonflux_si(io_si) + & - (ccohort%bmort + ccohort%hmort + ccohort%cmort + ccohort%imort + ccohort%fmort) * & + (ccohort%bmort + ccohort%hmort + ccohort%cmort + ccohort%fmort) * & ccohort%b * ccohort%n * g_per_kg * days_per_sec * years_per_day * ha_per_m2 ! hio_leaf_md_understory_si_scls(io_si,scls) = hio_leaf_md_understory_si_scls(io_si,scls) + & @@ -1569,6 +1577,15 @@ subroutine update_history_dyn(this,nc,nsites,sites) ccohort%canopy_layer_yesterday * ccohort%n endif ! + ! consider imort as understory mortality even if it happens in cohorts that may have been promoted as part of the patch creation... + hio_mortality_understory_si_scpf(io_si,scpf) = hio_mortality_understory_si_scpf(io_si,scpf)+ & + (ccohort%imort) * ccohort%n + hio_mortality_understory_si_scls(io_si,scls) = hio_mortality_understory_si_scls(io_si,scls) + & + (ccohort%imort) * ccohort%n + hio_understory_mortality_carbonflux_si(io_si) = hio_understory_mortality_carbonflux_si(io_si) + & + (ccohort%imort) * & + ccohort%b * ccohort%n * g_per_kg * days_per_sec * years_per_day * ha_per_m2 + ! ccohort%canopy_layer_yesterday = real(ccohort%canopy_layer, r8) end associate @@ -3152,6 +3169,16 @@ subroutine define_history_vars(this, initialize_variables) ! size-class only variables + call this%set_history_var(vname='DDBH_CANOPY_SCLS', units = 'cm/yr/ha', & + long='diameter growth increment by pft/size',use_default='inactive', & + avgflag='A', vtype=site_size_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_ddbh_canopy_si_scls ) + + call this%set_history_var(vname='DDBH_UNDERSTORY_SCLS', units = 'cm/yr/ha', & + long='diameter growth increment by pft/size',use_default='inactive', & + avgflag='A', vtype=site_size_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_ddbh_understory_si_scls ) + call this%set_history_var(vname='YESTERDAYCANLEV_CANOPY_SCLS', units = 'indiv/ha', & long='Yesterdays canopy level for canopy plants by size class', use_default='inactive', & avgflag='A', vtype=site_size_r8, hlms='CLM:ALM', flushval=0.0_r8, & From d30002f20f8904251061d230a35673f15900c98a Mon Sep 17 00:00:00 2001 From: ckoven Date: Wed, 19 Jul 2017 16:51:54 -0700 Subject: [PATCH 4/5] fixed impact mortaaity reporting for scag-dimensioned flux output too --- main/FatesHistoryInterfaceMod.F90 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main/FatesHistoryInterfaceMod.F90 b/main/FatesHistoryInterfaceMod.F90 index 48a3d73796..740955d798 100644 --- a/main/FatesHistoryInterfaceMod.F90 +++ b/main/FatesHistoryInterfaceMod.F90 @@ -1468,7 +1468,7 @@ subroutine update_history_dyn(this,nc,nsites,sites) if (ccohort%canopy_layer .eq. 1) then hio_nplant_canopy_si_scag(io_si,iscag) = hio_nplant_canopy_si_scag(io_si,iscag) + ccohort%n hio_mortality_canopy_si_scag(io_si,iscag) = hio_mortality_canopy_si_scag(io_si,iscag) + & - (ccohort%bmort + ccohort%hmort + ccohort%cmort + ccohort%imort + ccohort%fmort) * ccohort%n + (ccohort%bmort + ccohort%hmort + ccohort%cmort + ccohort%fmort) * ccohort%n hio_ddbh_canopy_si_scag(io_si,iscag) = hio_ddbh_canopy_si_scag(io_si,iscag) + & ccohort%ddbhdt*ccohort%n hio_bstor_canopy_si_scpf(io_si,scpf) = hio_bstor_canopy_si_scpf(io_si,scpf) + & @@ -1534,7 +1534,7 @@ subroutine update_history_dyn(this,nc,nsites,sites) else hio_nplant_understory_si_scag(io_si,iscag) = hio_nplant_understory_si_scag(io_si,iscag) + ccohort%n hio_mortality_understory_si_scag(io_si,iscag) = hio_mortality_understory_si_scag(io_si,iscag) + & - (ccohort%bmort + ccohort%hmort + ccohort%cmort + ccohort%imort + ccohort%fmort) * ccohort%n + (ccohort%bmort + ccohort%hmort + ccohort%cmort + ccohort%fmort) * ccohort%n hio_ddbh_understory_si_scag(io_si,iscag) = hio_ddbh_understory_si_scag(io_si,iscag) + & ccohort%ddbhdt*ccohort%n hio_bstor_understory_si_scpf(io_si,scpf) = hio_bstor_understory_si_scpf(io_si,scpf) + & @@ -1607,6 +1607,8 @@ subroutine update_history_dyn(this,nc,nsites,sites) hio_understory_mortality_carbonflux_si(io_si) = hio_understory_mortality_carbonflux_si(io_si) + & (ccohort%imort) * & ccohort%b * ccohort%n * g_per_kg * days_per_sec * years_per_day * ha_per_m2 + hio_mortality_understory_si_scag(io_si,iscag) = hio_mortality_understory_si_scag(io_si,iscag) + & + (ccohort%imort) * ccohort%n ! ccohort%canopy_layer_yesterday = real(ccohort%canopy_layer, r8) From 7301abf9f298ec2398c196f7c30449c5255450a1 Mon Sep 17 00:00:00 2001 From: ckoven Date: Wed, 19 Jul 2017 17:07:49 -0700 Subject: [PATCH 5/5] bugfix on prior --- main/EDTypesMod.F90 | 1 - 1 file changed, 1 deletion(-) diff --git a/main/EDTypesMod.F90 b/main/EDTypesMod.F90 index 89eb6c58d4..349ffc3abb 100755 --- a/main/EDTypesMod.F90 +++ b/main/EDTypesMod.F90 @@ -11,7 +11,6 @@ module EDTypesMod save integer, parameter :: maxPatchesPerSite = 10 ! maximum number of patches to live on a site - integer, parameter :: maxCohortsPerPatch = 160 ! maximum number of cohorts to live on a patch integer, parameter :: nclmax = 2 ! Maximum number of canopy layers integer, parameter :: ican_upper = 1 ! Nominal index for the upper canopy integer, parameter :: ican_ustory = 2 ! Nominal index for understory in two-canopy system