From ac46e0fcc70fbad1069d9ca34fb6cdb17024e07a Mon Sep 17 00:00:00 2001 From: ckoven Date: Thu, 26 Jan 2017 21:45:49 -0800 Subject: [PATCH 01/21] added seed homogenization mode to prevent compettive exclusion --- .../clm/src/ED/biogeochem/EDPhysiologyMod.F90 | 41 ++++++++++++++++++- components/clm/src/ED/main/EDTypesMod.F90 | 3 ++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/components/clm/src/ED/biogeochem/EDPhysiologyMod.F90 b/components/clm/src/ED/biogeochem/EDPhysiologyMod.F90 index fccd8c0843..dbec515c9a 100755 --- a/components/clm/src/ED/biogeochem/EDPhysiologyMod.F90 +++ b/components/clm/src/ED/biogeochem/EDPhysiologyMod.F90 @@ -641,6 +641,7 @@ subroutine seeds_in( currentSite, cp_pnt ) ! ! !USES: use EDTypesMod, only : AREA + use EDTypesMod, only : homogenize_seed_pfts ! ! !ARGUMENTS type(ed_site_type), intent(inout), target :: currentSite @@ -650,12 +651,48 @@ subroutine seeds_in( currentSite, cp_pnt ) type(ed_patch_type), pointer :: currentPatch type(ed_cohort_type), pointer :: currentCohort integer :: p + logical :: pft_present(numpft_ed) + real(r8) :: npfts_present !---------------------------------------------------------------------- currentPatch => cp_pnt currentPatch%seeds_in(:) = 0.0_r8 - + + if ( homogenize_seed_pfts ) then + ! special mode to remove intergenerational filters on PFT existence: each PFT seeds all PFTs + ! first loop over all patches and cohorts to see what and how many PFTs are present on this site + pft_present(:) = .false. + npfts_present = 0._r8 + currentPatch => currentSite%oldest_patch + do while(associated(currentPatch)) + currentCohort => currentPatch%tallest + do while (associated(currentCohort)) + p = currentCohort%pft + if (.not. pft_present(p)) then + pft_present(p) = .true. + npfts_present = npfts_present + 1._r8 + endif + currentCohort => currentCohort%shorter + enddo !cohort loop + currentPatch => currentPatch%younger + enddo ! patch loop + + ! now calculate the homogenized seed flux into each PFT pool + currentPatch => cp_pnt + currentCohort => currentPatch%tallest + do while (associated(currentCohort)) + do p = 1, numpft_ed + if (pft_present(p)) then + currentPatch%seeds_in(p) = currentPatch%seeds_in(p) + currentCohort%seed_prod * currentCohort%n / & + (currentPatch%area * npfts_present) + endif + end do + currentCohort => currentCohort%shorter + enddo !cohort loop + else + + ! normal case: each PFT seeds its own type currentCohort => currentPatch%tallest do while (associated(currentCohort)) p = currentCohort%pft @@ -663,6 +700,8 @@ subroutine seeds_in( currentSite, cp_pnt ) currentCohort => currentCohort%shorter enddo !cohort loop + endif + currentPatch => currentSite%oldest_patch do while(associated(currentPatch)) diff --git a/components/clm/src/ED/main/EDTypesMod.F90 b/components/clm/src/ED/main/EDTypesMod.F90 index d861559ce3..ff00f13030 100755 --- a/components/clm/src/ED/main/EDTypesMod.F90 +++ b/components/clm/src/ED/main/EDTypesMod.F90 @@ -76,6 +76,9 @@ module EDTypesMod character*4 yearchar + ! special mode to cause PFTs to create seed mass of all currently-existing PFTs + logical, parameter :: homogenize_seed_pfts = .true. + !the lower limit of the size classes of ED cohorts !0-10,10-20... integer, parameter :: nlevsclass_ed = 13 ! Number of dbh size classes for size structure analysis From 698b6fb75486b6a50214bd6dc955659659f659bb Mon Sep 17 00:00:00 2001 From: ckoven Date: Mon, 6 Feb 2017 13:58:08 -0800 Subject: [PATCH 02/21] added new diagnostics on canopy/understory plants, carbon storage, and carbon mortality --- .../src/ED/main/FatesHistoryInterfaceMod.F90 | 83 +++++++++++++++++-- 1 file changed, 75 insertions(+), 8 deletions(-) diff --git a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 index 568b9950d4..f474ffd7fe 100644 --- a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 +++ b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 @@ -100,14 +100,15 @@ module FatesHistoryInterfaceMod integer, private :: ih_npp_agsw_si_scpf integer, private :: ih_npp_agdw_si_scpf integer, private :: ih_npp_stor_si_scpf - integer, private :: ih_litt_leaf_si_scpf - integer, private :: ih_litt_fnrt_si_scpf - integer, private :: ih_litt_sawd_si_scpf - integer, private :: ih_litt_ddwd_si_scpf - integer, private :: ih_r_leaf_si_scpf - integer, private :: ih_r_stem_si_scpf - integer, private :: ih_r_root_si_scpf - integer, private :: ih_r_stor_si_scpf + + integer, private :: ih_bstor_canopy_si_scpf + integer, private :: ih_bstor_understory_si_scpf + integer, private :: ih_bleaf_canopy_si_scpf + integer, private :: ih_bleaf_understory_si_scpf + integer, private :: ih_m3_canopy_si_scpf + integer, private :: ih_m3_understory_si_scpf + integer, private :: ih_nplant_canopy_si_scpf + integer, private :: ih_nplant_understory_si_scpf integer, private :: ih_ddbh_si_scpf integer, private :: ih_ba_si_scpf @@ -794,6 +795,14 @@ subroutine update_history_dyn(this,nc,nsites,sites) hio_npp_agsw_si_scpf => this%hvars(ih_npp_agsw_si_scpf)%r82d, & hio_npp_agdw_si_scpf => this%hvars(ih_npp_agdw_si_scpf)%r82d, & hio_npp_stor_si_scpf => this%hvars(ih_npp_stor_si_scpf)%r82d, & + hio_bstor_canopy_si_scpf => this%hvars(ih_bstor_canopy_si_scpf)%r82d, & + hio_bstor_understory_si_scpf => this%hvars(ih_bstor_understory_si_scpf)%r82d, & + hio_bleaf_canopy_si_scpf => this%hvars(ih_bleaf_canopy_si_scpf)%r82d, & + hio_bleaf_understory_si_scpf => this%hvars(ih_bleaf_understory_si_scpf)%r82d, & + hio_m3_canopy_si_scpf => this%hvars(ih_m3_canopy_si_scpf)%r82d, & + hio_m3_understory_si_scpf => this%hvars(ih_m3_understory_si_scpf)%r82d, & + hio_nplant_canopy_si_scpf => this%hvars(ih_nplant_canopy_si_scpf)%r82d, & + hio_nplant_understory_si_scpf => this%hvars(ih_nplant_understory_si_scpf)%r82d, & hio_ddbh_si_scpf => this%hvars(ih_ddbh_si_scpf)%r82d, & hio_ba_si_scpf => this%hvars(ih_ba_si_scpf)%r82d, & hio_nplant_si_scpf => this%hvars(ih_nplant_si_scpf)%r82d, & @@ -989,6 +998,23 @@ subroutine update_history_dyn(this,nc,nsites,sites) hio_ddbh_si_scpf(io_si,scpf) = -999.9 end if end if + + ! update SCPF- and canopy/subcanopy- partitioned quantities + if (ccohort%canopy_layer .eq. 1) then + hio_bstor_canopy_si_scpf(io_si,scpf) = hio_bstor_canopy_si_scpf(io_si,scpf) + & + ccohort%bstore * n_perm2 * AREA + hio_bleaf_canopy_si_scpf(io_si,scpf) = hio_bleaf_canopy_si_scpf(io_si,scpf) + & + ccohort%bl * n_perm2 * AREA + hio_m3_canopy_si_scpf(io_si,scpf) = hio_m3_canopy_si_scpf(io_si,scpf) + ccohort%cmort*n_perm2*AREA + hio_nplant_canopy_si_scpf(io_si,scpf) = hio_nplant_canopy_si_scpf(io_si,scpf) + AREA*n_perm2 + else + hio_bstor_understory_si_scpf(io_si,scpf) = hio_bstor_understory_si_scpf(io_si,scpf) + & + ccohort%bstore * n_perm2 + hio_bleaf_understory_si_scpf(io_si,scpf) = hio_bleaf_understory_si_scpf(io_si,scpf) + & + ccohort%bl * n_perm2 + hio_m3_understory_si_scpf(io_si,scpf) = hio_m3_understory_si_scpf(io_si,scpf) + ccohort%cmort*n_perm2*AREA + hio_nplant_understory_si_scpf(io_si,scpf) = hio_nplant_understory_si_scpf(io_si,scpf) + AREA*n_perm2 + endif end associate end if @@ -1651,6 +1677,47 @@ subroutine define_history_vars(this, initialize_variables) avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_m5_si_scpf ) + call this%set_history_var(vname='M3_CANOPY_SCPF', units = 'N/ha/yr', & + long='carbon starvation mortality of canopy plants count by patch and pft/size', use_default='inactive', & + avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_m3_canopy_si_scpf ) + + call this%set_history_var(vname='BSTOR_CANOPY_SCPF', units = 'kgC/ha', & + long='biomass carbon in storage pools of canopy plants count by patch and pft/size', use_default='inactive', & + avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_bstor_canopy_si_scpf ) + + call this%set_history_var(vname='BLEAF_CANOPY_SCPF', units = 'kgC/ha', & + long='biomass carbon in leaf of canopy plants count by patch and pft/size', use_default='inactive', & + avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_bleaf_canopy_si_scpf ) + + call this%set_history_var(vname='NPLANT_CANOPY_SCPF', units = 'N/ha', & + long='stem number of canopy plants density by patch and pft/size', use_default='inactive', & + avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_nplant_canopy_si_scpf ) + + call this%set_history_var(vname='M3_UNDERSTORY_SCPF', units = 'N/ha/yr', & + long='carbon starvation mortality of understory plants count by patch and pft/size', use_default='inactive', & + avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_m3_understory_si_scpf ) + + call this%set_history_var(vname='BSTOR_UNDERSTORY_SCPF', units = 'kgC/ha', & + long='biomass carbon in storage pools of understory plants count by patch and pft/size', use_default='inactive', & + avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_bstor_understory_si_scpf ) + + call this%set_history_var(vname='BLEAF_UNDERSTORY_SCPF', units = 'kgC/ha', & + long='biomass carbon in leaf of understory plants count by patch and pft/size', use_default='inactive', & + avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_bleaf_understory_si_scpf ) + + call this%set_history_var(vname='NPLANT_UNDERSTORY_SCPF', units = 'N/ha', & + long='stem number of understory plants density by patch and pft/size', use_default='inactive', & + avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_nplant_understory_si_scpf ) + + ! Size structured diagnostics that require rapid updates (upfreq=2) call this%set_history_var(vname='AR_SCPF',units = 'kgC/m2/yr', & From 4acda0e41267153c99adab7e650431eb3eef3fbb Mon Sep 17 00:00:00 2001 From: ckoven Date: Tue, 7 Feb 2017 13:33:32 -0800 Subject: [PATCH 03/21] added more canopy/understory diagnostics on ddbh, gpp, and ar --- .../src/ED/main/FatesHistoryInterfaceMod.F90 | 107 ++++++++++++++++-- 1 file changed, 100 insertions(+), 7 deletions(-) diff --git a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 index f474ffd7fe..84e36859db 100644 --- a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 +++ b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 @@ -62,6 +62,10 @@ module FatesHistoryInterfaceMod integer, private :: ih_aresp_pa integer, private :: ih_maint_resp_pa integer, private :: ih_growth_resp_pa + integer, private :: ih_ar_canopy_pa + integer, private :: ih_gpp_canopy_pa + integer, private :: ih_ar_understory_pa + integer, private :: ih_gpp_understory_pa ! Indices to (site) variables integer, private :: ih_nep_si @@ -109,6 +113,12 @@ module FatesHistoryInterfaceMod integer, private :: ih_m3_understory_si_scpf integer, private :: ih_nplant_canopy_si_scpf integer, private :: ih_nplant_understory_si_scpf + integer, private :: ih_ddbh_canopy_si_scpf + integer, private :: ih_ddbh_understory_si_scpf + integer, private :: ih_gpp_canopy_si_scpf + integer, private :: ih_gpp_understory_si_scpf + integer, private :: ih_ar_canopy_si_scpf + integer, private :: ih_ar_understory_si_scpf integer, private :: ih_ddbh_si_scpf integer, private :: ih_ba_si_scpf @@ -803,6 +813,12 @@ subroutine update_history_dyn(this,nc,nsites,sites) hio_m3_understory_si_scpf => this%hvars(ih_m3_understory_si_scpf)%r82d, & hio_nplant_canopy_si_scpf => this%hvars(ih_nplant_canopy_si_scpf)%r82d, & 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_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, & + hio_ar_understory_si_scpf => this%hvars(ih_ar_understory_si_scpf)%r82d, & hio_ddbh_si_scpf => this%hvars(ih_ddbh_si_scpf)%r82d, & hio_ba_si_scpf => this%hvars(ih_ba_si_scpf)%r82d, & hio_nplant_si_scpf => this%hvars(ih_nplant_si_scpf)%r82d, & @@ -990,13 +1006,9 @@ subroutine update_history_dyn(this,nc,nsites,sites) ! number density [/ha] hio_nplant_si_scpf(io_si,scpf) = hio_nplant_si_scpf(io_si,scpf) + AREA*n_perm2 - ! Growth Incrments must have NaN check and woody check - if(ccohort%ddbhdt == ccohort%ddbhdt) then - hio_ddbh_si_scpf(io_si,scpf) = hio_ddbh_si_scpf(io_si,scpf) + & - ccohort%ddbhdt*n_perm2*AREA - else - hio_ddbh_si_scpf(io_si,scpf) = -999.9 - end if + ! growth increment + hio_ddbh_si_scpf(io_si,scpf) = hio_ddbh_si_scpf(io_si,scpf) + & + ccohort%ddbhdt*n_perm2*AREA end if ! update SCPF- and canopy/subcanopy- partitioned quantities @@ -1007,6 +1019,13 @@ subroutine update_history_dyn(this,nc,nsites,sites) ccohort%bl * n_perm2 * AREA hio_m3_canopy_si_scpf(io_si,scpf) = hio_m3_canopy_si_scpf(io_si,scpf) + ccohort%cmort*n_perm2*AREA hio_nplant_canopy_si_scpf(io_si,scpf) = hio_nplant_canopy_si_scpf(io_si,scpf) + AREA*n_perm2 + hio_gpp_canopy_si_scpf(io_si,scpf) = hio_gpp_canopy_si_scpf(io_si,scpf) + & + n_perm2*ccohort%gpp_acc_hold + hio_ar_canopy_si_scpf(io_si,scpf) = hio_ar_canopy_si_scpf(io_si,scpf) + & + n_perm2*ccohort%resp_acc_hold + ! growth increment + hio_ddbh_canopy_si_scpf(io_si,scpf) = hio_ddbh_canopy_si_scpf(io_si,scpf) + & + ccohort%ddbhdt*n_perm2*AREA else hio_bstor_understory_si_scpf(io_si,scpf) = hio_bstor_understory_si_scpf(io_si,scpf) + & ccohort%bstore * n_perm2 @@ -1014,6 +1033,13 @@ subroutine update_history_dyn(this,nc,nsites,sites) ccohort%bl * n_perm2 hio_m3_understory_si_scpf(io_si,scpf) = hio_m3_understory_si_scpf(io_si,scpf) + ccohort%cmort*n_perm2*AREA hio_nplant_understory_si_scpf(io_si,scpf) = hio_nplant_understory_si_scpf(io_si,scpf) + AREA*n_perm2 + hio_gpp_understory_si_scpf(io_si,scpf) = hio_gpp_understory_si_scpf(io_si,scpf) + & + n_perm2*ccohort%gpp_acc_hold + hio_ar_understory_si_scpf(io_si,scpf) = hio_ar_understory_si_scpf(io_si,scpf) + & + n_perm2*ccohort%resp_acc_hold + ! growth increment + hio_ddbh_understory_si_scpf(io_si,scpf) = hio_ddbh_understory_si_scpf(io_si,scpf) + & + ccohort%ddbhdt*n_perm2*AREA endif end associate @@ -1144,6 +1170,10 @@ subroutine update_history_prod(this,nc,nsites,sites,dt_tstep) hio_ar_darkm_si_scpf => this%hvars(ih_ar_darkm_si_scpf)%r82d, & hio_ar_crootm_si_scpf => this%hvars(ih_ar_crootm_si_scpf)%r82d, & hio_ar_frootm_si_scpf => this%hvars(ih_ar_frootm_si_scpf)%r82d, & + hio_gpp_canopy_pa => this%hvars(ih_gpp_canopy_pa)%r81d, & + hio_ar_canopy_pa => this%hvars(ih_ar_canopy_pa)%r81d, & + hio_gpp_understory_pa => this%hvars(ih_gpp_understory_pa)%r81d, & + hio_ar_understory_pa => this%hvars(ih_ar_understory_pa)%r81d, & hio_gpp_si_age => this%hvars(ih_gpp_si_age)%r82d, & hio_npp_si_age => this%hvars(ih_npp_si_age)%r82d & ) @@ -1236,6 +1266,19 @@ subroutine update_history_prod(this,nc,nsites,sites,dt_tstep) + ccohort%gpp_tstep * ccohort%n * 1.e3_r8 / dt_tstep hio_npp_si_age(io_si,cpatch%age_class) = hio_npp_si_age(io_si,cpatch%age_class) & + ccohort%npp_tstep * ccohort%n * 1.e3_r8 / dt_tstep + + ! accumulate fluxes on canopy- and understory- separated fluxes + if (ccohort%canopy_layer .eq. 1) then + hio_gpp_canopy_pa(io_pa) = hio_gpp_canopy_pa(io_pa) + & + ccohort%gpp_tstep * 1.e3_r8 * n_density / dt_tstep + hio_ar_canopy_pa(io_pa) = hio_ar_canopy_pa(io_pa) + & + ccohort%resp_tstep * 1.e3_r8 * n_density / dt_tstep + else + hio_gpp_understory_pa(io_pa) = hio_gpp_understory_pa(io_pa) + & + ccohort%gpp_tstep * 1.e3_r8 * n_density / dt_tstep + hio_ar_understory_pa(io_pa) = hio_ar_understory_pa(io_pa) + & + ccohort%resp_tstep * 1.e3_r8 * n_density / dt_tstep + endif end associate endif @@ -1580,6 +1623,26 @@ subroutine define_history_vars(this, initialize_variables) avgflag='A', vtype=site_age_r8, hlms='CLM:ALM', flushval=0.0_r8, upfreq=2, & ivar=ivar, initialize=initialize_variables, index = ih_gpp_si_age ) + ! fast fluxes separated canopy/understory + call this%set_history_var(vname='GPP_CANOPY', units='gC/m^2/s', & + long='gross primary production of canopy plants', use_default='active', & + avgflag='A', vtype=patch_r8, hlms='CLM:ALM', flushval=0.0_r8, upfreq=2, & + ivar=ivar, initialize=initialize_variables, index = ih_gpp_canopy_pa ) + + call this%set_history_var(vname='AR_CANOPY', units='gC/m^2/s', & + long='autotrophic respiration of canopy plants', use_default='active', & + avgflag='A', vtype=patch_r8, hlms='CLM:ALM', flushval=0.0_r8, upfreq=2, & + ivar=ivar, initialize=initialize_variables, index = ih_ar_canopy_pa ) + + call this%set_history_var(vname='GPP_UNDERSTORY', units='gC/m^2/s', & + long='gross primary production of understory plants', use_default='active', & + avgflag='A', vtype=patch_r8, hlms='CLM:ALM', flushval=0.0_r8, upfreq=2, & + ivar=ivar, initialize=initialize_variables, index = ih_gpp_understory_pa ) + + call this%set_history_var(vname='AR_UNDERSTORY', units='gC/m^2/s', & + long='autotrophic respiration of understory plants', use_default='active', & + avgflag='A', vtype=patch_r8, hlms='CLM:ALM', flushval=0.0_r8, upfreq=2, & + ivar=ivar, initialize=initialize_variables, index = ih_ar_understory_pa ) ! Carbon Flux (grid dimension x scpf) (THESE ARE DEFAULT INACTIVE!!! @@ -1591,6 +1654,26 @@ subroutine define_history_vars(this, initialize_variables) avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_gpp_si_scpf ) + call this%set_history_var(vname='GPP_CANOPY_SCPF', units='kgC/m2/yr', & + long='gross primary production of canopy plants', use_default='inactive', & + avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_gpp_canopy_si_scpf ) + + call this%set_history_var(vname='AR_CANOPY_SCPF', units='kgC/m2/yr', & + long='autotrophic respiration of canopy plants', use_default='inactive', & + avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_ar_canopy_si_scpf ) + + call this%set_history_var(vname='GPP_UNDERSTORY_SCPF', units='kgC/m2/yr', & + long='gross primary production of understory plants', use_default='inactive', & + avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_gpp_understory_si_scpf ) + + call this%set_history_var(vname='AR_UNDERSTORY_SCPF', units='kgC/m2/yr', & + long='autotrophic respiration of understory plants', use_default='inactive', & + avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_ar_understory_si_scpf ) + call this%set_history_var(vname='NPP_SCPF', units='kgC/m2/yr', & long='total net primary production', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & @@ -1642,6 +1725,16 @@ subroutine define_history_vars(this, initialize_variables) avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_ddbh_si_scpf ) + call this%set_history_var(vname='DDBH_CANOPY_SCPF', units = 'cm/yr/ha', & + long='diameter growth increment and pft/size',use_default='inactive', & + avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_ddbh_canopy_si_scpf ) + + call this%set_history_var(vname='DDBH_UNDERSTORY_SCPF', units = 'cm/yr/ha', & + long='diameter growth increment and pft/size',use_default='inactive', & + avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_ddbh_understory_si_scpf ) + call this%set_history_var(vname='BA_SCPF', units = 'm2/ha', & long='basal area by patch and pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & From 89035ec931618f3c72582bde94d9951164fe0657 Mon Sep 17 00:00:00 2001 From: ckoven Date: Tue, 7 Feb 2017 14:34:55 -0800 Subject: [PATCH 04/21] fixed a unit error --- components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 index 84e36859db..9464e693aa 100644 --- a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 +++ b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 @@ -1028,9 +1028,9 @@ subroutine update_history_dyn(this,nc,nsites,sites) ccohort%ddbhdt*n_perm2*AREA else hio_bstor_understory_si_scpf(io_si,scpf) = hio_bstor_understory_si_scpf(io_si,scpf) + & - ccohort%bstore * n_perm2 + ccohort%bstore * n_perm2 * AREA hio_bleaf_understory_si_scpf(io_si,scpf) = hio_bleaf_understory_si_scpf(io_si,scpf) + & - ccohort%bl * n_perm2 + ccohort%bl * n_perm2 * AREA hio_m3_understory_si_scpf(io_si,scpf) = hio_m3_understory_si_scpf(io_si,scpf) + ccohort%cmort*n_perm2*AREA hio_nplant_understory_si_scpf(io_si,scpf) = hio_nplant_understory_si_scpf(io_si,scpf) + AREA*n_perm2 hio_gpp_understory_si_scpf(io_si,scpf) = hio_gpp_understory_si_scpf(io_si,scpf) + & From 3fbe65c218d1cbe4e6ab50374b7deb6a868fdf28 Mon Sep 17 00:00:00 2001 From: ckoven Date: Wed, 8 Feb 2017 15:20:55 -0800 Subject: [PATCH 05/21] added new mortality term to report terminated cohorts and also redefined the newish canopy_area_by_patch_age variable --- .../src/ED/biogeochem/EDCohortDynamicsMod.F90 | 4 ++++ components/clm/src/ED/main/EDInitMod.F90 | 3 +++ components/clm/src/ED/main/EDTypesMod.F90 | 3 +++ .../src/ED/main/FatesHistoryInterfaceMod.F90 | 20 +++++++++++++++++-- 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 b/components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 index 2237553ccd..79da24d337 100755 --- a/components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 +++ b/components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 @@ -559,6 +559,10 @@ subroutine terminate_cohorts( patchptr ) endif if (terminate == 1) then + ! preserve a record of the to-be-terminated cohort for mortality accounting + currentPatch%siteptr%terminated_nindivs(currentCohort%size_by_pft_class) = & + currentPatch%siteptr%terminated_nindivs(currentCohort%size_by_pft_class) + currentCohort%n + if (.not. associated(currentCohort%taller)) then currentPatch%tallest => currentCohort%shorter else diff --git a/components/clm/src/ED/main/EDInitMod.F90 b/components/clm/src/ED/main/EDInitMod.F90 index 76bc5ed9b2..5357622447 100755 --- a/components/clm/src/ED/main/EDInitMod.F90 +++ b/components/clm/src/ED/main/EDInitMod.F90 @@ -79,6 +79,9 @@ subroutine zero_site( site_in ) site_in%fates_to_bgc_this_ts = 0.0_r8 site_in%fates_to_bgc_last_ts = 0.0_r8 + ! termination info + site_in%terminated_nindivs(:) = 0._r8 + end subroutine zero_site ! ============================================================================ diff --git a/components/clm/src/ED/main/EDTypesMod.F90 b/components/clm/src/ED/main/EDTypesMod.F90 index a92283ebbd..19b2cf63f6 100755 --- a/components/clm/src/ED/main/EDTypesMod.F90 +++ b/components/clm/src/ED/main/EDTypesMod.F90 @@ -558,6 +558,9 @@ module EDTypesMod real(r8) :: cwd_ag_burned(ncwd) real(r8) :: leaf_litter_burned(numpft_ed) + ! TERMINATION + real(r8) :: terminated_nindivs(1:nlevsclass_ed*mxpft) ! number of individuals that were in cohorts which were terminated this timestep on scpf array + end type ed_site_type !************************************ diff --git a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 index 9464e693aa..8735697bee 100644 --- a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 +++ b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 @@ -127,6 +127,7 @@ module FatesHistoryInterfaceMod integer, private :: ih_m3_si_scpf integer, private :: ih_m4_si_scpf integer, private :: ih_m5_si_scpf + integer, private :: ih_m6_si_scpf integer, private :: ih_ar_si_scpf integer, private :: ih_ar_grow_si_scpf @@ -729,6 +730,7 @@ subroutine update_history_dyn(this,nc,nsites,sites) nlevsclass_ed, & levage_ed, & nlevage_ed, & + mxpft, & levpft_ed use EDParamsMod , only : ED_val_ag_biomass @@ -748,6 +750,7 @@ subroutine update_history_dyn(this,nc,nsites,sites) integer :: lb1,ub1,lb2,ub2 ! IO array bounds for the calling thread integer :: ivar ! index of IO variable object vector integer :: ft ! functional type index + integer :: i_scpf ! iterator for scpf dim real(r8) :: n_density ! individual of cohort per m2. real(r8) :: n_perm2 ! individuals per m2 for the whole column @@ -827,6 +830,7 @@ subroutine update_history_dyn(this,nc,nsites,sites) hio_m3_si_scpf => this%hvars(ih_m3_si_scpf)%r82d, & hio_m4_si_scpf => this%hvars(ih_m4_si_scpf)%r82d, & hio_m5_si_scpf => this%hvars(ih_m5_si_scpf)%r82d, & + hio_m6_si_scpf => this%hvars(ih_m6_si_scpf)%r82d, & hio_ba_si_scls => this%hvars(ih_ba_si_scls)%r82d, & hio_area_si_age => this%hvars(ih_area_si_age)%r82d, & hio_lai_si_age => this%hvars(ih_lai_si_age)%r82d, & @@ -873,8 +877,6 @@ subroutine update_history_dyn(this,nc,nsites,sites) ! Increment some patch-age-resolved diagnostics hio_lai_si_age(io_si,cpatch%age_class) = hio_lai_si_age(io_si,cpatch%age_class) & + cpatch%lai * cpatch%area - hio_canopy_area_si_age(io_si,cpatch%age_class) = hio_canopy_area_si_age(io_si,cpatch%age_class) & - + cpatch%canopy_area/AREA hio_ncl_si_age(io_si,cpatch%age_class) = hio_ncl_si_age(io_si,cpatch%age_class) & + cpatch%ncl_p * cpatch%area hio_npatches_si_age(io_si,cpatch%age_class) = hio_npatches_si_age(io_si,cpatch%age_class) + 1._r8 @@ -918,6 +920,9 @@ subroutine update_history_dyn(this,nc,nsites,sites) hio_area_treespread_pa(io_pa) = 0.0_r8 end if + hio_canopy_area_si_age(io_si,cpatch%age_class) = hio_canopy_area_si_age(io_si,cpatch%age_class) & + + ccohort%c_area/AREA + ! Update biomass components hio_bleaf_pa(io_pa) = hio_bleaf_pa(io_pa) + n_density * ccohort%bl * 1.e3_r8 hio_bstore_pa(io_pa) = hio_bstore_pa(io_pa) + n_density * ccohort%bstore * 1.e3_r8 @@ -1103,6 +1108,12 @@ subroutine update_history_dyn(this,nc,nsites,sites) hio_ncl_si_age(io_si, ipa2) = 0._r8 endif end do + + ! pass the cohort termination mortality as a flux to the history, and then reset the termination mortality buffer + do i_scpf = 1, nlevsclass_ed * mxpft + hio_m6_si_scpf(io_si,i_scpf) = sites(s)%terminated_nindivs(i_scpf) * yeardays + end do + sites(s)%terminated_nindivs(:) = 0._r8 enddo ! site loop @@ -1770,6 +1781,11 @@ subroutine define_history_vars(this, initialize_variables) avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_m5_si_scpf ) + call this%set_history_var(vname='M6_SCPF', units = 'N/ha/yr', & + long='termination mortality count by patch and pft/size',use_default='inactive', & + avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_m6_si_scpf ) + call this%set_history_var(vname='M3_CANOPY_SCPF', units = 'N/ha/yr', & long='carbon starvation mortality of canopy plants count by patch and pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & From bdf1219e00d7513e7048f973e5e0f1227dec4a2b Mon Sep 17 00:00:00 2001 From: ckoven Date: Thu, 9 Feb 2017 13:20:29 -0800 Subject: [PATCH 06/21] added a recruitment rate variable to history so that we can ensure conservation of individuals --- .../clm/src/ED/biogeochem/EDPhysiologyMod.F90 | 3 +++ components/clm/src/ED/main/EDInitMod.F90 | 3 ++- components/clm/src/ED/main/EDTypesMod.F90 | 5 +++-- .../clm/src/ED/main/FatesHistoryInterfaceMod.F90 | 15 ++++++++++++++- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/components/clm/src/ED/biogeochem/EDPhysiologyMod.F90 b/components/clm/src/ED/biogeochem/EDPhysiologyMod.F90 index c127a0b585..273625b404 100755 --- a/components/clm/src/ED/biogeochem/EDPhysiologyMod.F90 +++ b/components/clm/src/ED/biogeochem/EDPhysiologyMod.F90 @@ -1072,6 +1072,9 @@ subroutine recruitment( t, currentSite, currentPatch ) call create_cohort(currentPatch, temp_cohort%pft, temp_cohort%n, temp_cohort%hite, temp_cohort%dbh, & temp_cohort%balive, temp_cohort%bdead, temp_cohort%bstore, & temp_cohort%laimemory, cohortstatus, temp_cohort%canopy_trim, currentPatch%NCL_p) + + ! keep track of how many individuals were recruited for passing to history + currentPatch%siteptr%recruitment_rate(ft) = currentPatch%siteptr%recruitment_rate(ft) + temp_cohort%n endif enddo !pft loop diff --git a/components/clm/src/ED/main/EDInitMod.F90 b/components/clm/src/ED/main/EDInitMod.F90 index 5357622447..082942fca9 100755 --- a/components/clm/src/ED/main/EDInitMod.F90 +++ b/components/clm/src/ED/main/EDInitMod.F90 @@ -79,8 +79,9 @@ subroutine zero_site( site_in ) site_in%fates_to_bgc_this_ts = 0.0_r8 site_in%fates_to_bgc_last_ts = 0.0_r8 - ! termination info + ! termination and recruitment info site_in%terminated_nindivs(:) = 0._r8 + site_in%recruitment_rate(:) = 0._r8 end subroutine zero_site diff --git a/components/clm/src/ED/main/EDTypesMod.F90 b/components/clm/src/ED/main/EDTypesMod.F90 index 19b2cf63f6..400ae2bb3c 100755 --- a/components/clm/src/ED/main/EDTypesMod.F90 +++ b/components/clm/src/ED/main/EDTypesMod.F90 @@ -67,7 +67,7 @@ module EDTypesMod integer , parameter :: N_DBH_BINS = 5 ! no. of dbh bins used when comparing patches - real(r8), parameter :: min_npm2 = 1.0d-5 ! minimum cohort number density per m2 before termination + real(r8), parameter :: min_npm2 = 1.0d-5 ! minimum cohort number density per m2 before termintion real(r8), parameter :: min_patch_area = 0.001_r8 ! smallest allowable patch area before termination real(r8), parameter :: min_nppatch = 1.0d-8 ! minimum number of cohorts per patch (min_npm2*min_patch_area) real(r8), parameter :: min_n_safemath = 1.0d-15 ! in some cases, we want to immediately remove super small @@ -558,8 +558,9 @@ module EDTypesMod real(r8) :: cwd_ag_burned(ncwd) real(r8) :: leaf_litter_burned(numpft_ed) - ! TERMINATION + ! TERMINATION AND RECRUITMENT real(r8) :: terminated_nindivs(1:nlevsclass_ed*mxpft) ! number of individuals that were in cohorts which were terminated this timestep on scpf array + real(r8) :: recruitment_rate(1:mxpft) ! number of individuals that were recruited into new cohorts end type ed_site_type diff --git a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 index 8735697bee..144178c59f 100644 --- a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 +++ b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 @@ -145,6 +145,7 @@ module FatesHistoryInterfaceMod integer, private :: ih_leafbiomass_si_pft integer, private :: ih_storebiomass_si_pft integer, private :: ih_nindivs_si_pft + integer, private :: ih_recruitment_si_pft ! indices to (site x patch-age) variables @@ -750,7 +751,7 @@ subroutine update_history_dyn(this,nc,nsites,sites) integer :: lb1,ub1,lb2,ub2 ! IO array bounds for the calling thread integer :: ivar ! index of IO variable object vector integer :: ft ! functional type index - integer :: i_scpf ! iterator for scpf dim + integer :: i_scpf,i_pft ! iterators for scpf and pft dims real(r8) :: n_density ! individual of cohort per m2. real(r8) :: n_perm2 ! individuals per m2 for the whole column @@ -775,6 +776,7 @@ subroutine update_history_dyn(this,nc,nsites,sites) hio_leafbiomass_si_pft => this%hvars(ih_leafbiomass_si_pft)%r82d, & hio_storebiomass_si_pft => this%hvars(ih_storebiomass_si_pft)%r82d, & hio_nindivs_si_pft => this%hvars(ih_nindivs_si_pft)%r82d, & + hio_recruitment_si_pft => this%hvars(ih_recruitment_si_pft)%r82d, & hio_nesterov_fire_danger_pa => this%hvars(ih_nesterov_fire_danger_pa)%r81d, & hio_spitfire_ros_pa => this%hvars(ih_spitfire_ROS_pa)%r81d, & hio_tfc_ros_pa => this%hvars(ih_TFC_ROS_pa)%r81d, & @@ -1114,6 +1116,12 @@ subroutine update_history_dyn(this,nc,nsites,sites) hio_m6_si_scpf(io_si,i_scpf) = sites(s)%terminated_nindivs(i_scpf) * yeardays end do sites(s)%terminated_nindivs(:) = 0._r8 + + ! pass the recruitment rate as a flux to the history, and then reset the recruitment buffer + do i_pft = 1, mxpft + hio_recruitment_si_pft(io_si,i_pft) = sites(s)%recruitment_rate(i_pft) * yeardays + end do + sites(s)%recruitment_rate(:) = 0._r8 enddo ! site loop @@ -1443,6 +1451,11 @@ subroutine define_history_vars(this, initialize_variables) avgflag='A', vtype=site_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, upfreq=1, & ivar=ivar, initialize=initialize_variables, index = ih_nindivs_si_pft ) + call this%set_history_var(vname='RECRUITMENT', units='indiv/ha/yr', & + long='Rate of recruitment by PFT', use_default='active', & + avgflag='A', vtype=site_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, upfreq=1, & + ivar=ivar, initialize=initialize_variables, index = ih_recruitment_si_pft ) + ! patch age class variables call this%set_history_var(vname='PATCH_AREA_BY_AGE', units='m2/m2', & long='patch area by age bin', use_default='active', & From f2d8da8d473cfdcda79192fbd996e4f0c05770ef Mon Sep 17 00:00:00 2001 From: ckoven Date: Thu, 9 Feb 2017 15:06:25 -0800 Subject: [PATCH 07/21] cleanup, new default-on scls summary vars, and aggregation of canopy/understory scpf mortality rates --- .../src/ED/biogeochem/EDCohortDynamicsMod.F90 | 10 +- components/clm/src/ED/main/EDInitMod.F90 | 2 +- components/clm/src/ED/main/EDTypesMod.F90 | 6 +- .../src/ED/main/FatesHistoryInterfaceMod.F90 | 127 ++++++++++++++---- 4 files changed, 112 insertions(+), 33 deletions(-) diff --git a/components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 b/components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 index 79da24d337..edbfdd34ea 100755 --- a/components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 +++ b/components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 @@ -498,6 +498,7 @@ subroutine terminate_cohorts( patchptr ) type (ed_cohort_type) , pointer :: nextc integer :: terminate ! do we terminate (1) or not (0) integer :: c ! counter for litter size class. + integer :: levcan ! canopy level !---------------------------------------------------------------------- currentPatch => patchptr @@ -560,8 +561,13 @@ subroutine terminate_cohorts( patchptr ) if (terminate == 1) then ! preserve a record of the to-be-terminated cohort for mortality accounting - currentPatch%siteptr%terminated_nindivs(currentCohort%size_by_pft_class) = & - currentPatch%siteptr%terminated_nindivs(currentCohort%size_by_pft_class) + currentCohort%n + if (currentCohort%canopy_layer .eq. 1) then + levcan = 1 + else + levcan = 2 + endif + currentPatch%siteptr%terminated_nindivs(currentCohort%size_class,currentCohort%pft,levcan) = & + currentPatch%siteptr%terminated_nindivs(currentCohort%size_class,currentCohort%pft,levcan) + currentCohort%n if (.not. associated(currentCohort%taller)) then currentPatch%tallest => currentCohort%shorter diff --git a/components/clm/src/ED/main/EDInitMod.F90 b/components/clm/src/ED/main/EDInitMod.F90 index 082942fca9..a9b9a98736 100755 --- a/components/clm/src/ED/main/EDInitMod.F90 +++ b/components/clm/src/ED/main/EDInitMod.F90 @@ -80,7 +80,7 @@ subroutine zero_site( site_in ) site_in%fates_to_bgc_last_ts = 0.0_r8 ! termination and recruitment info - site_in%terminated_nindivs(:) = 0._r8 + site_in%terminated_nindivs(:,:,:) = 0._r8 site_in%recruitment_rate(:) = 0._r8 end subroutine zero_site diff --git a/components/clm/src/ED/main/EDTypesMod.F90 b/components/clm/src/ED/main/EDTypesMod.F90 index 400ae2bb3c..48eeb96c5a 100755 --- a/components/clm/src/ED/main/EDTypesMod.F90 +++ b/components/clm/src/ED/main/EDTypesMod.F90 @@ -67,7 +67,7 @@ module EDTypesMod integer , parameter :: N_DBH_BINS = 5 ! no. of dbh bins used when comparing patches - real(r8), parameter :: min_npm2 = 1.0d-5 ! minimum cohort number density per m2 before termintion + real(r8), parameter :: min_npm2 = 1.0d-5 ! minimum cohort number density per m2 before termination real(r8), parameter :: min_patch_area = 0.001_r8 ! smallest allowable patch area before termination real(r8), parameter :: min_nppatch = 1.0d-8 ! minimum number of cohorts per patch (min_npm2*min_patch_area) real(r8), parameter :: min_n_safemath = 1.0d-15 ! in some cases, we want to immediately remove super small @@ -558,8 +558,8 @@ module EDTypesMod real(r8) :: cwd_ag_burned(ncwd) real(r8) :: leaf_litter_burned(numpft_ed) - ! TERMINATION AND RECRUITMENT - real(r8) :: terminated_nindivs(1:nlevsclass_ed*mxpft) ! number of individuals that were in cohorts which were terminated this timestep on scpf array + ! TERMINATION AND RECRUITMENT~ + real(r8) :: terminated_nindivs(1:nlevsclass_ed,1:mxpft,2) ! number of individuals that were in cohorts which were terminated this timestep, on size x pft x canopy array. real(r8) :: recruitment_rate(1:mxpft) ! number of individuals that were recruited into new cohorts end type ed_site_type diff --git a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 index 144178c59f..8c8702e746 100644 --- a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 +++ b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 @@ -109,8 +109,8 @@ module FatesHistoryInterfaceMod integer, private :: ih_bstor_understory_si_scpf integer, private :: ih_bleaf_canopy_si_scpf integer, private :: ih_bleaf_understory_si_scpf - integer, private :: ih_m3_canopy_si_scpf - integer, private :: ih_m3_understory_si_scpf + integer, private :: ih_mortality_canopy_si_scpf + integer, private :: ih_mortality_understory_si_scpf integer, private :: ih_nplant_canopy_si_scpf integer, private :: ih_nplant_understory_si_scpf integer, private :: ih_ddbh_canopy_si_scpf @@ -139,6 +139,10 @@ module FatesHistoryInterfaceMod ! indices to (site x scls) variables integer, private :: ih_ba_si_scls + integer, private :: ih_nplant_canopy_si_scls + integer, private :: ih_nplant_understory_si_scls + integer, private :: ih_mortality_canopy_si_scls + integer, private :: ih_mortality_understory_si_scls ! indices to (site x pft) variables integer, private :: ih_biomass_si_pft @@ -146,6 +150,7 @@ module FatesHistoryInterfaceMod integer, private :: ih_storebiomass_si_pft integer, private :: ih_nindivs_si_pft integer, private :: ih_recruitment_si_pft + integer, private :: ih_mortality_si_pft ! indices to (site x patch-age) variables @@ -751,7 +756,7 @@ subroutine update_history_dyn(this,nc,nsites,sites) integer :: lb1,ub1,lb2,ub2 ! IO array bounds for the calling thread integer :: ivar ! index of IO variable object vector integer :: ft ! functional type index - integer :: i_scpf,i_pft ! iterators for scpf and pft dims + integer :: i_scpf,i_pft,i_scls ! iterators for scpf, pft, and scls dims real(r8) :: n_density ! individual of cohort per m2. real(r8) :: n_perm2 ! individuals per m2 for the whole column @@ -777,6 +782,7 @@ subroutine update_history_dyn(this,nc,nsites,sites) hio_storebiomass_si_pft => this%hvars(ih_storebiomass_si_pft)%r82d, & hio_nindivs_si_pft => this%hvars(ih_nindivs_si_pft)%r82d, & hio_recruitment_si_pft => this%hvars(ih_recruitment_si_pft)%r82d, & + hio_mortality_si_pft => this%hvars(ih_mortality_si_pft)%r82d, & hio_nesterov_fire_danger_pa => this%hvars(ih_nesterov_fire_danger_pa)%r81d, & hio_spitfire_ros_pa => this%hvars(ih_spitfire_ROS_pa)%r81d, & hio_tfc_ros_pa => this%hvars(ih_TFC_ROS_pa)%r81d, & @@ -814,8 +820,8 @@ subroutine update_history_dyn(this,nc,nsites,sites) hio_bstor_understory_si_scpf => this%hvars(ih_bstor_understory_si_scpf)%r82d, & hio_bleaf_canopy_si_scpf => this%hvars(ih_bleaf_canopy_si_scpf)%r82d, & hio_bleaf_understory_si_scpf => this%hvars(ih_bleaf_understory_si_scpf)%r82d, & - hio_m3_canopy_si_scpf => this%hvars(ih_m3_canopy_si_scpf)%r82d, & - hio_m3_understory_si_scpf => this%hvars(ih_m3_understory_si_scpf)%r82d, & + hio_mortality_canopy_si_scpf => this%hvars(ih_mortality_canopy_si_scpf)%r82d, & + hio_mortality_understory_si_scpf => this%hvars(ih_mortality_understory_si_scpf)%r82d, & hio_nplant_canopy_si_scpf => this%hvars(ih_nplant_canopy_si_scpf)%r82d, & 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, & @@ -834,6 +840,10 @@ subroutine update_history_dyn(this,nc,nsites,sites) hio_m5_si_scpf => this%hvars(ih_m5_si_scpf)%r82d, & hio_m6_si_scpf => this%hvars(ih_m6_si_scpf)%r82d, & hio_ba_si_scls => this%hvars(ih_ba_si_scls)%r82d, & + hio_nplant_canopy_si_scls => this%hvars(ih_nplant_canopy_si_scls)%r82d, & + hio_nplant_understory_si_scls => this%hvars(ih_nplant_understory_si_scls)%r82d, & + hio_mortality_canopy_si_scls => this%hvars(ih_mortality_canopy_si_scls)%r82d, & + hio_mortality_understory_si_scls => this%hvars(ih_mortality_understory_si_scls)%r82d, & hio_area_si_age => this%hvars(ih_area_si_age)%r82d, & hio_lai_si_age => this%hvars(ih_lai_si_age)%r82d, & hio_canopy_area_si_age => this%hvars(ih_canopy_area_si_age)%r82d, & @@ -1018,14 +1028,16 @@ subroutine update_history_dyn(this,nc,nsites,sites) ccohort%ddbhdt*n_perm2*AREA end if - ! update SCPF- and canopy/subcanopy- partitioned quantities + ! update SCPF/SCLS- and canopy/subcanopy- partitioned quantities if (ccohort%canopy_layer .eq. 1) then hio_bstor_canopy_si_scpf(io_si,scpf) = hio_bstor_canopy_si_scpf(io_si,scpf) + & ccohort%bstore * n_perm2 * AREA hio_bleaf_canopy_si_scpf(io_si,scpf) = hio_bleaf_canopy_si_scpf(io_si,scpf) + & ccohort%bl * n_perm2 * AREA - hio_m3_canopy_si_scpf(io_si,scpf) = hio_m3_canopy_si_scpf(io_si,scpf) + ccohort%cmort*n_perm2*AREA + 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) * n_perm2*AREA hio_nplant_canopy_si_scpf(io_si,scpf) = hio_nplant_canopy_si_scpf(io_si,scpf) + AREA*n_perm2 + hio_nplant_canopy_si_scls(io_si,scls) = hio_nplant_canopy_si_scls(io_si,scls) + AREA*n_perm2 hio_gpp_canopy_si_scpf(io_si,scpf) = hio_gpp_canopy_si_scpf(io_si,scpf) + & n_perm2*ccohort%gpp_acc_hold hio_ar_canopy_si_scpf(io_si,scpf) = hio_ar_canopy_si_scpf(io_si,scpf) + & @@ -1033,13 +1045,18 @@ 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*n_perm2*AREA + ! 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) * n_perm2*AREA else hio_bstor_understory_si_scpf(io_si,scpf) = hio_bstor_understory_si_scpf(io_si,scpf) + & ccohort%bstore * n_perm2 * AREA hio_bleaf_understory_si_scpf(io_si,scpf) = hio_bleaf_understory_si_scpf(io_si,scpf) + & ccohort%bl * n_perm2 * AREA - hio_m3_understory_si_scpf(io_si,scpf) = hio_m3_understory_si_scpf(io_si,scpf) + ccohort%cmort*n_perm2*AREA + 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) * n_perm2*AREA hio_nplant_understory_si_scpf(io_si,scpf) = hio_nplant_understory_si_scpf(io_si,scpf) + AREA*n_perm2 + hio_nplant_understory_si_scls(io_si,scls) = hio_nplant_understory_si_scls(io_si,scls) + AREA*n_perm2 hio_gpp_understory_si_scpf(io_si,scpf) = hio_gpp_understory_si_scpf(io_si,scpf) + & n_perm2*ccohort%gpp_acc_hold hio_ar_understory_si_scpf(io_si,scpf) = hio_ar_understory_si_scpf(io_si,scpf) + & @@ -1047,6 +1064,9 @@ 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*n_perm2*AREA + ! 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) * n_perm2*AREA endif end associate @@ -1112,16 +1132,43 @@ subroutine update_history_dyn(this,nc,nsites,sites) end do ! pass the cohort termination mortality as a flux to the history, and then reset the termination mortality buffer - do i_scpf = 1, nlevsclass_ed * mxpft - hio_m6_si_scpf(io_si,i_scpf) = sites(s)%terminated_nindivs(i_scpf) * yeardays + ! note there are various ways of reporting the total mortality, so pass to these as well + do i_pft = 1, mxpft + do i_scls = 1,nlevsclass_ed + hio_m6_si_scpf(io_si,(i_pft-1)*nlevsclass_ed + i_scls) = (sites(s)%terminated_nindivs(i_pft,i_scls,1) + & + sites(s)%terminated_nindivs(i_scls,i_pft,2)) * yeardays + hio_mortality_canopy_si_scls(io_si,i_pft) = hio_mortality_canopy_si_scls(io_si,i_pft) + & + sites(s)%terminated_nindivs(i_scls,i_pft,1) * yeardays + hio_mortality_understory_si_scls(io_si,i_pft) = hio_mortality_understory_si_scls(io_si,i_pft) + & + sites(s)%terminated_nindivs(i_scls,i_pft,2) * yeardays + hio_mortality_canopy_si_scpf(io_si,(i_pft-1)*nlevsclass_ed + i_scls) = & + hio_mortality_canopy_si_scpf(io_si,(i_pft-1)*nlevsclass_ed + i_scls) + & + sites(s)%terminated_nindivs(i_scls,i_pft,1) * yeardays + hio_mortality_understory_si_scpf(io_si,(i_pft-1)*nlevsclass_ed + i_scls) = & + hio_mortality_understory_si_scpf(io_si,(i_pft-1)*nlevsclass_ed + i_scls) + & + sites(s)%terminated_nindivs(i_scls,i_pft,2) * yeardays + end do end do - sites(s)%terminated_nindivs(:) = 0._r8 + sites(s)%terminated_nindivs(:,:,:) = 0._r8 ! pass the recruitment rate as a flux to the history, and then reset the recruitment buffer do i_pft = 1, mxpft hio_recruitment_si_pft(io_si,i_pft) = sites(s)%recruitment_rate(i_pft) * yeardays end do sites(s)%recruitment_rate(:) = 0._r8 + + ! summarize all of the mortality fluxes by PFT + do i_pft = 1, mxpft + do i_scls = 1,nlevsclass_ed + hio_mortality_si_pft(io_si,i_pft) = hio_mortality_si_pft(io_si,i_pft) + & + hio_m1_si_scpf(io_si,(i_pft-1)*nlevsclass_ed + i_scls) + & + hio_m2_si_scpf(io_si,(i_pft-1)*nlevsclass_ed + i_scls) + & + hio_m3_si_scpf(io_si,(i_pft-1)*nlevsclass_ed + i_scls) + & + hio_m4_si_scpf(io_si,(i_pft-1)*nlevsclass_ed + i_scls) + & + hio_m5_si_scpf(io_si,(i_pft-1)*nlevsclass_ed + i_scls) + & + hio_m6_si_scpf(io_si,(i_pft-1)*nlevsclass_ed + i_scls) + end do + end do enddo ! site loop @@ -1456,6 +1503,11 @@ subroutine define_history_vars(this, initialize_variables) avgflag='A', vtype=site_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, upfreq=1, & ivar=ivar, initialize=initialize_variables, index = ih_recruitment_si_pft ) + call this%set_history_var(vname='MORTALITY', units='indiv/ha/yr', & + long='Rate of total mortality by PFT', use_default='active', & + avgflag='A', vtype=site_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, upfreq=1, & + ivar=ivar, initialize=initialize_variables, index = ih_mortality_si_pft ) + ! patch age class variables call this%set_history_var(vname='PATCH_AREA_BY_AGE', units='m2/m2', & long='patch area by age bin', use_default='active', & @@ -1770,47 +1822,47 @@ subroutine define_history_vars(this, initialize_variables) upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_nplant_si_scpf ) call this%set_history_var(vname='M1_SCPF', units = 'N/ha/yr', & - long='background mortality count by patch and pft/size', use_default='inactive', & + long='background mortality by patch and pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_m1_si_scpf ) call this%set_history_var(vname='M2_SCPF', units = 'N/ha/yr', & - long='hydraulic mortality count by patch and pft/size',use_default='inactive', & + long='hydraulic mortality by patch and pft/size',use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_m2_si_scpf ) call this%set_history_var(vname='M3_SCPF', units = 'N/ha/yr', & - long='carbon starvation mortality count by patch and pft/size', use_default='inactive', & + long='carbon starvation mortality by patch and pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_m3_si_scpf ) call this%set_history_var(vname='M4_SCPF', units = 'N/ha/yr', & - long='impact mortality count by patch and pft/size',use_default='inactive', & + long='impact mortality by patch and pft/size',use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_m4_si_scpf ) call this%set_history_var(vname='M5_SCPF', units = 'N/ha/yr', & - long='fire mortality count by patch and pft/size',use_default='inactive', & + long='fire mortality by patch and pft/size',use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_m5_si_scpf ) call this%set_history_var(vname='M6_SCPF', units = 'N/ha/yr', & - long='termination mortality count by patch and pft/size',use_default='inactive', & + long='termination mortality by patch and pft/size',use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_m6_si_scpf ) - call this%set_history_var(vname='M3_CANOPY_SCPF', units = 'N/ha/yr', & - long='carbon starvation mortality of canopy plants count by patch and pft/size', use_default='inactive', & + call this%set_history_var(vname='MORTALITY_CANOPY_SCPF', units = 'N/ha/yr', & + long='total mortality of canopy plants by patch and pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & - upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_m3_canopy_si_scpf ) + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_mortality_canopy_si_scpf ) call this%set_history_var(vname='BSTOR_CANOPY_SCPF', units = 'kgC/ha', & - long='biomass carbon in storage pools of canopy plants count by patch and pft/size', use_default='inactive', & + long='biomass carbon in storage pools of canopy plants by patch and pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_bstor_canopy_si_scpf ) call this%set_history_var(vname='BLEAF_CANOPY_SCPF', units = 'kgC/ha', & - long='biomass carbon in leaf of canopy plants count by patch and pft/size', use_default='inactive', & + long='biomass carbon in leaf of canopy plants by patch and pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_bleaf_canopy_si_scpf ) @@ -1819,18 +1871,18 @@ subroutine define_history_vars(this, initialize_variables) avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_nplant_canopy_si_scpf ) - call this%set_history_var(vname='M3_UNDERSTORY_SCPF', units = 'N/ha/yr', & - long='carbon starvation mortality of understory plants count by patch and pft/size', use_default='inactive', & + call this%set_history_var(vname='MORTALITY_UNDERSTORY_SCPF', units = 'N/ha/yr', & + long='total mortality of understory plants by patch and pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & - upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_m3_understory_si_scpf ) + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_mortality_understory_si_scpf ) call this%set_history_var(vname='BSTOR_UNDERSTORY_SCPF', units = 'kgC/ha', & - long='biomass carbon in storage pools of understory plants count by patch and pft/size', use_default='inactive', & + long='biomass carbon in storage pools of understory plants by patch and pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_bstor_understory_si_scpf ) call this%set_history_var(vname='BLEAF_UNDERSTORY_SCPF', units = 'kgC/ha', & - long='biomass carbon in leaf of understory plants count by patch and pft/size', use_default='inactive', & + long='biomass carbon in leaf of understory plants by patch and pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_bleaf_understory_si_scpf ) @@ -1883,6 +1935,27 @@ subroutine define_history_vars(this, initialize_variables) avgflag='A', vtype=site_size_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_ba_si_scls ) + call this%set_history_var(vname='NPLANT_CANOPY_SCLS', units = 'indiv/ha', & + long='number of canopy plants by size class', use_default='active', & + avgflag='A', vtype=site_size_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_nplant_canopy_si_scls ) + + call this%set_history_var(vname='MORTALITY_CANOPY_SCLS', units = 'indiv/ha/yr', & + long='total mortality of canopy trees by size class', use_default='active', & + avgflag='A', vtype=site_size_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_mortality_canopy_si_scls ) + + call this%set_history_var(vname='NPLANT_UNDERSTORY_SCLS', units = 'indiv/ha', & + long='number of understory plants by size class', use_default='active', & + avgflag='A', vtype=site_size_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_nplant_understory_si_scls ) + + call this%set_history_var(vname='MORTALITY_UNDERSTORY_SCLS', units = 'indiv/ha/yr', & + long='total mortality of understory trees by size class', use_default='active', & + avgflag='A', vtype=site_size_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_mortality_understory_si_scls ) + + ! CARBON BALANCE VARIABLES THAT DEPEND ON HLM BGC INPUTS call this%set_history_var(vname='NEP', units='gC/m^2/s', & From eb9902db4159cccf22e84fea09ec68078830b5e4 Mon Sep 17 00:00:00 2001 From: ckoven Date: Thu, 9 Feb 2017 16:04:02 -0800 Subject: [PATCH 08/21] turned off seed homogenization --- components/clm/src/ED/main/EDTypesMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/clm/src/ED/main/EDTypesMod.F90 b/components/clm/src/ED/main/EDTypesMod.F90 index 48eeb96c5a..79386f3e8c 100755 --- a/components/clm/src/ED/main/EDTypesMod.F90 +++ b/components/clm/src/ED/main/EDTypesMod.F90 @@ -77,7 +77,7 @@ module EDTypesMod character*4 yearchar ! special mode to cause PFTs to create seed mass of all currently-existing PFTs - logical, parameter :: homogenize_seed_pfts = .true. + logical, parameter :: homogenize_seed_pfts = .false. !the lower limit of the size classes of ED cohorts !0-10,10-20... From f0ef3088cca4ac12ee1f18f94fb00998eaaa2213 Mon Sep 17 00:00:00 2001 From: ckoven Date: Thu, 9 Feb 2017 19:41:32 -0800 Subject: [PATCH 09/21] indexing bugfix --- .../src/ED/main/FatesHistoryInterfaceMod.F90 | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 index 8c8702e746..b2634f1381 100644 --- a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 +++ b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 @@ -1135,17 +1135,16 @@ subroutine update_history_dyn(this,nc,nsites,sites) ! note there are various ways of reporting the total mortality, so pass to these as well do i_pft = 1, mxpft do i_scls = 1,nlevsclass_ed - hio_m6_si_scpf(io_si,(i_pft-1)*nlevsclass_ed + i_scls) = (sites(s)%terminated_nindivs(i_pft,i_scls,1) + & + i_scpf = (i_pft-1)*nlevsclass_ed + i_scls + hio_m6_si_scpf(io_si,i_scpf) = (sites(s)%terminated_nindivs(i_pft,i_scls,1) + & sites(s)%terminated_nindivs(i_scls,i_pft,2)) * yeardays - hio_mortality_canopy_si_scls(io_si,i_pft) = hio_mortality_canopy_si_scls(io_si,i_pft) + & + hio_mortality_canopy_si_scls(io_si,i_scls) = hio_mortality_canopy_si_scls(io_si,i_scls) + & sites(s)%terminated_nindivs(i_scls,i_pft,1) * yeardays - hio_mortality_understory_si_scls(io_si,i_pft) = hio_mortality_understory_si_scls(io_si,i_pft) + & + hio_mortality_understory_si_scls(io_si,i_scls) = hio_mortality_understory_si_scls(io_si,i_scls) + & sites(s)%terminated_nindivs(i_scls,i_pft,2) * yeardays - hio_mortality_canopy_si_scpf(io_si,(i_pft-1)*nlevsclass_ed + i_scls) = & - hio_mortality_canopy_si_scpf(io_si,(i_pft-1)*nlevsclass_ed + i_scls) + & + hio_mortality_canopy_si_scpf(io_si,i_scpf) = hio_mortality_canopy_si_scpf(io_si,i_scpf) + & sites(s)%terminated_nindivs(i_scls,i_pft,1) * yeardays - hio_mortality_understory_si_scpf(io_si,(i_pft-1)*nlevsclass_ed + i_scls) = & - hio_mortality_understory_si_scpf(io_si,(i_pft-1)*nlevsclass_ed + i_scls) + & + hio_mortality_understory_si_scpf(io_si,i_scpf) = hio_mortality_understory_si_scpf(io_si,i_scpf) + & sites(s)%terminated_nindivs(i_scls,i_pft,2) * yeardays end do end do @@ -1160,13 +1159,14 @@ subroutine update_history_dyn(this,nc,nsites,sites) ! summarize all of the mortality fluxes by PFT do i_pft = 1, mxpft do i_scls = 1,nlevsclass_ed + i_scpf = (i_pft-1)*nlevsclass_ed + i_scls hio_mortality_si_pft(io_si,i_pft) = hio_mortality_si_pft(io_si,i_pft) + & - hio_m1_si_scpf(io_si,(i_pft-1)*nlevsclass_ed + i_scls) + & - hio_m2_si_scpf(io_si,(i_pft-1)*nlevsclass_ed + i_scls) + & - hio_m3_si_scpf(io_si,(i_pft-1)*nlevsclass_ed + i_scls) + & - hio_m4_si_scpf(io_si,(i_pft-1)*nlevsclass_ed + i_scls) + & - hio_m5_si_scpf(io_si,(i_pft-1)*nlevsclass_ed + i_scls) + & - hio_m6_si_scpf(io_si,(i_pft-1)*nlevsclass_ed + i_scls) + hio_m1_si_scpf(io_si,i_scpf) + & + hio_m2_si_scpf(io_si,i_scpf) + & + hio_m3_si_scpf(io_si,i_scpf) + & + hio_m4_si_scpf(io_si,i_scpf) + & + hio_m5_si_scpf(io_si,i_scpf) + & + hio_m6_si_scpf(io_si,i_scpf) end do end do From a5292d69b367211ef1cf50849787b45813f41545 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Tue, 14 Feb 2017 10:41:43 -0800 Subject: [PATCH 10/21] Fixed some long-names in SCPF type history variables. --- .../src/ED/main/FatesHistoryInterfaceMod.F90 | 80 +++++++++---------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 index b2634f1381..d26cc82ffa 100644 --- a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 +++ b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 @@ -1726,168 +1726,168 @@ subroutine define_history_vars(this, initialize_variables) ! =================================================================================== call this%set_history_var(vname='GPP_SCPF', units='kgC/m2/yr', & - long='gross primary production', use_default='inactive', & + long='gross primary production by pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_gpp_si_scpf ) call this%set_history_var(vname='GPP_CANOPY_SCPF', units='kgC/m2/yr', & - long='gross primary production of canopy plants', use_default='inactive', & + long='gross primary production of canopy plants by pft/size ', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_gpp_canopy_si_scpf ) call this%set_history_var(vname='AR_CANOPY_SCPF', units='kgC/m2/yr', & - long='autotrophic respiration of canopy plants', use_default='inactive', & + long='autotrophic respiration of canopy plants by pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_ar_canopy_si_scpf ) call this%set_history_var(vname='GPP_UNDERSTORY_SCPF', units='kgC/m2/yr', & - long='gross primary production of understory plants', use_default='inactive', & + long='gross primary production of understory plants by pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_gpp_understory_si_scpf ) call this%set_history_var(vname='AR_UNDERSTORY_SCPF', units='kgC/m2/yr', & - long='autotrophic respiration of understory plants', use_default='inactive', & + long='autotrophic respiration of understory plants by pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_ar_understory_si_scpf ) call this%set_history_var(vname='NPP_SCPF', units='kgC/m2/yr', & - long='total net primary production', use_default='inactive', & + long='total net primary production by pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_npp_totl_si_scpf ) call this%set_history_var(vname='NPP_LEAF_SCPF', units='kgC/m2/yr', & - long='NPP flux into leaves', use_default='inactive', & + long='NPP flux into leaves by pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_npp_leaf_si_scpf ) call this%set_history_var(vname='NPP_SEED_SCPF', units='kgC/m2/yr', & - long='NPP flux into seeds', use_default='inactive', & + long='NPP flux into seeds by pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_npp_seed_si_scpf ) call this%set_history_var(vname='NPP_FNRT_SCPF', units='kgC/m2/yr', & - long='NPP flux into fine roots', use_default='inactive', & + long='NPP flux into fine roots by pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_npp_fnrt_si_scpf ) call this%set_history_var(vname='NPP_BGSW_SCPF', units='kgC/m2/yr', & - long='NPP flux into below-ground sapwood', use_default='inactive', & + long='NPP flux into below-ground sapwood by pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_npp_bgsw_si_scpf ) call this%set_history_var(vname='NPP_BGDW_SCPF', units='kgC/m2/yr', & - long='NPP flux into below-ground deadwood', use_default='inactive', & + long='NPP flux into below-ground deadwood by pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_npp_bgdw_si_scpf ) call this%set_history_var(vname='NPP_AGSW_SCPF', units='kgC/m2/yr', & - long='NPP flux into above-ground sapwood', use_default='inactive', & + long='NPP flux into above-ground sapwood by pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_npp_agsw_si_scpf ) call this%set_history_var(vname = 'NPP_AGDW_SCPF', units='kgC/m2/yr', & - long='NPP flux into above-ground deadwood', use_default='inactive', & + long='NPP flux into above-ground deadwood by pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_npp_agdw_si_scpf ) call this%set_history_var(vname = 'NPP_STOR_SCPF', units='kgC/m2/yr', & - long='NPP flux into storage', use_default='inactive', & + long='NPP flux into storage by pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_npp_stor_si_scpf ) call this%set_history_var(vname='DDBH_SCPF', units = 'cm/yr/ha', & - long='diameter growth increment and pft/size',use_default='inactive', & + long='diameter growth increment by pft/size',use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_ddbh_si_scpf ) call this%set_history_var(vname='DDBH_CANOPY_SCPF', units = 'cm/yr/ha', & - long='diameter growth increment and pft/size',use_default='inactive', & + long='diameter growth increment by pft/size',use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_ddbh_canopy_si_scpf ) call this%set_history_var(vname='DDBH_UNDERSTORY_SCPF', units = 'cm/yr/ha', & - long='diameter growth increment and pft/size',use_default='inactive', & + long='diameter growth increment by pft/size',use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_ddbh_understory_si_scpf ) call this%set_history_var(vname='BA_SCPF', units = 'm2/ha', & - long='basal area by patch and pft/size', use_default='inactive', & + long='basal area by pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_ba_si_scpf ) call this%set_history_var(vname='NPLANT_SCPF', units = 'N/ha', & - long='stem number density by patch and pft/size', use_default='inactive', & + long='stem number density by pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_nplant_si_scpf ) call this%set_history_var(vname='M1_SCPF', units = 'N/ha/yr', & - long='background mortality by patch and pft/size', use_default='inactive', & + long='background mortality by pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_m1_si_scpf ) call this%set_history_var(vname='M2_SCPF', units = 'N/ha/yr', & - long='hydraulic mortality by patch and pft/size',use_default='inactive', & + long='hydraulic mortality by pft/size',use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_m2_si_scpf ) call this%set_history_var(vname='M3_SCPF', units = 'N/ha/yr', & - long='carbon starvation mortality by patch and pft/size', use_default='inactive', & + long='carbon starvation mortality by pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_m3_si_scpf ) call this%set_history_var(vname='M4_SCPF', units = 'N/ha/yr', & - long='impact mortality by patch and pft/size',use_default='inactive', & + long='impact mortality by pft/size',use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_m4_si_scpf ) call this%set_history_var(vname='M5_SCPF', units = 'N/ha/yr', & - long='fire mortality by patch and pft/size',use_default='inactive', & + long='fire mortality by pft/size',use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_m5_si_scpf ) call this%set_history_var(vname='M6_SCPF', units = 'N/ha/yr', & - long='termination mortality by patch and pft/size',use_default='inactive', & + long='termination mortality by pft/size',use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_m6_si_scpf ) call this%set_history_var(vname='MORTALITY_CANOPY_SCPF', units = 'N/ha/yr', & - long='total mortality of canopy plants by patch and pft/size', use_default='inactive', & + long='total mortality of canopy plants by pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_mortality_canopy_si_scpf ) call this%set_history_var(vname='BSTOR_CANOPY_SCPF', units = 'kgC/ha', & - long='biomass carbon in storage pools of canopy plants by patch and pft/size', use_default='inactive', & + long='biomass carbon in storage pools of canopy plants by pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_bstor_canopy_si_scpf ) call this%set_history_var(vname='BLEAF_CANOPY_SCPF', units = 'kgC/ha', & - long='biomass carbon in leaf of canopy plants by patch and pft/size', use_default='inactive', & + long='biomass carbon in leaf of canopy plants by pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_bleaf_canopy_si_scpf ) call this%set_history_var(vname='NPLANT_CANOPY_SCPF', units = 'N/ha', & - long='stem number of canopy plants density by patch and pft/size', use_default='inactive', & + long='stem number of canopy plants density by pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_nplant_canopy_si_scpf ) call this%set_history_var(vname='MORTALITY_UNDERSTORY_SCPF', units = 'N/ha/yr', & - long='total mortality of understory plants by patch and pft/size', use_default='inactive', & + long='total mortality of understory plants by pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_mortality_understory_si_scpf ) call this%set_history_var(vname='BSTOR_UNDERSTORY_SCPF', units = 'kgC/ha', & - long='biomass carbon in storage pools of understory plants by patch and pft/size', use_default='inactive', & + long='biomass carbon in storage pools of understory plants by pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_bstor_understory_si_scpf ) call this%set_history_var(vname='BLEAF_UNDERSTORY_SCPF', units = 'kgC/ha', & - long='biomass carbon in leaf of understory plants by patch and pft/size', use_default='inactive', & + long='biomass carbon in leaf of understory plants by pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_bleaf_understory_si_scpf ) call this%set_history_var(vname='NPLANT_UNDERSTORY_SCPF', units = 'N/ha', & - long='stem number of understory plants density by patch and pft/size', use_default='inactive', & + long='stem number of understory plants density by pft/size', use_default='inactive', & avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_nplant_understory_si_scpf ) @@ -1895,37 +1895,37 @@ subroutine define_history_vars(this, initialize_variables) ! Size structured diagnostics that require rapid updates (upfreq=2) call this%set_history_var(vname='AR_SCPF',units = 'kgC/m2/yr', & - long='total autotrophic respiration per m2 per year',use_default='inactive',& + long='total autotrophic respiration per m2 per year by pft/size',use_default='inactive',& avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=2, ivar=ivar, initialize=initialize_variables, index = ih_ar_si_scpf ) call this%set_history_var(vname='AR_GROW_SCPF',units = 'kgC/m2/yr', & - long='growth autotrophic respiration per m2 per year',use_default='inactive',& + long='growth autotrophic respiration per m2 per year by pft/size',use_default='inactive',& avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=2, ivar=ivar, initialize=initialize_variables, index = ih_ar_grow_si_scpf ) call this%set_history_var(vname='AR_MAINT_SCPF',units = 'kgC/m2/yr', & - long='maintenance autotrophic respiration per m2 per year',use_default='inactive',& + long='maintenance autotrophic respiration per m2 per year by pft/size',use_default='inactive',& avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=2, ivar=ivar, initialize=initialize_variables, index = ih_ar_maint_si_scpf ) call this%set_history_var(vname='AR_DARKM_SCPF',units = 'kgC/m2/yr', & - long='dark portion of maintenance autotrophic respiration per m2 per year',use_default='inactive',& + long='dark portion of maintenance autotrophic respiration per m2 per year by pft/size',use_default='inactive',& avgflag='A', vtype=site_size_pft_r8,hlms='CLM:ALM', flushval=0.0_r8, & upfreq=2, ivar=ivar, initialize=initialize_variables, index = ih_ar_darkm_si_scpf ) call this%set_history_var(vname='AR_AGSAPM_SCPF',units = 'kgC/m2/yr', & - long='above-ground sapwood maintenance autotrophic respiration per m2 per year',use_default='inactive',& + long='above-ground sapwood maintenance autotrophic respiration per m2 per year by pft/size',use_default='inactive',& avgflag='A', vtype=site_size_pft_r8,hlms='CLM:ALM', flushval=0.0_r8, & upfreq=2, ivar=ivar, initialize=initialize_variables, index = ih_ar_agsapm_si_scpf ) call this%set_history_var(vname='AR_CROOTM_SCPF',units = 'kgC/m2/yr', & - long='below-ground sapwood maintenance autotrophic respiration per m2 per year',use_default='inactive',& + long='below-ground sapwood maintenance autotrophic respiration per m2 per year by pft/size',use_default='inactive',& avgflag='A', vtype=site_size_pft_r8,hlms='CLM:ALM', flushval=0.0_r8, & upfreq=2, ivar=ivar, initialize=initialize_variables, index = ih_ar_crootm_si_scpf ) call this%set_history_var(vname='AR_FROOTM_SCPF',units = 'kgC/m2/yr', & - long='fine root maintenance autotrophic respiration per m2 per year',use_default='inactive',& + long='fine root maintenance autotrophic respiration per m2 per year by pft/size',use_default='inactive',& avgflag='A', vtype=site_size_pft_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=2, ivar=ivar, initialize=initialize_variables, index = ih_ar_frootm_si_scpf ) From e36e1f19a4210ba65a76a289fefdf707ec50ae41 Mon Sep 17 00:00:00 2001 From: ckoven Date: Tue, 14 Feb 2017 11:23:05 -0800 Subject: [PATCH 11/21] added yet more diagnostics to disaggregate the canopy/understory and size-resolved cohort carbon budgets --- .../src/ED/main/FatesHistoryInterfaceMod.F90 | 370 +++++++++++++++++- 1 file changed, 369 insertions(+), 1 deletion(-) diff --git a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 index b2634f1381..c01b66417b 100644 --- a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 +++ b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 @@ -144,6 +144,49 @@ module FatesHistoryInterfaceMod integer, private :: ih_mortality_canopy_si_scls integer, private :: ih_mortality_understory_si_scls + ! lots of non-default diagnostics for understanding canopy versus understory carbon balances + integer, private :: ih_rdark_canopy_si_scls + integer, private :: ih_livestem_mr_canopy_si_scls + integer, private :: ih_livecroot_mr_canopy_si_scls + integer, private :: ih_froot_mr_canopy_si_scls + integer, private :: ih_resp_g_canopy_si_scls + integer, private :: ih_resp_m_canopy_si_scls + integer, private :: ih_leaf_md_canopy_si_scls + integer, private :: ih_root_md_canopy_si_scls + integer, private :: ih_carbon_balance_canopy_si_scls + integer, private :: ih_seed_prod_canopy_si_scls + integer, private :: ih_dbalivedt_canopy_si_scls + integer, private :: ih_dbdeaddt_canopy_si_scls + integer, private :: ih_dbstoredt_canopy_si_scls + integer, private :: ih_storage_flux_canopy_si_scls + integer, private :: ih_npp_leaf_canopy_si_scls + integer, private :: ih_npp_froot_canopy_si_scls + integer, private :: ih_npp_bsw_canopy_si_scls + integer, private :: ih_npp_bdead_canopy_si_scls + integer, private :: ih_npp_bseed_canopy_si_scls + integer, private :: ih_npp_store_canopy_si_scls + + integer, private :: ih_rdark_understory_si_scls + integer, private :: ih_livestem_mr_understory_si_scls + integer, private :: ih_livecroot_mr_understory_si_scls + integer, private :: ih_froot_mr_understory_si_scls + integer, private :: ih_resp_g_understory_si_scls + integer, private :: ih_resp_m_understory_si_scls + integer, private :: ih_leaf_md_understory_si_scls + integer, private :: ih_root_md_understory_si_scls + integer, private :: ih_carbon_balance_understory_si_scls + integer, private :: ih_seed_prod_understory_si_scls + integer, private :: ih_dbalivedt_understory_si_scls + integer, private :: ih_dbdeaddt_understory_si_scls + integer, private :: ih_dbstoredt_understory_si_scls + integer, private :: ih_storage_flux_understory_si_scls + integer, private :: ih_npp_leaf_understory_si_scls + integer, private :: ih_npp_froot_understory_si_scls + integer, private :: ih_npp_bsw_understory_si_scls + integer, private :: ih_npp_bdead_understory_si_scls + integer, private :: ih_npp_bseed_understory_si_scls + integer, private :: ih_npp_store_understory_si_scls + ! indices to (site x pft) variables integer, private :: ih_biomass_si_pft integer, private :: ih_leafbiomass_si_pft @@ -844,6 +887,34 @@ subroutine update_history_dyn(this,nc,nsites,sites) hio_nplant_understory_si_scls => this%hvars(ih_nplant_understory_si_scls)%r82d, & hio_mortality_canopy_si_scls => this%hvars(ih_mortality_canopy_si_scls)%r82d, & hio_mortality_understory_si_scls => this%hvars(ih_mortality_understory_si_scls)%r82d, & + hio_leaf_md_canopy_si_scls => this%hvars(ih_leaf_md_canopy_si_scls)%r82d, & + hio_root_md_canopy_si_scls => this%hvars(ih_root_md_canopy_si_scls)%r82d, & + hio_carbon_balance_canopy_si_scls => this%hvars(ih_carbon_balance_canopy_si_scls)%r82d, & + hio_seed_prod_canopy_si_scls => this%hvars(ih_seed_prod_canopy_si_scls)%r82d, & + hio_dbalivedt_canopy_si_scls => this%hvars(ih_dbalivedt_canopy_si_scls)%r82d, & + hio_dbdeaddt_canopy_si_scls => this%hvars(ih_dbdeaddt_canopy_si_scls)%r82d, & + hio_dbstoredt_canopy_si_scls => this%hvars(ih_dbstoredt_canopy_si_scls)%r82d, & + hio_storage_flux_canopy_si_scls => this%hvars(ih_storage_flux_canopy_si_scls)%r82d, & + hio_npp_leaf_canopy_si_scls => this%hvars(ih_npp_leaf_canopy_si_scls)%r82d, & + hio_npp_froot_canopy_si_scls => this%hvars(ih_npp_froot_canopy_si_scls)%r82d, & + hio_npp_bsw_canopy_si_scls => this%hvars(ih_npp_bsw_canopy_si_scls)%r82d, & + hio_npp_bdead_canopy_si_scls => this%hvars(ih_npp_bdead_canopy_si_scls)%r82d, & + hio_npp_bseed_canopy_si_scls => this%hvars(ih_npp_bseed_canopy_si_scls)%r82d, & + hio_npp_store_canopy_si_scls => this%hvars(ih_npp_store_canopy_si_scls)%r82d, & + hio_leaf_md_understory_si_scls => this%hvars(ih_leaf_md_understory_si_scls)%r82d, & + hio_root_md_understory_si_scls => this%hvars(ih_root_md_understory_si_scls)%r82d, & + hio_carbon_balance_understory_si_scls=> this%hvars(ih_carbon_balance_understory_si_scls)%r82d, & + hio_seed_prod_understory_si_scls => this%hvars(ih_seed_prod_understory_si_scls)%r82d, & + hio_dbalivedt_understory_si_scls => this%hvars(ih_dbalivedt_understory_si_scls)%r82d, & + hio_dbdeaddt_understory_si_scls => this%hvars(ih_dbdeaddt_understory_si_scls)%r82d, & + hio_dbstoredt_understory_si_scls => this%hvars(ih_dbstoredt_understory_si_scls)%r82d, & + hio_storage_flux_understory_si_scls => this%hvars(ih_storage_flux_understory_si_scls)%r82d, & + hio_npp_leaf_understory_si_scls => this%hvars(ih_npp_leaf_understory_si_scls)%r82d, & + hio_npp_froot_understory_si_scls => this%hvars(ih_npp_froot_understory_si_scls)%r82d, & + hio_npp_bsw_understory_si_scls => this%hvars(ih_npp_bsw_understory_si_scls)%r82d, & + hio_npp_bdead_understory_si_scls => this%hvars(ih_npp_bdead_understory_si_scls)%r82d, & + hio_npp_bseed_understory_si_scls => this%hvars(ih_npp_bseed_understory_si_scls)%r82d, & + hio_npp_store_understory_si_scls => this%hvars(ih_npp_store_understory_si_scls)%r82d, & hio_area_si_age => this%hvars(ih_area_si_age)%r82d, & hio_lai_si_age => this%hvars(ih_lai_si_age)%r82d, & hio_canopy_area_si_age => this%hvars(ih_canopy_area_si_age)%r82d, & @@ -1048,6 +1119,35 @@ subroutine update_history_dyn(this,nc,nsites,sites) ! 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) * n_perm2*AREA + ! + hio_leaf_md_canopy_si_scls(io_si,scls) = hio_leaf_md_canopy_si_scls(io_si,scls) + & + ccohort%leaf_md * n_perm2 * AREA + hio_root_md_canopy_si_scls(io_si,scls) = hio_root_md_canopy_si_scls(io_si,scls) + & + ccohort%root_md * n_perm2 * AREA + hio_carbon_balance_canopy_si_scls(io_si,scls) = hio_carbon_balance_canopy_si_scls(io_si,scls) + & + ccohort%carbon_balance * n_perm2 * AREA + hio_seed_prod_canopy_si_scls(io_si,scls) = hio_seed_prod_canopy_si_scls(io_si,scls) + & + ccohort%seed_prod * n_perm2 * AREA + hio_dbalivedt_canopy_si_scls(io_si,scls) = hio_dbalivedt_canopy_si_scls(io_si,scls) + & + ccohort%dbalivedt * n_perm2 * AREA + hio_dbdeaddt_canopy_si_scls(io_si,scls) = hio_dbdeaddt_canopy_si_scls(io_si,scls) + & + ccohort%dbdeaddt * n_perm2 * AREA + hio_dbstoredt_canopy_si_scls(io_si,scls) = hio_dbstoredt_canopy_si_scls(io_si,scls) + & + ccohort%dbstoredt * n_perm2 * AREA + hio_storage_flux_canopy_si_scls(io_si,scls) = hio_storage_flux_canopy_si_scls(io_si,scls) + & + ccohort%storage_flux * n_perm2 * AREA + hio_npp_leaf_canopy_si_scls(io_si,scls) = hio_npp_leaf_canopy_si_scls(io_si,scls) + & + ccohort%npp_leaf * n_perm2 * AREA * yeardays + hio_npp_froot_canopy_si_scls(io_si,scls) = hio_npp_froot_canopy_si_scls(io_si,scls) + & + ccohort%npp_froot * n_perm2 * AREA * yeardays + hio_npp_bsw_canopy_si_scls(io_si,scls) = hio_npp_bsw_canopy_si_scls(io_si,scls) + & + ccohort%npp_bsw * n_perm2 * AREA * yeardays + hio_npp_bdead_canopy_si_scls(io_si,scls) = hio_npp_bdead_canopy_si_scls(io_si,scls) + & + ccohort%npp_bdead * n_perm2 * AREA * yeardays + hio_npp_bseed_canopy_si_scls(io_si,scls) = hio_npp_bseed_canopy_si_scls(io_si,scls) + & + ccohort%npp_bseed * n_perm2 * AREA * yeardays + hio_npp_store_canopy_si_scls(io_si,scls) = hio_npp_store_canopy_si_scls(io_si,scls) + & + ccohort%npp_store * n_perm2 * AREA * yeardays else hio_bstor_understory_si_scpf(io_si,scpf) = hio_bstor_understory_si_scpf(io_si,scpf) + & ccohort%bstore * n_perm2 * AREA @@ -1067,6 +1167,35 @@ subroutine update_history_dyn(this,nc,nsites,sites) ! 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) * n_perm2*AREA + ! + hio_leaf_md_understory_si_scls(io_si,scls) = hio_leaf_md_understory_si_scls(io_si,scls) + & + ccohort%leaf_md * n_perm2 * AREA + hio_root_md_understory_si_scls(io_si,scls) = hio_root_md_understory_si_scls(io_si,scls) + & + ccohort%root_md * n_perm2 * AREA + hio_carbon_balance_understory_si_scls(io_si,scls) = hio_carbon_balance_understory_si_scls(io_si,scls) + & + ccohort%carbon_balance * n_perm2 * AREA + hio_seed_prod_understory_si_scls(io_si,scls) = hio_seed_prod_understory_si_scls(io_si,scls) + & + ccohort%seed_prod * n_perm2 * AREA + hio_dbalivedt_understory_si_scls(io_si,scls) = hio_dbalivedt_understory_si_scls(io_si,scls) + & + ccohort%dbalivedt * n_perm2 * AREA + hio_dbdeaddt_understory_si_scls(io_si,scls) = hio_dbdeaddt_understory_si_scls(io_si,scls) + & + ccohort%dbdeaddt * n_perm2 * AREA + hio_dbstoredt_understory_si_scls(io_si,scls) = hio_dbstoredt_understory_si_scls(io_si,scls) + & + ccohort%dbstoredt * n_perm2 * AREA + hio_storage_flux_understory_si_scls(io_si,scls) = hio_storage_flux_understory_si_scls(io_si,scls) + & + ccohort%storage_flux * n_perm2 * AREA + hio_npp_leaf_understory_si_scls(io_si,scls) = hio_npp_leaf_understory_si_scls(io_si,scls) + & + ccohort%npp_leaf * n_perm2 * AREA * yeardays + hio_npp_froot_understory_si_scls(io_si,scls) = hio_npp_froot_understory_si_scls(io_si,scls) + & + ccohort%npp_froot * n_perm2 * AREA * yeardays + hio_npp_bsw_understory_si_scls(io_si,scls) = hio_npp_bsw_understory_si_scls(io_si,scls) + & + ccohort%npp_bsw * n_perm2 * AREA * yeardays + hio_npp_bdead_understory_si_scls(io_si,scls) = hio_npp_bdead_understory_si_scls(io_si,scls) + & + ccohort%npp_bdead * n_perm2 * AREA * yeardays + hio_npp_bseed_understory_si_scls(io_si,scls) = hio_npp_bseed_understory_si_scls(io_si,scls) + & + ccohort%npp_bseed * n_perm2 * AREA * yeardays + hio_npp_store_understory_si_scls(io_si,scls) = hio_npp_store_understory_si_scls(io_si,scls) + & + ccohort%npp_store * n_perm2 * AREA * yeardays endif end associate @@ -1240,6 +1369,18 @@ subroutine update_history_prod(this,nc,nsites,sites,dt_tstep) hio_ar_canopy_pa => this%hvars(ih_ar_canopy_pa)%r81d, & hio_gpp_understory_pa => this%hvars(ih_gpp_understory_pa)%r81d, & hio_ar_understory_pa => this%hvars(ih_ar_understory_pa)%r81d, & + hio_rdark_canopy_si_scls => this%hvars(ih_rdark_canopy_si_scls)%r82d, & + hio_livestem_mr_canopy_si_scls => this%hvars(ih_livestem_mr_canopy_si_scls)%r82d, & + hio_livecroot_mr_canopy_si_scls => this%hvars(ih_livecroot_mr_canopy_si_scls)%r82d, & + hio_froot_mr_canopy_si_scls => this%hvars(ih_froot_mr_canopy_si_scls)%r82d, & + hio_resp_g_canopy_si_scls => this%hvars(ih_resp_g_canopy_si_scls)%r82d, & + hio_resp_m_canopy_si_scls => this%hvars(ih_resp_m_canopy_si_scls)%r82d, & + hio_rdark_understory_si_scls => this%hvars(ih_rdark_understory_si_scls)%r82d, & + hio_livestem_mr_understory_si_scls => this%hvars(ih_livestem_mr_understory_si_scls)%r82d, & + hio_livecroot_mr_understory_si_scls => this%hvars(ih_livecroot_mr_understory_si_scls)%r82d, & + hio_froot_mr_understory_si_scls => this%hvars(ih_froot_mr_understory_si_scls)%r82d, & + hio_resp_g_understory_si_scls => this%hvars(ih_resp_g_understory_si_scls)%r82d, & + hio_resp_m_understory_si_scls => this%hvars(ih_resp_m_understory_si_scls)%r82d, & hio_gpp_si_age => this%hvars(ih_gpp_si_age)%r82d, & hio_npp_si_age => this%hvars(ih_npp_si_age)%r82d & ) @@ -1280,7 +1421,8 @@ subroutine update_history_prod(this,nc,nsites,sites,dt_tstep) if ( .not. ccohort%isnew ) then ! Calculate index for the scpf class - associate( scpf => ccohort%size_by_pft_class ) + associate( scpf => ccohort%size_by_pft_class, & + scls => ccohort%size_class ) ! scale up cohort fluxes to their patches hio_npp_pa(io_pa) = hio_npp_pa(io_pa) + & @@ -1339,11 +1481,37 @@ subroutine update_history_prod(this,nc,nsites,sites,dt_tstep) ccohort%gpp_tstep * 1.e3_r8 * n_density / dt_tstep hio_ar_canopy_pa(io_pa) = hio_ar_canopy_pa(io_pa) + & ccohort%resp_tstep * 1.e3_r8 * n_density / dt_tstep + ! + hio_rdark_canopy_si_scls(io_si,scls) = hio_rdark_canopy_si_scls(io_si,scls) + & + ccohort%rdark * 1.e3_r8 * n_density * daysecs * yeardays + hio_livestem_mr_canopy_si_scls(io_si,scls) = hio_livestem_mr_canopy_si_scls(io_si,scls) + & + ccohort%livestem_mr * 1.e3_r8 * n_density * daysecs * yeardays + hio_livecroot_mr_canopy_si_scls(io_si,scls) = hio_livecroot_mr_canopy_si_scls(io_si,scls) + & + ccohort%livecroot_mr * 1.e3_r8 * n_density * daysecs * yeardays + hio_froot_mr_canopy_si_scls(io_si,scls) = hio_froot_mr_canopy_si_scls(io_si,scls) + & + ccohort%froot_mr * 1.e3_r8 * n_density * daysecs * yeardays + hio_resp_g_canopy_si_scls(io_si,scls) = hio_resp_g_canopy_si_scls(io_si,scls) + & + ccohort%resp_g * 1.e3_r8 * n_density * daysecs * yeardays / dt_tstep + hio_resp_m_canopy_si_scls(io_si,scls) = hio_resp_m_canopy_si_scls(io_si,scls) + & + ccohort%resp_m * 1.e3_r8 * n_density * daysecs * yeardays / dt_tstep else hio_gpp_understory_pa(io_pa) = hio_gpp_understory_pa(io_pa) + & ccohort%gpp_tstep * 1.e3_r8 * n_density / dt_tstep hio_ar_understory_pa(io_pa) = hio_ar_understory_pa(io_pa) + & ccohort%resp_tstep * 1.e3_r8 * n_density / dt_tstep + ! + hio_rdark_understory_si_scls(io_si,scls) = hio_rdark_understory_si_scls(io_si,scls) + & + ccohort%rdark * 1.e3_r8 * n_density * daysecs * yeardays + hio_livestem_mr_understory_si_scls(io_si,scls) = hio_livestem_mr_understory_si_scls(io_si,scls) + & + ccohort%livestem_mr * 1.e3_r8 * n_density * daysecs * yeardays + hio_livecroot_mr_understory_si_scls(io_si,scls) = hio_livecroot_mr_understory_si_scls(io_si,scls) + & + ccohort%livecroot_mr * 1.e3_r8 * n_density * daysecs * yeardays + hio_froot_mr_understory_si_scls(io_si,scls) = hio_froot_mr_understory_si_scls(io_si,scls) + & + ccohort%froot_mr * 1.e3_r8 * n_density * daysecs * yeardays + hio_resp_g_understory_si_scls(io_si,scls) = hio_resp_g_understory_si_scls(io_si,scls) + & + ccohort%resp_g * 1.e3_r8 * n_density * daysecs * yeardays / dt_tstep + hio_resp_m_understory_si_scls(io_si,scls) = hio_resp_m_understory_si_scls(io_si,scls) + & + ccohort%resp_m * 1.e3_r8 * n_density * daysecs * yeardays / dt_tstep endif end associate endif @@ -1955,6 +2123,206 @@ subroutine define_history_vars(this, initialize_variables) avgflag='A', vtype=site_size_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_mortality_understory_si_scls ) + call this%set_history_var(vname='LEAF_MD_CANOPY_SCLS', units = 'kg C / ha / yr', & + long='LEAF_MD for canopy plants by size class', 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_leaf_md_canopy_si_scls ) + + call this%set_history_var(vname='ROOT_MD_CANOPY_SCLS', units = 'kg C / ha / yr', & + long='ROOT_MD for canopy plants by size class', 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_root_md_canopy_si_scls ) + + call this%set_history_var(vname='CARBON_BALANCE_CANOPY_SCLS', units = 'kg C / ha / yr', & + long='CARBON_BALANCE for canopy plants by size class', 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_carbon_balance_canopy_si_scls ) + + call this%set_history_var(vname='SEED_PROD_CANOPY_SCLS', units = 'kg C / ha / yr', & + long='SEED_PROD for canopy plants by size class', 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_seed_prod_canopy_si_scls ) + + call this%set_history_var(vname='DBALIVEDT_CANOPY_SCLS', units = 'kg C / ha / yr', & + long='DBALIVEDT for canopy plants by size class', 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_dbalivedt_canopy_si_scls ) + + call this%set_history_var(vname='DBDEADDT_CANOPY_SCLS', units = 'kg C / ha / yr', & + long='DBDEADDT for canopy plants by size class', 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_dbdeaddt_canopy_si_scls ) + + call this%set_history_var(vname='DBSTOREDT_CANOPY_SCLS', units = 'kg C / ha / yr', & + long='DBSTOREDT for canopy plants by size class', 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_dbstoredt_canopy_si_scls ) + + call this%set_history_var(vname='STORAGE_FLUX_CANOPY_SCLS', units = 'kg C / ha / yr', & + long='STORAGE_FLUX for canopy plants by size class', 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_storage_flux_canopy_si_scls ) + + call this%set_history_var(vname='NPP_LEAF_CANOPY_SCLS', units = 'kg C / ha / yr', & + long='NPP_LEAF for canopy plants by size class', 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_npp_leaf_canopy_si_scls ) + + call this%set_history_var(vname='NPP_FROOT_CANOPY_SCLS', units = 'kg C / ha / yr', & + long='NPP_FROOT for canopy plants by size class', 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_npp_froot_canopy_si_scls ) + + call this%set_history_var(vname='NPP_BSW_CANOPY_SCLS', units = 'kg C / ha / yr', & + long='NPP_BSW for canopy plants by size class', 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_npp_bsw_canopy_si_scls ) + + call this%set_history_var(vname='NPP_BDEAD_CANOPY_SCLS', units = 'kg C / ha / yr', & + long='NPP_BDEAD for canopy plants by size class', 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_npp_bdead_canopy_si_scls ) + + call this%set_history_var(vname='NPP_BSEED_CANOPY_SCLS', units = 'kg C / ha / yr', & + long='NPP_BSEED for canopy plants by size class', 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_npp_bseed_canopy_si_scls ) + + call this%set_history_var(vname='NPP_STORE_CANOPY_SCLS', units = 'kg C / ha / yr', & + long='NPP_STORE for canopy plants by size class', 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_npp_store_canopy_si_scls ) + + call this%set_history_var(vname='RDARK_CANOPY_SCLS', units = 'kg C / ha / yr', & + long='RDARK for canopy plants by size class', use_default='inactive', & + avgflag='A', vtype=site_size_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=2, ivar=ivar, initialize=initialize_variables, index = ih_rdark_canopy_si_scls ) + + call this%set_history_var(vname='LIVESTEM_MR_CANOPY_SCLS', units = 'kg C / ha / yr', & + long='LIVESTEM_MR for canopy plants by size class', use_default='inactive', & + avgflag='A', vtype=site_size_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=2, ivar=ivar, initialize=initialize_variables, index = ih_livestem_mr_canopy_si_scls ) + + call this%set_history_var(vname='LIVECROOT_MR_CANOPY_SCLS', units = 'kg C / ha / yr', & + long='LIVECROOT_MR for canopy plants by size class', use_default='inactive', & + avgflag='A', vtype=site_size_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=2, ivar=ivar, initialize=initialize_variables, index = ih_livecroot_mr_canopy_si_scls ) + + call this%set_history_var(vname='FROOT_MR_CANOPY_SCLS', units = 'kg C / ha / yr', & + long='FROOT_MR for canopy plants by size class', use_default='inactive', & + avgflag='A', vtype=site_size_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=2, ivar=ivar, initialize=initialize_variables, index = ih_froot_mr_canopy_si_scls ) + + call this%set_history_var(vname='RESP_G_CANOPY_SCLS', units = 'kg C / ha / yr', & + long='RESP_G for canopy plants by size class', use_default='inactive', & + avgflag='A', vtype=site_size_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=2, ivar=ivar, initialize=initialize_variables, index = ih_resp_g_canopy_si_scls ) + + call this%set_history_var(vname='RESP_M_CANOPY_SCLS', units = 'kg C / ha / yr', & + long='RESP_M for canopy plants by size class', use_default='inactive', & + avgflag='A', vtype=site_size_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=2, ivar=ivar, initialize=initialize_variables, index = ih_resp_m_canopy_si_scls ) + + call this%set_history_var(vname='LEAF_MD_UNDERSTORY_SCLS', units = 'kg C / ha / yr', & + long='LEAF_MD for understory plants by size class', 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_leaf_md_understory_si_scls ) + + call this%set_history_var(vname='ROOT_MD_UNDERSTORY_SCLS', units = 'kg C / ha / yr', & + long='ROOT_MD for understory plants by size class', 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_root_md_understory_si_scls ) + + call this%set_history_var(vname='CARBON_BALANCE_UNDERSTORY_SCLS', units = 'kg C / ha / yr', & + long='CARBON_BALANCE for understory plants by size class', 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_carbon_balance_understory_si_scls ) + + call this%set_history_var(vname='SEED_PROD_UNDERSTORY_SCLS', units = 'kg C / ha / yr', & + long='SEED_PROD for understory plants by size class', 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_seed_prod_understory_si_scls ) + + call this%set_history_var(vname='DBALIVEDT_UNDERSTORY_SCLS', units = 'kg C / ha / yr', & + long='DBALIVEDT for understory plants by size class', 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_dbalivedt_understory_si_scls ) + + call this%set_history_var(vname='DBDEADDT_UNDERSTORY_SCLS', units = 'kg C / ha / yr', & + long='DBDEADDT for understory plants by size class', 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_dbdeaddt_understory_si_scls ) + + call this%set_history_var(vname='DBSTOREDT_UNDERSTORY_SCLS', units = 'kg C / ha / yr', & + long='DBSTOREDT for understory plants by size class', 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_dbstoredt_understory_si_scls ) + + call this%set_history_var(vname='STORAGE_FLUX_UNDERSTORY_SCLS', units = 'kg C / ha / yr', & + long='STORAGE_FLUX for understory plants by size class', 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_storage_flux_understory_si_scls ) + + call this%set_history_var(vname='NPP_LEAF_UNDERSTORY_SCLS', units = 'kg C / ha / yr', & + long='NPP_LEAF for understory plants by size class', 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_npp_leaf_understory_si_scls ) + + call this%set_history_var(vname='NPP_FROOT_UNDERSTORY_SCLS', units = 'kg C / ha / yr', & + long='NPP_FROOT for understory plants by size class', 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_npp_froot_understory_si_scls ) + + call this%set_history_var(vname='NPP_BSW_UNDERSTORY_SCLS', units = 'kg C / ha / yr', & + long='NPP_BSW for understory plants by size class', 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_npp_bsw_understory_si_scls ) + + call this%set_history_var(vname='NPP_BDEAD_UNDERSTORY_SCLS', units = 'kg C / ha / yr', & + long='NPP_BDEAD for understory plants by size class', 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_npp_bdead_understory_si_scls ) + + call this%set_history_var(vname='NPP_BSEED_UNDERSTORY_SCLS', units = 'kg C / ha / yr', & + long='NPP_BSEED for understory plants by size class', 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_npp_bseed_understory_si_scls ) + + call this%set_history_var(vname='NPP_STORE_UNDERSTORY_SCLS', units = 'kg C / ha / yr', & + long='NPP_STORE for understory plants by size class', 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_npp_store_understory_si_scls ) + + call this%set_history_var(vname='RDARK_UNDERSTORY_SCLS', units = 'kg C / ha / yr', & + long='RDARK for understory plants by size class', use_default='inactive', & + avgflag='A', vtype=site_size_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=2, ivar=ivar, initialize=initialize_variables, index = ih_rdark_understory_si_scls ) + + call this%set_history_var(vname='LIVESTEM_MR_UNDERSTORY_SCLS', units = 'kg C / ha / yr', & + long='LIVESTEM_MR for understory plants by size class', use_default='inactive', & + avgflag='A', vtype=site_size_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=2, ivar=ivar, initialize=initialize_variables, index = ih_livestem_mr_understory_si_scls ) + + call this%set_history_var(vname='LIVECROOT_MR_UNDERSTORY_SCLS', units = 'kg C / ha / yr', & + long='LIVECROOT_MR for understory plants by size class', use_default='inactive', & + avgflag='A', vtype=site_size_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=2, ivar=ivar, initialize=initialize_variables, index = ih_livecroot_mr_understory_si_scls ) + + call this%set_history_var(vname='FROOT_MR_UNDERSTORY_SCLS', units = 'kg C / ha / yr', & + long='FROOT_MR for understory plants by size class', use_default='inactive', & + avgflag='A', vtype=site_size_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=2, ivar=ivar, initialize=initialize_variables, index = ih_froot_mr_understory_si_scls ) + + call this%set_history_var(vname='RESP_G_UNDERSTORY_SCLS', units = 'kg C / ha / yr', & + long='RESP_G for understory plants by size class', use_default='inactive', & + avgflag='A', vtype=site_size_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=2, ivar=ivar, initialize=initialize_variables, index = ih_resp_g_understory_si_scls ) + + call this%set_history_var(vname='RESP_M_UNDERSTORY_SCLS', units = 'kg C / ha / yr', & + long='RESP_M for understory plants by size class', use_default='inactive', & + avgflag='A', vtype=site_size_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=2, ivar=ivar, initialize=initialize_variables, index = ih_resp_m_understory_si_scls ) + ! CARBON BALANCE VARIABLES THAT DEPEND ON HLM BGC INPUTS From cfe21cb4e0e8b6495d04e6671fbb6eefca653024 Mon Sep 17 00:00:00 2001 From: ckoven Date: Tue, 14 Feb 2017 16:22:02 -0800 Subject: [PATCH 12/21] fixed 2 bugs: one unit and one restart --- .../src/ED/main/FatesHistoryInterfaceMod.F90 | 24 +++++++-------- .../src/ED/main/FatesRestartInterfaceMod.F90 | 30 +++++++++++++++++++ 2 files changed, 42 insertions(+), 12 deletions(-) diff --git a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 index 89c8cfb34c..d38c967997 100644 --- a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 +++ b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 @@ -1483,17 +1483,17 @@ subroutine update_history_prod(this,nc,nsites,sites,dt_tstep) ccohort%resp_tstep * 1.e3_r8 * n_density / dt_tstep ! hio_rdark_canopy_si_scls(io_si,scls) = hio_rdark_canopy_si_scls(io_si,scls) + & - ccohort%rdark * 1.e3_r8 * n_density * daysecs * yeardays + ccohort%rdark * 1.e3_r8 * ccohort%n * daysecs * yeardays hio_livestem_mr_canopy_si_scls(io_si,scls) = hio_livestem_mr_canopy_si_scls(io_si,scls) + & - ccohort%livestem_mr * 1.e3_r8 * n_density * daysecs * yeardays + ccohort%livestem_mr * 1.e3_r8 * ccohort%n * daysecs * yeardays hio_livecroot_mr_canopy_si_scls(io_si,scls) = hio_livecroot_mr_canopy_si_scls(io_si,scls) + & - ccohort%livecroot_mr * 1.e3_r8 * n_density * daysecs * yeardays + ccohort%livecroot_mr * 1.e3_r8 * ccohort%n * daysecs * yeardays hio_froot_mr_canopy_si_scls(io_si,scls) = hio_froot_mr_canopy_si_scls(io_si,scls) + & - ccohort%froot_mr * 1.e3_r8 * n_density * daysecs * yeardays + ccohort%froot_mr * 1.e3_r8 * ccohort%n * daysecs * yeardays hio_resp_g_canopy_si_scls(io_si,scls) = hio_resp_g_canopy_si_scls(io_si,scls) + & - ccohort%resp_g * 1.e3_r8 * n_density * daysecs * yeardays / dt_tstep + ccohort%resp_g * 1.e3_r8 * ccohort%n * daysecs * yeardays / dt_tstep hio_resp_m_canopy_si_scls(io_si,scls) = hio_resp_m_canopy_si_scls(io_si,scls) + & - ccohort%resp_m * 1.e3_r8 * n_density * daysecs * yeardays / dt_tstep + ccohort%resp_m * 1.e3_r8 * ccohort%n * daysecs * yeardays / dt_tstep else hio_gpp_understory_pa(io_pa) = hio_gpp_understory_pa(io_pa) + & ccohort%gpp_tstep * 1.e3_r8 * n_density / dt_tstep @@ -1501,17 +1501,17 @@ subroutine update_history_prod(this,nc,nsites,sites,dt_tstep) ccohort%resp_tstep * 1.e3_r8 * n_density / dt_tstep ! hio_rdark_understory_si_scls(io_si,scls) = hio_rdark_understory_si_scls(io_si,scls) + & - ccohort%rdark * 1.e3_r8 * n_density * daysecs * yeardays + ccohort%rdark * 1.e3_r8 * ccohort%n * daysecs * yeardays hio_livestem_mr_understory_si_scls(io_si,scls) = hio_livestem_mr_understory_si_scls(io_si,scls) + & - ccohort%livestem_mr * 1.e3_r8 * n_density * daysecs * yeardays + ccohort%livestem_mr * 1.e3_r8 * ccohort%n * daysecs * yeardays hio_livecroot_mr_understory_si_scls(io_si,scls) = hio_livecroot_mr_understory_si_scls(io_si,scls) + & - ccohort%livecroot_mr * 1.e3_r8 * n_density * daysecs * yeardays + ccohort%livecroot_mr * 1.e3_r8 * ccohort%n * daysecs * yeardays hio_froot_mr_understory_si_scls(io_si,scls) = hio_froot_mr_understory_si_scls(io_si,scls) + & - ccohort%froot_mr * 1.e3_r8 * n_density * daysecs * yeardays + ccohort%froot_mr * 1.e3_r8 * ccohort%n * daysecs * yeardays hio_resp_g_understory_si_scls(io_si,scls) = hio_resp_g_understory_si_scls(io_si,scls) + & - ccohort%resp_g * 1.e3_r8 * n_density * daysecs * yeardays / dt_tstep + ccohort%resp_g * 1.e3_r8 * ccohort%n * daysecs * yeardays / dt_tstep hio_resp_m_understory_si_scls(io_si,scls) = hio_resp_m_understory_si_scls(io_si,scls) + & - ccohort%resp_m * 1.e3_r8 * n_density * daysecs * yeardays / dt_tstep + ccohort%resp_m * 1.e3_r8 * ccohort%n * daysecs * yeardays / dt_tstep endif end associate endif diff --git a/components/clm/src/ED/main/FatesRestartInterfaceMod.F90 b/components/clm/src/ED/main/FatesRestartInterfaceMod.F90 index 18b77bc6cf..90b9dd21aa 100644 --- a/components/clm/src/ED/main/FatesRestartInterfaceMod.F90 +++ b/components/clm/src/ED/main/FatesRestartInterfaceMod.F90 @@ -98,6 +98,9 @@ module FatesRestartInterfaceMod integer, private :: ir_imort_co integer, private :: ir_fmort_co integer, private :: ir_ddbhdt_co + integer, private :: ir_dbalivedt_co + integer, private :: ir_dbdeaddt_co + integer, private :: ir_dbstoredt_co integer, private :: ir_resp_tstep_co integer, private :: ir_pft_co integer, private :: ir_status_co @@ -731,6 +734,21 @@ subroutine define_restart_vars(this, initialize_variables) units='cm/year', flushval = flushzero, & hlms='CLM:ALM', initialize=initialize_variables, ivar=ivar, index = ir_ddbhdt_co ) + call this%set_restart_var(vname='fates_dbalivedt', vtype=cohort_r8, & + long_name='ed cohort - differential: ddbh/dt', & + units='cm/year', flushval = flushzero, & + hlms='CLM:ALM', initialize=initialize_variables, ivar=ivar, index = ir_dbalivedt_co ) + + call this%set_restart_var(vname='fates_dbdeaddt', vtype=cohort_r8, & + long_name='ed cohort - differential: ddbh/dt', & + units='cm/year', flushval = flushzero, & + hlms='CLM:ALM', initialize=initialize_variables, ivar=ivar, index = ir_dbdeaddt_co ) + + call this%set_restart_var(vname='fates_dbstoredt', vtype=cohort_r8, & + long_name='ed cohort - differential: ddbh/dt', & + units='cm/year', flushval = flushzero, & + hlms='CLM:ALM', initialize=initialize_variables, ivar=ivar, index = ir_dbstoredt_co ) + call this%set_restart_var(vname='fates_resp_tstep', vtype=cohort_r8, & long_name='ed cohort - autotrophic respiration over timestep', & units='kgC/indiv/timestep', flushval = flushzero, & @@ -1008,6 +1026,9 @@ subroutine set_restart_vectors(this,nc,nsites,sites) rio_imort_co => this%rvars(ir_imort_co)%r81d, & rio_fmort_co => this%rvars(ir_fmort_co)%r81d, & rio_ddbhdt_co => this%rvars(ir_ddbhdt_co)%r81d, & + rio_dbalivedt_co => this%rvars(ir_dbalivedt_co)%r81d, & + rio_dbdeaddt_co => this%rvars(ir_dbdeaddt_co)%r81d, & + rio_dbstoredt_co => this%rvars(ir_dbstoredt_co)%r81d, & rio_resp_tstep_co => this%rvars(ir_resp_tstep_co)%r81d, & rio_pft_co => this%rvars(ir_pft_co)%int1d, & rio_status_co => this%rvars(ir_status_co)%int1d, & @@ -1116,6 +1137,9 @@ subroutine set_restart_vectors(this,nc,nsites,sites) rio_imort_co(io_idx_co) = ccohort%imort rio_fmort_co(io_idx_co) = ccohort%fmort rio_ddbhdt_co(io_idx_co) = ccohort%ddbhdt + rio_dbalivedt_co(io_idx_co) = ccohort%dbalivedt + rio_dbdeaddt_co(io_idx_co) = ccohort%dbdeaddt + rio_dbstoredt_co(io_idx_co) = ccohort%dbstoredt rio_resp_tstep_co(io_idx_co) = ccohort%resp_tstep rio_pft_co(io_idx_co) = ccohort%pft rio_status_co(io_idx_co) = ccohort%status_coh @@ -1570,6 +1594,9 @@ subroutine get_restart_vectors(this, nc, nsites, sites) rio_imort_co => this%rvars(ir_imort_co)%r81d, & rio_fmort_co => this%rvars(ir_fmort_co)%r81d, & rio_ddbhdt_co => this%rvars(ir_ddbhdt_co)%r81d, & + rio_dbalivedt_co => this%rvars(ir_dbalivedt_co)%r81d, & + rio_dbdeaddt_co => this%rvars(ir_dbdeaddt_co)%r81d, & + rio_dbstoredt_co => this%rvars(ir_dbstoredt_co)%r81d, & rio_resp_tstep_co => this%rvars(ir_resp_tstep_co)%r81d, & rio_pft_co => this%rvars(ir_pft_co)%int1d, & rio_status_co => this%rvars(ir_status_co)%int1d, & @@ -1663,6 +1690,9 @@ subroutine get_restart_vectors(this, nc, nsites, sites) ccohort%imort = rio_imort_co(io_idx_co) ccohort%fmort = rio_fmort_co(io_idx_co) ccohort%ddbhdt = rio_ddbhdt_co(io_idx_co) + ccohort%dbalivedt = rio_dbalivedt_co(io_idx_co) + ccohort%dbdeaddt = rio_dbdeaddt_co(io_idx_co) + ccohort%dbstoredt = rio_dbstoredt_co(io_idx_co) ccohort%resp_tstep = rio_resp_tstep_co(io_idx_co) ccohort%pft = rio_pft_co(io_idx_co) ccohort%status_coh = rio_status_co(io_idx_co) From 76f4e362a7974e14baa90b05efa611231a74ceee Mon Sep 17 00:00:00 2001 From: ckoven Date: Thu, 16 Feb 2017 13:42:15 -0800 Subject: [PATCH 13/21] added a diagnostic to track the relative fraction of understory individuals of a given size class who were demoted on a given timestep --- .../src/ED/biogeochem/EDCohortDynamicsMod.F90 | 3 +++ .../src/ED/biogeochem/EDPatchDynamicsMod.F90 | 1 + components/clm/src/ED/main/EDTypesMod.F90 | 1 + .../src/ED/main/FatesHistoryInterfaceMod.F90 | 22 +++++++++++++++++++ .../src/ED/main/FatesRestartInterfaceMod.F90 | 10 +++++++++ 5 files changed, 37 insertions(+) diff --git a/components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 b/components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 index edbfdd34ea..6fbdb3371b 100755 --- a/components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 +++ b/components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 @@ -94,6 +94,7 @@ subroutine create_cohort(patchptr, pft, nn, hite, dbh, & new_cohort%dbh = dbh new_cohort%canopy_trim = ctrim new_cohort%canopy_layer = clayer + new_cohort%canopy_layer_yesterday = clayer new_cohort%laimemory = laimemory new_cohort%bdead = bdead new_cohort%balive = balive @@ -334,6 +335,7 @@ subroutine nan_cohort(cc_p) currentCohort%pft = fates_unset_int ! pft number currentCohort%indexnumber = fates_unset_int ! unique number for each cohort. (within clump?) currentCohort%canopy_layer = fates_unset_int ! canopy status of cohort (1 = canopy, 2 = understorey, etc.) + currentCohort%canopy_layer_yesterday = fates_unset_int ! canopy status of cohort (1 = canopy, 2 = understorey, etc.) currentCohort%NV = fates_unset_int ! Number of leaf layers: - currentCohort%status_coh = fates_unset_int ! growth status of plant (2 = leaves on , 1 = leaves off) currentCohort%size_class = fates_unset_int ! size class index @@ -1041,6 +1043,7 @@ subroutine copy_cohort( currentCohort,copyc ) n%gscan = o%gscan n%leaf_cost = o%leaf_cost n%canopy_layer = o%canopy_layer + n%canopy_layer_yesterday = o%canopy_layer_yesterday n%nv = o%nv n%status_coh = o%status_coh n%canopy_trim = o%canopy_trim diff --git a/components/clm/src/ED/biogeochem/EDPatchDynamicsMod.F90 b/components/clm/src/ED/biogeochem/EDPatchDynamicsMod.F90 index df283d6c54..049a1e8aa8 100755 --- a/components/clm/src/ED/biogeochem/EDPatchDynamicsMod.F90 +++ b/components/clm/src/ED/biogeochem/EDPatchDynamicsMod.F90 @@ -262,6 +262,7 @@ subroutine spawn_patches( currentSite ) !this is the case as the new patch probably doesn't have a closed canopy, and ! even if it does, that will be sorted out in canopy_structure. nc%canopy_layer = 1 + nc%canopy_layer_yesterday = 1 !mortality is dominant disturbance if(currentPatch%disturbance_rates(1) > currentPatch%disturbance_rates(2))then diff --git a/components/clm/src/ED/main/EDTypesMod.F90 b/components/clm/src/ED/main/EDTypesMod.F90 index 79386f3e8c..c83fc0bf46 100755 --- a/components/clm/src/ED/main/EDTypesMod.F90 +++ b/components/clm/src/ED/main/EDTypesMod.F90 @@ -191,6 +191,7 @@ module EDTypesMod real(r8) :: bstore ! stored carbon: kGC per indiv real(r8) :: laimemory ! target leaf biomass- set from previous year: kGC per indiv integer :: canopy_layer ! canopy status of cohort (1 = canopy, 2 = understorey, etc.) + integer :: canopy_layer_yesterday ! canopy status of cohort (1 = canopy, 2 = understorey, etc.) real(r8) :: b ! total biomass: kGC per indiv real(r8) :: bsw ! sapwood in stem and roots: kGC per indiv real(r8) :: bl ! leaf biomass: kGC per indiv diff --git a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 index d38c967997..038ec6656d 100644 --- a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 +++ b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 @@ -187,6 +187,9 @@ module FatesHistoryInterfaceMod integer, private :: ih_npp_bseed_understory_si_scls integer, private :: ih_npp_store_understory_si_scls + integer, private :: ih_yesterdaycanopylevel_canopy_si_scls + integer, private :: ih_yesterdaycanopylevel_understory_si_scls + ! indices to (site x pft) variables integer, private :: ih_biomass_si_pft integer, private :: ih_leafbiomass_si_pft @@ -915,6 +918,8 @@ subroutine update_history_dyn(this,nc,nsites,sites) hio_npp_bdead_understory_si_scls => this%hvars(ih_npp_bdead_understory_si_scls)%r82d, & hio_npp_bseed_understory_si_scls => this%hvars(ih_npp_bseed_understory_si_scls)%r82d, & hio_npp_store_understory_si_scls => this%hvars(ih_npp_store_understory_si_scls)%r82d, & + hio_yesterdaycanopylevel_canopy_si_scls => this%hvars(ih_yesterdaycanopylevel_canopy_si_scls)%r82d, & + hio_yesterdaycanopylevel_understory_si_scls => this%hvars(ih_yesterdaycanopylevel_understory_si_scls)%r82d, & hio_area_si_age => this%hvars(ih_area_si_age)%r82d, & hio_lai_si_age => this%hvars(ih_lai_si_age)%r82d, & hio_canopy_area_si_age => this%hvars(ih_canopy_area_si_age)%r82d, & @@ -1148,6 +1153,8 @@ subroutine update_history_dyn(this,nc,nsites,sites) ccohort%npp_bseed * n_perm2 * AREA * yeardays hio_npp_store_canopy_si_scls(io_si,scls) = hio_npp_store_canopy_si_scls(io_si,scls) + & ccohort%npp_store * n_perm2 * AREA * yeardays + hio_yesterdaycanopylevel_canopy_si_scls(io_si,scls) = hio_yesterdaycanopylevel_canopy_si_scls(io_si,scls) + & + real(ccohort%canopy_layer_yesterday, r8) * n_perm2 * AREA else hio_bstor_understory_si_scpf(io_si,scpf) = hio_bstor_understory_si_scpf(io_si,scpf) + & ccohort%bstore * n_perm2 * AREA @@ -1196,7 +1203,11 @@ subroutine update_history_dyn(this,nc,nsites,sites) ccohort%npp_bseed * n_perm2 * AREA * yeardays hio_npp_store_understory_si_scls(io_si,scls) = hio_npp_store_understory_si_scls(io_si,scls) + & ccohort%npp_store * n_perm2 * AREA * yeardays + hio_yesterdaycanopylevel_understory_si_scls(io_si,scls) = hio_yesterdaycanopylevel_understory_si_scls(io_si,scls) + & + real(ccohort%canopy_layer_yesterday, r8) * n_perm2 * AREA endif + ! + ccohort%canopy_layer_yesterday = ccohort%canopy_layer end associate end if @@ -2098,6 +2109,17 @@ subroutine define_history_vars(this, initialize_variables) upfreq=2, ivar=ivar, initialize=initialize_variables, index = ih_ar_frootm_si_scpf ) ! size-class only variables + + 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, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_yesterdaycanopylevel_canopy_si_scls ) + + call this%set_history_var(vname='YESTERDAYCANLEV_UNDERSTORY_SCLS', units = 'indiv/ha', & + long='Yesterdays canopy level for understory plants by size class', 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_yesterdaycanopylevel_understory_si_scls ) + call this%set_history_var(vname='BA_SCLS', units = 'm2/ha', & long='basal area by size class', use_default='active', & avgflag='A', vtype=site_size_r8, hlms='CLM:ALM', flushval=0.0_r8, & diff --git a/components/clm/src/ED/main/FatesRestartInterfaceMod.F90 b/components/clm/src/ED/main/FatesRestartInterfaceMod.F90 index 90b9dd21aa..d645992768 100644 --- a/components/clm/src/ED/main/FatesRestartInterfaceMod.F90 +++ b/components/clm/src/ED/main/FatesRestartInterfaceMod.F90 @@ -75,6 +75,7 @@ module FatesRestartInterfaceMod integer, private :: ir_broot_co integer, private :: ir_bstore_co integer, private :: ir_canopy_layer_co + integer, private :: ir_canopy_layer_yesterday_co integer, private :: ir_canopy_trim_co integer, private :: ir_dbh_co integer, private :: ir_height_co @@ -622,6 +623,10 @@ subroutine define_restart_vars(this, initialize_variables) long_name='ed cohort - canopy_layer', units='unitless', flushval = flushzero, & hlms='CLM:ALM', initialize=initialize_variables, ivar=ivar, index = ir_canopy_layer_co ) + call this%set_restart_var(vname='fates_canopy_layer_yesterday', vtype=cohort_r8, & + long_name='ed cohort - canopy_layer_yesterday', units='unitless', flushval = flushzero, & + hlms='CLM:ALM', initialize=initialize_variables, ivar=ivar, index = ir_canopy_layer_yesterday_co ) + call this%set_restart_var(vname='fates_canopy_trim', vtype=cohort_r8, & long_name='ed cohort - canopy_trim', units='fraction', flushval = flushzero, & hlms='CLM:ALM', initialize=initialize_variables, ivar=ivar, index = ir_canopy_trim_co ) @@ -1003,6 +1008,7 @@ subroutine set_restart_vectors(this,nc,nsites,sites) rio_broot_co => this%rvars(ir_broot_co)%r81d, & rio_bstore_co => this%rvars(ir_bstore_co)%r81d, & rio_canopy_layer_co => this%rvars(ir_canopy_layer_co)%r81d, & + rio_canopy_layer_yesterday_co => this%rvars(ir_canopy_layer_yesterday_co)%r81d, & rio_canopy_trim_co => this%rvars(ir_canopy_trim_co)%r81d, & rio_dbh_co => this%rvars(ir_dbh_co)%r81d, & rio_height_co => this%rvars(ir_height_co)%r81d, & @@ -1114,6 +1120,7 @@ subroutine set_restart_vectors(this,nc,nsites,sites) rio_broot_co(io_idx_co) = ccohort%br rio_bstore_co(io_idx_co) = ccohort%bstore rio_canopy_layer_co(io_idx_co) = ccohort%canopy_layer + rio_canopy_layer_yesterday_co(io_idx_co) = ccohort%canopy_layer_yesterday rio_canopy_trim_co(io_idx_co) = ccohort%canopy_trim rio_dbh_co(io_idx_co) = ccohort%dbh rio_height_co(io_idx_co) = ccohort%hite @@ -1410,6 +1417,7 @@ subroutine create_patchcohort_structure(this, nc, nsites, sites ) temp_cohort%laimemory = 0.0_r8 temp_cohort%canopy_trim = 0.0_r8 temp_cohort%canopy_layer = 1.0_r8 + temp_cohort%canopy_layer_yesterday = 1.0_r8 ! set the pft (only 2 used in ed) based on odd/even cohort ! number @@ -1571,6 +1579,7 @@ subroutine get_restart_vectors(this, nc, nsites, sites) rio_broot_co => this%rvars(ir_broot_co)%r81d, & rio_bstore_co => this%rvars(ir_bstore_co)%r81d, & rio_canopy_layer_co => this%rvars(ir_canopy_layer_co)%r81d, & + rio_canopy_layer_yesterday_co => this%rvars(ir_canopy_layer_yesterday_co)%r81d, & rio_canopy_trim_co => this%rvars(ir_canopy_trim_co)%r81d, & rio_dbh_co => this%rvars(ir_dbh_co)%r81d, & rio_height_co => this%rvars(ir_height_co)%r81d, & @@ -1667,6 +1676,7 @@ subroutine get_restart_vectors(this, nc, nsites, sites) ccohort%br = rio_broot_co(io_idx_co) ccohort%bstore = rio_bstore_co(io_idx_co) ccohort%canopy_layer = rio_canopy_layer_co(io_idx_co) + ccohort%canopy_layer_yesterday = rio_canopy_layer_yesterday_co(io_idx_co) ccohort%canopy_trim = rio_canopy_trim_co(io_idx_co) ccohort%dbh = rio_dbh_co(io_idx_co) ccohort%hite = rio_height_co(io_idx_co) From 4082f4cfd631e7bbe7db46af39823237cbc49446 Mon Sep 17 00:00:00 2001 From: ckoven Date: Tue, 21 Feb 2017 12:19:53 -0800 Subject: [PATCH 14/21] added new vars on demotion rates and updated prior canopy level to allow fusion --- .../ED/biogeochem/EDCanopyStructureMod.F90 | 17 +++++++ .../src/ED/biogeochem/EDCohortDynamicsMod.F90 | 7 ++- .../src/ED/biogeochem/EDPatchDynamicsMod.F90 | 2 +- components/clm/src/ED/main/EDInitMod.F90 | 4 ++ components/clm/src/ED/main/EDTypesMod.F90 | 6 ++- .../src/ED/main/FatesHistoryInterfaceMod.F90 | 44 +++++++++++++++++-- 6 files changed, 71 insertions(+), 9 deletions(-) diff --git a/components/clm/src/ED/biogeochem/EDCanopyStructureMod.F90 b/components/clm/src/ED/biogeochem/EDCanopyStructureMod.F90 index 3b8d94e6ed..f0f9511e9f 100755 --- a/components/clm/src/ED/biogeochem/EDCanopyStructureMod.F90 +++ b/components/clm/src/ED/biogeochem/EDCanopyStructureMod.F90 @@ -110,6 +110,8 @@ subroutine canopy_structure( currentSite ) ! Section 1: Check total canopy area. new_total_area_check = 0._r8 + currentSite%demotion_rate(:) = 0._r8 + currentSite%demotion_carbonflux = 0._r8 do while (associated(currentPatch)) ! Patch loop if (currentPatch%area .gt. min_patch_area) then ! avoid numerical weirdness that shouldn't be happening anyway @@ -198,6 +200,14 @@ subroutine canopy_structure( currentSite ) ! causing non-linearity issues with c_area. is this really required? currentCohort%dbh = currentCohort%dbh copyc%dbh = copyc%dbh !+ 0.000000000001_r8 + + ! keep track of number and biomass of demoted cohort + currentSite%demotion_rate(currentCohort%size_class) = & + currentSite%demotion_rate(currentCohort%size_class) + currentCohort%n + currentSite%demotion_carbonflux = currentSite%demotion_carbonflux + & + (currentCohort%bdead + currentCohort%bsw + currentCohort%bl + currentCohort%br + & + currentCohort%bstore) * currentCohort%n + !kill the ones which go into canopy layers that are not allowed... (default nclmax=2) if(i+1 > cp_nclmax)then !put the litter from the terminated cohorts into the fragmenting pools @@ -244,6 +254,13 @@ subroutine canopy_structure( currentSite ) currentCohort%canopy_layer = i + 1 !the whole cohort becomes demoted sumloss = sumloss + currentCohort%c_area + ! keep track of number and biomass of demoted cohort + currentSite%demotion_rate(currentCohort%size_class) = & + currentSite%demotion_rate(currentCohort%size_class) + currentCohort%n + currentSite%demotion_carbonflux = currentSite%demotion_carbonflux + & + (currentCohort%bdead + currentCohort%bsw + currentCohort%bl + currentCohort%br + & + currentCohort%bstore) * currentCohort%n + !kill the ones which go into canopy layers that are not allowed... (default cp_nclmax=2) if(i+1 > cp_nclmax)then !put the litter from the terminated cohorts into the fragmenting pools diff --git a/components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 b/components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 index 6fbdb3371b..0cb1f5d73a 100755 --- a/components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 +++ b/components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 @@ -94,7 +94,7 @@ subroutine create_cohort(patchptr, pft, nn, hite, dbh, & new_cohort%dbh = dbh new_cohort%canopy_trim = ctrim new_cohort%canopy_layer = clayer - new_cohort%canopy_layer_yesterday = clayer + new_cohort%canopy_layer_yesterday = real(clayer, r8) new_cohort%laimemory = laimemory new_cohort%bdead = bdead new_cohort%balive = balive @@ -335,7 +335,7 @@ subroutine nan_cohort(cc_p) currentCohort%pft = fates_unset_int ! pft number currentCohort%indexnumber = fates_unset_int ! unique number for each cohort. (within clump?) currentCohort%canopy_layer = fates_unset_int ! canopy status of cohort (1 = canopy, 2 = understorey, etc.) - currentCohort%canopy_layer_yesterday = fates_unset_int ! canopy status of cohort (1 = canopy, 2 = understorey, etc.) + currentCohort%canopy_layer_yesterday = nan ! recent canopy status of cohort (1 = canopy, 2 = understorey, etc.) currentCohort%NV = fates_unset_int ! Number of leaf layers: - currentCohort%status_coh = fates_unset_int ! growth status of plant (2 = leaves on , 1 = leaves off) currentCohort%size_class = fates_unset_int ! size class index @@ -766,6 +766,9 @@ subroutine fuse_cohorts(patchptr) 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 + ! recent canopy history + currentCohort%canopy_layer_yesterday = (currentCohort%n*currentCohort%canopy_layer_yesterday + nextc%n*nextc%canopy_layer_yesterday)/newn + do i=1, cp_nlevcan if (currentCohort%year_net_uptake(i) == 999._r8 .or. nextc%year_net_uptake(i) == 999._r8) then currentCohort%year_net_uptake(i) = min(nextc%year_net_uptake(i),currentCohort%year_net_uptake(i)) diff --git a/components/clm/src/ED/biogeochem/EDPatchDynamicsMod.F90 b/components/clm/src/ED/biogeochem/EDPatchDynamicsMod.F90 index 049a1e8aa8..a0136bb19c 100755 --- a/components/clm/src/ED/biogeochem/EDPatchDynamicsMod.F90 +++ b/components/clm/src/ED/biogeochem/EDPatchDynamicsMod.F90 @@ -262,7 +262,7 @@ subroutine spawn_patches( currentSite ) !this is the case as the new patch probably doesn't have a closed canopy, and ! even if it does, that will be sorted out in canopy_structure. nc%canopy_layer = 1 - nc%canopy_layer_yesterday = 1 + nc%canopy_layer_yesterday = 1._r8 !mortality is dominant disturbance if(currentPatch%disturbance_rates(1) > currentPatch%disturbance_rates(2))then diff --git a/components/clm/src/ED/main/EDInitMod.F90 b/components/clm/src/ED/main/EDInitMod.F90 index a9b9a98736..4bf0ea8ac1 100755 --- a/components/clm/src/ED/main/EDInitMod.F90 +++ b/components/clm/src/ED/main/EDInitMod.F90 @@ -83,6 +83,10 @@ subroutine zero_site( site_in ) site_in%terminated_nindivs(:,:,:) = 0._r8 site_in%recruitment_rate(:) = 0._r8 + ! demotion info + site_in%demotion_rate(:) = 0._r8 + site_in%demotion_carbonflux = 0._r8 + end subroutine zero_site ! ============================================================================ diff --git a/components/clm/src/ED/main/EDTypesMod.F90 b/components/clm/src/ED/main/EDTypesMod.F90 index c83fc0bf46..74123bace3 100755 --- a/components/clm/src/ED/main/EDTypesMod.F90 +++ b/components/clm/src/ED/main/EDTypesMod.F90 @@ -191,7 +191,7 @@ module EDTypesMod real(r8) :: bstore ! stored carbon: kGC per indiv real(r8) :: laimemory ! target leaf biomass- set from previous year: kGC per indiv integer :: canopy_layer ! canopy status of cohort (1 = canopy, 2 = understorey, etc.) - integer :: canopy_layer_yesterday ! canopy status of cohort (1 = canopy, 2 = understorey, etc.) + real(r8) :: canopy_layer_yesterday ! recent canopy status of cohort (1 = canopy, 2 = understorey, etc.) real to be conservative during fusion real(r8) :: b ! total biomass: kGC per indiv real(r8) :: bsw ! sapwood in stem and roots: kGC per indiv real(r8) :: bl ! leaf biomass: kGC per indiv @@ -559,9 +559,11 @@ module EDTypesMod real(r8) :: cwd_ag_burned(ncwd) real(r8) :: leaf_litter_burned(numpft_ed) - ! TERMINATION AND RECRUITMENT~ + ! TERMINATION, RECRUITMENT, AND DEMOTION real(r8) :: terminated_nindivs(1:nlevsclass_ed,1:mxpft,2) ! number of individuals that were in cohorts which were terminated this timestep, on size x pft x canopy array. real(r8) :: recruitment_rate(1:mxpft) ! number of individuals that were recruited into new cohorts + real(r8) :: demotion_rate(1:nlevsclass_ed) ! rate of individuals demoted from canopy to understory per FATES timestep + real(r8) :: demotion_carbonflux ! biomass of demoted individuals from canopy to understory [gC/m2/s] end type ed_site_type diff --git a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 index 038ec6656d..b6f0d2bdad 100644 --- a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 +++ b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 @@ -66,6 +66,8 @@ module FatesHistoryInterfaceMod integer, private :: ih_gpp_canopy_pa integer, private :: ih_ar_understory_pa integer, private :: ih_gpp_understory_pa + integer, private :: ih_canopy_biomass_pa + integer, private :: ih_understory_biomass_pa ! Indices to (site) variables integer, private :: ih_nep_si @@ -91,6 +93,7 @@ module FatesHistoryInterfaceMod integer, private :: ih_cbal_err_tot_si integer, private :: ih_npatches_si integer, private :: ih_ncohorts_si + integer, private :: ih_demotion_carbonflux_si ! Indices to (site x scpf) variables integer, private :: ih_nplant_si_scpf @@ -143,6 +146,7 @@ module FatesHistoryInterfaceMod integer, private :: ih_nplant_understory_si_scls integer, private :: ih_mortality_canopy_si_scls integer, private :: ih_mortality_understory_si_scls + integer, private :: ih_demotion_rate_si_scls ! lots of non-default diagnostics for understanding canopy versus understory carbon balances integer, private :: ih_rdark_canopy_si_scls @@ -852,6 +856,8 @@ subroutine update_history_dyn(this,nc,nsites,sites) hio_balive_pa => this%hvars(ih_balive_pa)%r81d, & hio_bleaf_pa => this%hvars(ih_bleaf_pa)%r81d, & hio_btotal_pa => this%hvars(ih_btotal_pa)%r81d, & + hio_canopy_biomass_pa => this%hvars(ih_canopy_biomass_pa)%r81d, & + hio_understory_biomass_pa => this%hvars(ih_understory_biomass_pa)%r81d, & hio_gpp_si_scpf => this%hvars(ih_gpp_si_scpf)%r82d, & hio_npp_totl_si_scpf => this%hvars(ih_npp_totl_si_scpf)%r82d, & hio_npp_leaf_si_scpf => this%hvars(ih_npp_leaf_si_scpf)%r82d, & @@ -890,6 +896,8 @@ subroutine update_history_dyn(this,nc,nsites,sites) hio_nplant_understory_si_scls => this%hvars(ih_nplant_understory_si_scls)%r82d, & hio_mortality_canopy_si_scls => this%hvars(ih_mortality_canopy_si_scls)%r82d, & hio_mortality_understory_si_scls => this%hvars(ih_mortality_understory_si_scls)%r82d, & + hio_demotion_rate_si_scls => this%hvars(ih_demotion_rate_si_scls)%r82d, & + hio_demotion_carbonflux_si => this%hvars(ih_demotion_carbonflux_si)%r81d, & hio_leaf_md_canopy_si_scls => this%hvars(ih_leaf_md_canopy_si_scls)%r82d, & hio_root_md_canopy_si_scls => this%hvars(ih_root_md_canopy_si_scls)%r82d, & hio_carbon_balance_canopy_si_scls => this%hvars(ih_carbon_balance_canopy_si_scls)%r82d, & @@ -1110,6 +1118,7 @@ subroutine update_history_dyn(this,nc,nsites,sites) ccohort%bstore * n_perm2 * AREA hio_bleaf_canopy_si_scpf(io_si,scpf) = hio_bleaf_canopy_si_scpf(io_si,scpf) + & ccohort%bl * n_perm2 * AREA + hio_canopy_biomass_pa(io_pa) = hio_canopy_biomass_pa(io_pa) + n_density * ccohort%b * 1.e3_r8 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) * n_perm2*AREA hio_nplant_canopy_si_scpf(io_si,scpf) = hio_nplant_canopy_si_scpf(io_si,scpf) + AREA*n_perm2 @@ -1154,12 +1163,13 @@ subroutine update_history_dyn(this,nc,nsites,sites) hio_npp_store_canopy_si_scls(io_si,scls) = hio_npp_store_canopy_si_scls(io_si,scls) + & ccohort%npp_store * n_perm2 * AREA * yeardays hio_yesterdaycanopylevel_canopy_si_scls(io_si,scls) = hio_yesterdaycanopylevel_canopy_si_scls(io_si,scls) + & - real(ccohort%canopy_layer_yesterday, r8) * n_perm2 * AREA + ccohort%canopy_layer_yesterday * n_perm2 * AREA else hio_bstor_understory_si_scpf(io_si,scpf) = hio_bstor_understory_si_scpf(io_si,scpf) + & ccohort%bstore * n_perm2 * AREA hio_bleaf_understory_si_scpf(io_si,scpf) = hio_bleaf_understory_si_scpf(io_si,scpf) + & ccohort%bl * n_perm2 * AREA + hio_understory_biomass_pa(io_pa) = hio_understory_biomass_pa(io_pa) + n_density * ccohort%b * 1.e3_r8 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) * n_perm2*AREA hio_nplant_understory_si_scpf(io_si,scpf) = hio_nplant_understory_si_scpf(io_si,scpf) + AREA*n_perm2 @@ -1204,10 +1214,10 @@ subroutine update_history_dyn(this,nc,nsites,sites) hio_npp_store_understory_si_scls(io_si,scls) = hio_npp_store_understory_si_scls(io_si,scls) + & ccohort%npp_store * n_perm2 * AREA * yeardays hio_yesterdaycanopylevel_understory_si_scls(io_si,scls) = hio_yesterdaycanopylevel_understory_si_scls(io_si,scls) + & - real(ccohort%canopy_layer_yesterday, r8) * n_perm2 * AREA + ccohort%canopy_layer_yesterday * n_perm2 * AREA endif ! - ccohort%canopy_layer_yesterday = ccohort%canopy_layer + ccohort%canopy_layer_yesterday = real(ccohort%canopy_layer, r8) end associate end if @@ -1309,7 +1319,13 @@ subroutine update_history_dyn(this,nc,nsites,sites) hio_m6_si_scpf(io_si,i_scpf) end do end do - + + ! pass demotion rates and associated carbon fluxes to history + do i_scls = 1,nlevsclass_ed + hio_demotion_rate_si_scls(io_si,i_scls) = sites(s)%demotion_rate(i_scls) * yeardays + end do + hio_demotion_carbonflux_si(io_si) = sites(s)%demotion_carbonflux * 1e3 / (1e-4 * daysecs) + enddo ! site loop end associate @@ -1834,6 +1850,16 @@ subroutine define_history_vars(this, initialize_variables) avgflag='A', vtype=patch_r8, hlms='CLM:ALM', flushval=0.0_r8, upfreq=1, & ivar=ivar, initialize=initialize_variables, index = ih_btotal_pa ) + call this%set_history_var(vname='CANOPY_BIOMASS', units='gC m-2', & + long='Biomass of canopy plants', use_default='active', & + avgflag='A', vtype=patch_r8, hlms='CLM:ALM', flushval=0.0_r8, upfreq=1, & + ivar=ivar, initialize=initialize_variables, index = ih_canopy_biomass_pa ) + + call this%set_history_var(vname='UNDERSTORY_BIOMASS', units='gC m-2', & + long='Biomass of understory plants', use_default='active', & + avgflag='A', vtype=patch_r8, hlms='CLM:ALM', flushval=0.0_r8, upfreq=1, & + ivar=ivar, initialize=initialize_variables, index = ih_understory_biomass_pa ) + ! Ecosystem Carbon Fluxes (updated rapidly, upfreq=2) @@ -2125,6 +2151,16 @@ subroutine define_history_vars(this, initialize_variables) avgflag='A', vtype=site_size_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_ba_si_scls ) + call this%set_history_var(vname='DEMOTION_RATE_SCLS', units = 'indiv/ha/yr', & + long='demotion rate from canopy to understory by size class', use_default='active', & + avgflag='A', vtype=site_size_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_demotion_rate_si_scls ) + + call this%set_history_var(vname='DEMOTION_CARBONFLUX', units = 'gC/m2/s', & + long='demotion-associated biomass carbon flux from canopy to understory', use_default='active', & + avgflag='A', vtype=site_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_demotion_carbonflux_si ) + call this%set_history_var(vname='NPLANT_CANOPY_SCLS', units = 'indiv/ha', & long='number of canopy plants by size class', use_default='active', & avgflag='A', vtype=site_size_r8, hlms='CLM:ALM', flushval=0.0_r8, & From c3e01499e1be578523a150a3fd22b02d00388607 Mon Sep 17 00:00:00 2001 From: ckoven Date: Tue, 21 Feb 2017 22:01:19 -0800 Subject: [PATCH 15/21] fixed unit error and also added new diagnsotics on carbon fluxes from mortality and promotion --- .../ED/biogeochem/EDCanopyStructureMod.F90 | 40 ++++++++++++++----- .../src/ED/biogeochem/EDCohortDynamicsMod.F90 | 4 +- components/clm/src/ED/main/EDInitMod.F90 | 5 ++- components/clm/src/ED/main/EDTypesMod.F90 | 5 ++- .../src/ED/main/FatesHistoryInterfaceMod.F90 | 38 +++++++++++++++++- 5 files changed, 78 insertions(+), 14 deletions(-) diff --git a/components/clm/src/ED/biogeochem/EDCanopyStructureMod.F90 b/components/clm/src/ED/biogeochem/EDCanopyStructureMod.F90 index f0f9511e9f..148e53b1e1 100755 --- a/components/clm/src/ED/biogeochem/EDCanopyStructureMod.F90 +++ b/components/clm/src/ED/biogeochem/EDCanopyStructureMod.F90 @@ -105,13 +105,17 @@ subroutine canopy_structure( currentSite ) integer :: count_mi !---------------------------------------------------------------------- - currentPatch => currentSite%oldest_patch - - ! Section 1: Check total canopy area. - - new_total_area_check = 0._r8 + currentPatch => currentSite%oldest_patch + ! + ! zero site-level demotion / promotion tracking info currentSite%demotion_rate(:) = 0._r8 + currentSite%promotion_rate(:) = 0._r8 currentSite%demotion_carbonflux = 0._r8 + currentSite%promotion_carbonflux = 0._r8 + ! + ! Section 1: Check total canopy area. + ! + new_total_area_check = 0._r8 do while (associated(currentPatch)) ! Patch loop if (currentPatch%area .gt. min_patch_area) then ! avoid numerical weirdness that shouldn't be happening anyway @@ -205,8 +209,7 @@ subroutine canopy_structure( currentSite ) currentSite%demotion_rate(currentCohort%size_class) = & currentSite%demotion_rate(currentCohort%size_class) + currentCohort%n currentSite%demotion_carbonflux = currentSite%demotion_carbonflux + & - (currentCohort%bdead + currentCohort%bsw + currentCohort%bl + currentCohort%br + & - currentCohort%bstore) * currentCohort%n + currentCohort%b * currentCohort%n !kill the ones which go into canopy layers that are not allowed... (default nclmax=2) if(i+1 > cp_nclmax)then @@ -258,8 +261,7 @@ subroutine canopy_structure( currentSite ) currentSite%demotion_rate(currentCohort%size_class) = & currentSite%demotion_rate(currentCohort%size_class) + currentCohort%n currentSite%demotion_carbonflux = currentSite%demotion_carbonflux + & - (currentCohort%bdead + currentCohort%bsw + currentCohort%bl + currentCohort%br + & - currentCohort%bstore) * currentCohort%n + currentCohort%b * currentCohort%n !kill the ones which go into canopy layers that are not allowed... (default cp_nclmax=2) if(i+1 > cp_nclmax)then @@ -383,6 +385,12 @@ subroutine canopy_structure( currentSite ) currentCohort%canopy_layer = i currentCohort%c_area = c_area(currentCohort) + ! keep track of number and biomass of promoted cohort + currentSite%promotion_rate(currentCohort%size_class) = & + currentSite%promotion_rate(currentCohort%size_class) + currentCohort%n + currentSite%promotion_carbonflux = currentSite%promotion_carbonflux + & + currentCohort%b * currentCohort%n + ! write(fates_log(),*) 'promoting very small cohort', currentCohort%c_area,currentCohort%canopy_layer endif arealayer(currentCohort%canopy_layer) = arealayer(currentCohort%canopy_layer)+currentCohort%c_area @@ -442,12 +450,18 @@ subroutine canopy_structure( currentSite ) newarea = currentCohort%c_area - cc_gain !new area of existing cohort copyc%n = currentCohort%n*cc_gain/currentCohort%c_area !number of individuals in promoted cohort. - ! number of individuals in cohort remianing in understorey + ! number of individuals in cohort remaining in understorey currentCohort%n = currentCohort%n - (currentCohort%n*cc_gain/currentCohort%c_area) currentCohort%canopy_layer = i+1 !keep current cohort in the understory. copyc%canopy_layer = i ! promote copy to the higher canopy layer. + ! keep track of number and biomass of promoted cohort + currentSite%promotion_rate(copyc%size_class) = & + currentSite%promotion_rate(copyc%size_class) + copyc%n + currentSite%promotion_carbonflux = currentSite%promotion_carbonflux + & + copyc%b * copyc%n + ! seperate cohorts. ! needs to be a very small number to avoid causing non-linearity issues with c_area. ! is this really required? @@ -474,6 +488,12 @@ subroutine canopy_structure( currentSite ) ! if the upper canopy spread is smaller. this shold be dealt with by the 'excess area' loop. currentCohort%c_area = c_area(currentCohort) + ! keep track of number and biomass of promoted cohort + currentSite%promotion_rate(currentCohort%size_class) = & + currentSite%promotion_rate(currentCohort%size_class) + currentCohort%n + currentSite%promotion_carbonflux = currentSite%promotion_carbonflux + & + currentCohort%b * currentCohort%n + promswitch = 1 ! write(fates_log(),*) 'promoting whole cohort', currentCohort%c_area,cc_gain,currentCohort%canopy_layer, & diff --git a/components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 b/components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 index 0cb1f5d73a..3c3247bd32 100755 --- a/components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 +++ b/components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 @@ -570,7 +570,9 @@ subroutine terminate_cohorts( patchptr ) endif currentPatch%siteptr%terminated_nindivs(currentCohort%size_class,currentCohort%pft,levcan) = & currentPatch%siteptr%terminated_nindivs(currentCohort%size_class,currentCohort%pft,levcan) + currentCohort%n - + ! + currentPatch%siteptr%termination_carbonflux(levcan) = currentPatch%siteptr%termination_carbonflux(levcan) + & + currentCohort%n * currentCohort%b if (.not. associated(currentCohort%taller)) then currentPatch%tallest => currentCohort%shorter else diff --git a/components/clm/src/ED/main/EDInitMod.F90 b/components/clm/src/ED/main/EDInitMod.F90 index 4bf0ea8ac1..4d12e266fa 100755 --- a/components/clm/src/ED/main/EDInitMod.F90 +++ b/components/clm/src/ED/main/EDInitMod.F90 @@ -81,11 +81,14 @@ subroutine zero_site( site_in ) ! termination and recruitment info site_in%terminated_nindivs(:,:,:) = 0._r8 + site_in%termination_carbonflux(:) = 0._r8 site_in%recruitment_rate(:) = 0._r8 - ! demotion info + ! demotion/promotion info site_in%demotion_rate(:) = 0._r8 site_in%demotion_carbonflux = 0._r8 + site_in%promotion_rate(:) = 0._r8 + site_in%promotion_carbonflux = 0._r8 end subroutine zero_site diff --git a/components/clm/src/ED/main/EDTypesMod.F90 b/components/clm/src/ED/main/EDTypesMod.F90 index 74123bace3..6fe9171def 100755 --- a/components/clm/src/ED/main/EDTypesMod.F90 +++ b/components/clm/src/ED/main/EDTypesMod.F90 @@ -561,9 +561,12 @@ module EDTypesMod ! TERMINATION, RECRUITMENT, AND DEMOTION real(r8) :: terminated_nindivs(1:nlevsclass_ed,1:mxpft,2) ! number of individuals that were in cohorts which were terminated this timestep, on size x pft x canopy array. + real(r8) :: termination_carbonflux(2) ! carbon flux from live to dead pools associated with termination mortality, per canopy level real(r8) :: recruitment_rate(1:mxpft) ! number of individuals that were recruited into new cohorts real(r8) :: demotion_rate(1:nlevsclass_ed) ! rate of individuals demoted from canopy to understory per FATES timestep - real(r8) :: demotion_carbonflux ! biomass of demoted individuals from canopy to understory [gC/m2/s] + real(r8) :: demotion_carbonflux ! biomass of demoted individuals from canopy to understory [kgC/ha/day] + real(r8) :: promotion_rate(1:nlevsclass_ed) ! rate of individuals promoted from understory to canopy per FATES timestep + real(r8) :: promotion_carbonflux ! biomass of promoted individuals from understory to canopy [kgC/ha/day] end type ed_site_type diff --git a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 index b6f0d2bdad..9029eec566 100644 --- a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 +++ b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 @@ -94,6 +94,9 @@ module FatesHistoryInterfaceMod integer, private :: ih_npatches_si integer, private :: ih_ncohorts_si integer, private :: ih_demotion_carbonflux_si + integer, private :: ih_promotion_carbonflux_si + integer, private :: ih_canopy_mortality_carbonflux_si + integer, private :: ih_understory_mortality_carbonflux_si ! Indices to (site x scpf) variables integer, private :: ih_nplant_si_scpf @@ -147,6 +150,7 @@ module FatesHistoryInterfaceMod integer, private :: ih_mortality_canopy_si_scls integer, private :: ih_mortality_understory_si_scls integer, private :: ih_demotion_rate_si_scls + integer, private :: ih_promotion_rate_si_scls ! lots of non-default diagnostics for understanding canopy versus understory carbon balances integer, private :: ih_rdark_canopy_si_scls @@ -898,6 +902,10 @@ subroutine update_history_dyn(this,nc,nsites,sites) hio_mortality_understory_si_scls => this%hvars(ih_mortality_understory_si_scls)%r82d, & hio_demotion_rate_si_scls => this%hvars(ih_demotion_rate_si_scls)%r82d, & hio_demotion_carbonflux_si => this%hvars(ih_demotion_carbonflux_si)%r81d, & + hio_promotion_rate_si_scls => this%hvars(ih_promotion_rate_si_scls)%r82d, & + hio_promotion_carbonflux_si => this%hvars(ih_promotion_carbonflux_si)%r81d, & + hio_canopy_mortality_carbonflux_si => this%hvars(ih_canopy_mortality_carbonflux_si)%r81d, & + hio_understory_mortality_carbonflux_si => this%hvars(ih_understory_mortality_carbonflux_si)%r81d, & hio_leaf_md_canopy_si_scls => this%hvars(ih_leaf_md_canopy_si_scls)%r82d, & hio_root_md_canopy_si_scls => this%hvars(ih_root_md_canopy_si_scls)%r82d, & hio_carbon_balance_canopy_si_scls => this%hvars(ih_carbon_balance_canopy_si_scls)%r82d, & @@ -1133,6 +1141,9 @@ subroutine update_history_dyn(this,nc,nsites,sites) ! 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) * n_perm2*AREA + 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%b * ccohort%n * 1e3 / (1e4 * daysecs) ! hio_leaf_md_canopy_si_scls(io_si,scls) = hio_leaf_md_canopy_si_scls(io_si,scls) + & ccohort%leaf_md * n_perm2 * AREA @@ -1184,6 +1195,9 @@ subroutine update_history_dyn(this,nc,nsites,sites) ! 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) * n_perm2*AREA + 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%b * ccohort%n * 1e3 / (1e4 * daysecs) ! hio_leaf_md_understory_si_scls(io_si,scls) = hio_leaf_md_understory_si_scls(io_si,scls) + & ccohort%leaf_md * n_perm2 * AREA @@ -1323,8 +1337,20 @@ subroutine update_history_dyn(this,nc,nsites,sites) ! pass demotion rates and associated carbon fluxes to history do i_scls = 1,nlevsclass_ed hio_demotion_rate_si_scls(io_si,i_scls) = sites(s)%demotion_rate(i_scls) * yeardays + hio_promotion_rate_si_scls(io_si,i_scls) = sites(s)%promotion_rate(i_scls) * yeardays end do - hio_demotion_carbonflux_si(io_si) = sites(s)%demotion_carbonflux * 1e3 / (1e-4 * daysecs) + ! + ! convert kg C / ha / day to gc / m2 / sec + hio_demotion_carbonflux_si(io_si) = sites(s)%demotion_carbonflux * 1e3 / (1e4 * daysecs) + hio_promotion_carbonflux_si(io_si) = sites(s)%promotion_carbonflux * 1e3 / (1e4 * daysecs) + ! + ! mortality-associated carbon fluxes + hio_canopy_mortality_carbonflux_si(io_si) = hio_canopy_mortality_carbonflux_si(io_si) + & + sites(s)%termination_carbonflux(1) * 1e3 / (1e4 * daysecs) + hio_understory_mortality_carbonflux_si(io_si) = hio_understory_mortality_carbonflux_si(io_si) + & + sites(s)%termination_carbonflux(2) * 1e3 / (1e4 * daysecs) + ! and zero the site-level termination carbon flux variable + sites(s)%termination_carbonflux(:) = 0._r8 enddo ! site loop @@ -2161,6 +2187,16 @@ subroutine define_history_vars(this, initialize_variables) avgflag='A', vtype=site_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_demotion_carbonflux_si ) + call this%set_history_var(vname='PROMOTION_RATE_SCLS', units = 'indiv/ha/yr', & + long='promotion rate from understory to canopy by size class', use_default='active', & + avgflag='A', vtype=site_size_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_promotion_rate_si_scls ) + + call this%set_history_var(vname='PROMOTION_CARBONFLUX', units = 'gC/m2/s', & + long='promotion-associated biomass carbon flux from understory to canopy', use_default='active', & + avgflag='A', vtype=site_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_promotion_carbonflux_si ) + call this%set_history_var(vname='NPLANT_CANOPY_SCLS', units = 'indiv/ha', & long='number of canopy plants by size class', use_default='active', & avgflag='A', vtype=site_size_r8, hlms='CLM:ALM', flushval=0.0_r8, & From dd04f1559e08baac9f7c14f81c2560b563a7b594 Mon Sep 17 00:00:00 2001 From: ckoven Date: Wed, 22 Feb 2017 09:45:03 -0800 Subject: [PATCH 16/21] bufix and some cleanup --- .../src/ED/main/FatesHistoryInterfaceMod.F90 | 35 ++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 index 9029eec566..25614f5af6 100644 --- a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 +++ b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 @@ -1876,12 +1876,12 @@ subroutine define_history_vars(this, initialize_variables) avgflag='A', vtype=patch_r8, hlms='CLM:ALM', flushval=0.0_r8, upfreq=1, & ivar=ivar, initialize=initialize_variables, index = ih_btotal_pa ) - call this%set_history_var(vname='CANOPY_BIOMASS', units='gC m-2', & + call this%set_history_var(vname='BIOMASS_CANOPY', units='gC m-2', & long='Biomass of canopy plants', use_default='active', & avgflag='A', vtype=patch_r8, hlms='CLM:ALM', flushval=0.0_r8, upfreq=1, & ivar=ivar, initialize=initialize_variables, index = ih_canopy_biomass_pa ) - call this%set_history_var(vname='UNDERSTORY_BIOMASS', units='gC m-2', & + call this%set_history_var(vname='BIOMASS_UNDERSTORY', units='gC m-2', & long='Biomass of understory plants', use_default='active', & avgflag='A', vtype=patch_r8, hlms='CLM:ALM', flushval=0.0_r8, upfreq=1, & ivar=ivar, initialize=initialize_variables, index = ih_understory_biomass_pa ) @@ -1951,6 +1951,27 @@ subroutine define_history_vars(this, initialize_variables) avgflag='A', vtype=patch_r8, hlms='CLM:ALM', flushval=0.0_r8, upfreq=2, & ivar=ivar, initialize=initialize_variables, index = ih_ar_understory_pa ) + ! slow carbon fluxes associated with mortality from or transfer betweeen canopy and understory + call this%set_history_var(vname='DEMOTION_CARBONFLUX', units = 'gC/m2/s', & + long='demotion-associated biomass carbon flux from canopy to understory', use_default='active', & + avgflag='A', vtype=site_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_demotion_carbonflux_si ) + + call this%set_history_var(vname='PROMOTION_CARBONFLUX', units = 'gC/m2/s', & + long='promotion-associated biomass carbon flux from understory to canopy', use_default='active', & + avgflag='A', vtype=site_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_promotion_carbonflux_si ) + + call this%set_history_var(vname='MORTALITY_CARBONFLUX_CANOPY', units = 'gC/m2/s', & + long='flux of biomass carbon from live to dead pools from mortality of canopy plants', use_default='active', & + avgflag='A', vtype=site_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_canopy_mortality_carbonflux_si ) + + call this%set_history_var(vname='MORTALITY_CARBONFLUX_UNDERSTORY', units = 'gC/m2/s', & + long='flux of biomass carbon from live to dead pools from mortality of understory plants', use_default='active', & + avgflag='A', vtype=site_r8, hlms='CLM:ALM', flushval=0.0_r8, & + upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_understory_mortality_carbonflux_si ) + ! Carbon Flux (grid dimension x scpf) (THESE ARE DEFAULT INACTIVE!!! ! (BECAUSE THEY TAKE UP SPACE!!! @@ -2182,21 +2203,11 @@ subroutine define_history_vars(this, initialize_variables) avgflag='A', vtype=site_size_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_demotion_rate_si_scls ) - call this%set_history_var(vname='DEMOTION_CARBONFLUX', units = 'gC/m2/s', & - long='demotion-associated biomass carbon flux from canopy to understory', use_default='active', & - avgflag='A', vtype=site_r8, hlms='CLM:ALM', flushval=0.0_r8, & - upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_demotion_carbonflux_si ) - call this%set_history_var(vname='PROMOTION_RATE_SCLS', units = 'indiv/ha/yr', & long='promotion rate from understory to canopy by size class', use_default='active', & avgflag='A', vtype=site_size_r8, hlms='CLM:ALM', flushval=0.0_r8, & upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_promotion_rate_si_scls ) - call this%set_history_var(vname='PROMOTION_CARBONFLUX', units = 'gC/m2/s', & - long='promotion-associated biomass carbon flux from understory to canopy', use_default='active', & - avgflag='A', vtype=site_r8, hlms='CLM:ALM', flushval=0.0_r8, & - upfreq=1, ivar=ivar, initialize=initialize_variables, index = ih_promotion_carbonflux_si ) - call this%set_history_var(vname='NPLANT_CANOPY_SCLS', units = 'indiv/ha', & long='number of canopy plants by size class', use_default='active', & avgflag='A', vtype=site_size_r8, hlms='CLM:ALM', flushval=0.0_r8, & From cb812d9967bf2b93088c7d64be6e803fb5e1beb8 Mon Sep 17 00:00:00 2001 From: ckoven Date: Wed, 22 Feb 2017 12:47:33 -0800 Subject: [PATCH 17/21] fixed unit error on mortality_carbonflux_canopy and mortality_carbonflux_understory --- components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 index 25614f5af6..f65832537c 100644 --- a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 +++ b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 @@ -1143,7 +1143,7 @@ subroutine update_history_dyn(this,nc,nsites,sites) (ccohort%bmort + ccohort%hmort + ccohort%cmort + ccohort%imort + ccohort%fmort) * n_perm2*AREA 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%b * ccohort%n * 1e3 / (1e4 * daysecs) + ccohort%b * ccohort%n * 1e3 / (1e4 * daysecs * yeardays) ! hio_leaf_md_canopy_si_scls(io_si,scls) = hio_leaf_md_canopy_si_scls(io_si,scls) + & ccohort%leaf_md * n_perm2 * AREA @@ -1197,7 +1197,7 @@ subroutine update_history_dyn(this,nc,nsites,sites) (ccohort%bmort + ccohort%hmort + ccohort%cmort + ccohort%imort + ccohort%fmort) * n_perm2*AREA 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%b * ccohort%n * 1e3 / (1e4 * daysecs) + ccohort%b * ccohort%n * 1e3 / (1e4 * daysecs * yeardays) ! hio_leaf_md_understory_si_scls(io_si,scls) = hio_leaf_md_understory_si_scls(io_si,scls) + & ccohort%leaf_md * n_perm2 * AREA From b9fd99e64460525aed2b39989955daaa17fe7423 Mon Sep 17 00:00:00 2001 From: ckoven Date: Wed, 22 Feb 2017 13:49:07 -0800 Subject: [PATCH 18/21] fixed a unit error on the canopy/understory-reoslved tissue npp fluxes, which was traced back to a wrong description in EDTypesMod. Also cleanup. --- components/clm/src/ED/main/EDTypesMod.F90 | 12 +- .../src/ED/main/FatesHistoryInterfaceMod.F90 | 106 +++++++++--------- 2 files changed, 59 insertions(+), 59 deletions(-) diff --git a/components/clm/src/ED/main/EDTypesMod.F90 b/components/clm/src/ED/main/EDTypesMod.F90 index 6fe9171def..326126a5b3 100755 --- a/components/clm/src/ED/main/EDTypesMod.F90 +++ b/components/clm/src/ED/main/EDTypesMod.F90 @@ -250,12 +250,12 @@ module EDTypesMod ! Net Primary Production Partitions - real(r8) :: npp_leaf ! NPP into leaves (includes replacement of turnover): KgC/indiv/day - real(r8) :: npp_froot ! NPP into fine roots (includes replacement of turnover): KgC/indiv/day - real(r8) :: npp_bsw ! NPP into sapwood: KgC/indiv/day - real(r8) :: npp_bdead ! NPP into deadwood (structure): KgC/indiv/day - real(r8) :: npp_bseed ! NPP into seeds: KgC/indiv/day - real(r8) :: npp_store ! NPP into storage: KgC/indiv/day + real(r8) :: npp_leaf ! NPP into leaves (includes replacement of turnover): KgC/indiv/year + real(r8) :: npp_froot ! NPP into fine roots (includes replacement of turnover): KgC/indiv/year + real(r8) :: npp_bsw ! NPP into sapwood: KgC/indiv/year + real(r8) :: npp_bdead ! NPP into deadwood (structure): KgC/indiv/year + real(r8) :: npp_bseed ! NPP into seeds: KgC/indiv/year + real(r8) :: npp_store ! NPP into storage: KgC/indiv/year real(r8) :: ts_net_uptake(cp_nlevcan) ! Net uptake of leaf layers: kgC/m2/s real(r8) :: year_net_uptake(cp_nlevcan) ! Net uptake of leaf layers: kgC/m2/year diff --git a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 index f65832537c..774c6308fc 100644 --- a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 +++ b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 @@ -1099,136 +1099,136 @@ subroutine update_history_dyn(this,nc,nsites,sites) ! Woody State Variables (basal area and number density and mortality) if (pftcon%woody(ft) == 1) then - hio_m1_si_scpf(io_si,scpf) = hio_m1_si_scpf(io_si,scpf) + ccohort%bmort*n_perm2*AREA - hio_m2_si_scpf(io_si,scpf) = hio_m2_si_scpf(io_si,scpf) + ccohort%hmort*n_perm2*AREA - hio_m3_si_scpf(io_si,scpf) = hio_m3_si_scpf(io_si,scpf) + ccohort%cmort*n_perm2*AREA - hio_m4_si_scpf(io_si,scpf) = hio_m4_si_scpf(io_si,scpf) + ccohort%imort*n_perm2*AREA - hio_m5_si_scpf(io_si,scpf) = hio_m5_si_scpf(io_si,scpf) + ccohort%fmort*n_perm2*AREA + hio_m1_si_scpf(io_si,scpf) = hio_m1_si_scpf(io_si,scpf) + ccohort%bmort*ccohort%n + hio_m2_si_scpf(io_si,scpf) = hio_m2_si_scpf(io_si,scpf) + ccohort%hmort*ccohort%n + hio_m3_si_scpf(io_si,scpf) = hio_m3_si_scpf(io_si,scpf) + ccohort%cmort*ccohort%n + hio_m4_si_scpf(io_si,scpf) = hio_m4_si_scpf(io_si,scpf) + ccohort%imort*ccohort%n + hio_m5_si_scpf(io_si,scpf) = hio_m5_si_scpf(io_si,scpf) + ccohort%fmort*ccohort%n ! basal area [m2/ha] hio_ba_si_scpf(io_si,scpf) = hio_ba_si_scpf(io_si,scpf) + & - 0.25_r8*3.14159_r8*((dbh/100.0_r8)**2.0_r8)*n_perm2*AREA + 0.25_r8*3.14159_r8*((dbh/100.0_r8)**2.0_r8)*ccohort%n ! also by size class only hio_ba_si_scls(io_si,scls) = hio_ba_si_scls(io_si,scls) + & - 0.25_r8*3.14159_r8*((dbh/100.0_r8)**2.0_r8)*n_perm2*AREA + 0.25_r8*3.14159_r8*((dbh/100.0_r8)**2.0_r8)*ccohort%n ! number density [/ha] - hio_nplant_si_scpf(io_si,scpf) = hio_nplant_si_scpf(io_si,scpf) + AREA*n_perm2 + hio_nplant_si_scpf(io_si,scpf) = hio_nplant_si_scpf(io_si,scpf) + ccohort%n ! growth increment hio_ddbh_si_scpf(io_si,scpf) = hio_ddbh_si_scpf(io_si,scpf) + & - ccohort%ddbhdt*n_perm2*AREA + ccohort%ddbhdt*ccohort%n end if ! update SCPF/SCLS- and canopy/subcanopy- partitioned quantities if (ccohort%canopy_layer .eq. 1) then hio_bstor_canopy_si_scpf(io_si,scpf) = hio_bstor_canopy_si_scpf(io_si,scpf) + & - ccohort%bstore * n_perm2 * AREA + ccohort%bstore * ccohort%n hio_bleaf_canopy_si_scpf(io_si,scpf) = hio_bleaf_canopy_si_scpf(io_si,scpf) + & - ccohort%bl * n_perm2 * AREA + ccohort%bl * ccohort%n hio_canopy_biomass_pa(io_pa) = hio_canopy_biomass_pa(io_pa) + n_density * ccohort%b * 1.e3_r8 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) * n_perm2*AREA - hio_nplant_canopy_si_scpf(io_si,scpf) = hio_nplant_canopy_si_scpf(io_si,scpf) + AREA*n_perm2 - hio_nplant_canopy_si_scls(io_si,scls) = hio_nplant_canopy_si_scls(io_si,scls) + AREA*n_perm2 + (ccohort%bmort + ccohort%hmort + ccohort%cmort + ccohort%imort + 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_gpp_canopy_si_scpf(io_si,scpf) = hio_gpp_canopy_si_scpf(io_si,scpf) + & n_perm2*ccohort%gpp_acc_hold hio_ar_canopy_si_scpf(io_si,scpf) = hio_ar_canopy_si_scpf(io_si,scpf) + & n_perm2*ccohort%resp_acc_hold ! growth increment hio_ddbh_canopy_si_scpf(io_si,scpf) = hio_ddbh_canopy_si_scpf(io_si,scpf) + & - ccohort%ddbhdt*n_perm2*AREA + 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) * n_perm2*AREA + (ccohort%bmort + ccohort%hmort + ccohort%cmort + ccohort%imort + 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%b * ccohort%n * 1e3 / (1e4 * daysecs * yeardays) ! hio_leaf_md_canopy_si_scls(io_si,scls) = hio_leaf_md_canopy_si_scls(io_si,scls) + & - ccohort%leaf_md * n_perm2 * AREA + ccohort%leaf_md * ccohort%n hio_root_md_canopy_si_scls(io_si,scls) = hio_root_md_canopy_si_scls(io_si,scls) + & - ccohort%root_md * n_perm2 * AREA + ccohort%root_md * ccohort%n hio_carbon_balance_canopy_si_scls(io_si,scls) = hio_carbon_balance_canopy_si_scls(io_si,scls) + & - ccohort%carbon_balance * n_perm2 * AREA + ccohort%carbon_balance * ccohort%n hio_seed_prod_canopy_si_scls(io_si,scls) = hio_seed_prod_canopy_si_scls(io_si,scls) + & - ccohort%seed_prod * n_perm2 * AREA + ccohort%seed_prod * ccohort%n hio_dbalivedt_canopy_si_scls(io_si,scls) = hio_dbalivedt_canopy_si_scls(io_si,scls) + & - ccohort%dbalivedt * n_perm2 * AREA + ccohort%dbalivedt * ccohort%n hio_dbdeaddt_canopy_si_scls(io_si,scls) = hio_dbdeaddt_canopy_si_scls(io_si,scls) + & - ccohort%dbdeaddt * n_perm2 * AREA + ccohort%dbdeaddt * ccohort%n hio_dbstoredt_canopy_si_scls(io_si,scls) = hio_dbstoredt_canopy_si_scls(io_si,scls) + & - ccohort%dbstoredt * n_perm2 * AREA + ccohort%dbstoredt * ccohort%n hio_storage_flux_canopy_si_scls(io_si,scls) = hio_storage_flux_canopy_si_scls(io_si,scls) + & - ccohort%storage_flux * n_perm2 * AREA + ccohort%storage_flux * ccohort%n hio_npp_leaf_canopy_si_scls(io_si,scls) = hio_npp_leaf_canopy_si_scls(io_si,scls) + & - ccohort%npp_leaf * n_perm2 * AREA * yeardays + ccohort%npp_leaf * ccohort%n hio_npp_froot_canopy_si_scls(io_si,scls) = hio_npp_froot_canopy_si_scls(io_si,scls) + & - ccohort%npp_froot * n_perm2 * AREA * yeardays + ccohort%npp_froot * ccohort%n hio_npp_bsw_canopy_si_scls(io_si,scls) = hio_npp_bsw_canopy_si_scls(io_si,scls) + & - ccohort%npp_bsw * n_perm2 * AREA * yeardays + ccohort%npp_bsw * ccohort%n hio_npp_bdead_canopy_si_scls(io_si,scls) = hio_npp_bdead_canopy_si_scls(io_si,scls) + & - ccohort%npp_bdead * n_perm2 * AREA * yeardays + ccohort%npp_bdead * ccohort%n hio_npp_bseed_canopy_si_scls(io_si,scls) = hio_npp_bseed_canopy_si_scls(io_si,scls) + & - ccohort%npp_bseed * n_perm2 * AREA * yeardays + ccohort%npp_bseed * ccohort%n hio_npp_store_canopy_si_scls(io_si,scls) = hio_npp_store_canopy_si_scls(io_si,scls) + & - ccohort%npp_store * n_perm2 * AREA * yeardays + ccohort%npp_store * ccohort%n hio_yesterdaycanopylevel_canopy_si_scls(io_si,scls) = hio_yesterdaycanopylevel_canopy_si_scls(io_si,scls) + & - ccohort%canopy_layer_yesterday * n_perm2 * AREA + ccohort%canopy_layer_yesterday * ccohort%n else hio_bstor_understory_si_scpf(io_si,scpf) = hio_bstor_understory_si_scpf(io_si,scpf) + & - ccohort%bstore * n_perm2 * AREA + ccohort%bstore * ccohort%n hio_bleaf_understory_si_scpf(io_si,scpf) = hio_bleaf_understory_si_scpf(io_si,scpf) + & - ccohort%bl * n_perm2 * AREA + ccohort%bl * ccohort%n hio_understory_biomass_pa(io_pa) = hio_understory_biomass_pa(io_pa) + n_density * ccohort%b * 1.e3_r8 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) * n_perm2*AREA - hio_nplant_understory_si_scpf(io_si,scpf) = hio_nplant_understory_si_scpf(io_si,scpf) + AREA*n_perm2 - hio_nplant_understory_si_scls(io_si,scls) = hio_nplant_understory_si_scls(io_si,scls) + AREA*n_perm2 + (ccohort%bmort + ccohort%hmort + ccohort%cmort + ccohort%imort + 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_gpp_understory_si_scpf(io_si,scpf) = hio_gpp_understory_si_scpf(io_si,scpf) + & n_perm2*ccohort%gpp_acc_hold hio_ar_understory_si_scpf(io_si,scpf) = hio_ar_understory_si_scpf(io_si,scpf) + & n_perm2*ccohort%resp_acc_hold ! growth increment hio_ddbh_understory_si_scpf(io_si,scpf) = hio_ddbh_understory_si_scpf(io_si,scpf) + & - ccohort%ddbhdt*n_perm2*AREA + 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) * n_perm2*AREA + (ccohort%bmort + ccohort%hmort + ccohort%cmort + ccohort%imort + 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%b * ccohort%n * 1e3 / (1e4 * daysecs * yeardays) ! hio_leaf_md_understory_si_scls(io_si,scls) = hio_leaf_md_understory_si_scls(io_si,scls) + & - ccohort%leaf_md * n_perm2 * AREA + ccohort%leaf_md * ccohort%n hio_root_md_understory_si_scls(io_si,scls) = hio_root_md_understory_si_scls(io_si,scls) + & - ccohort%root_md * n_perm2 * AREA + ccohort%root_md * ccohort%n hio_carbon_balance_understory_si_scls(io_si,scls) = hio_carbon_balance_understory_si_scls(io_si,scls) + & - ccohort%carbon_balance * n_perm2 * AREA + ccohort%carbon_balance * ccohort%n hio_seed_prod_understory_si_scls(io_si,scls) = hio_seed_prod_understory_si_scls(io_si,scls) + & - ccohort%seed_prod * n_perm2 * AREA + ccohort%seed_prod * ccohort%n hio_dbalivedt_understory_si_scls(io_si,scls) = hio_dbalivedt_understory_si_scls(io_si,scls) + & - ccohort%dbalivedt * n_perm2 * AREA + ccohort%dbalivedt * ccohort%n hio_dbdeaddt_understory_si_scls(io_si,scls) = hio_dbdeaddt_understory_si_scls(io_si,scls) + & - ccohort%dbdeaddt * n_perm2 * AREA + ccohort%dbdeaddt * ccohort%n hio_dbstoredt_understory_si_scls(io_si,scls) = hio_dbstoredt_understory_si_scls(io_si,scls) + & - ccohort%dbstoredt * n_perm2 * AREA + ccohort%dbstoredt * ccohort%n hio_storage_flux_understory_si_scls(io_si,scls) = hio_storage_flux_understory_si_scls(io_si,scls) + & - ccohort%storage_flux * n_perm2 * AREA + ccohort%storage_flux * ccohort%n hio_npp_leaf_understory_si_scls(io_si,scls) = hio_npp_leaf_understory_si_scls(io_si,scls) + & - ccohort%npp_leaf * n_perm2 * AREA * yeardays + ccohort%npp_leaf * ccohort%n hio_npp_froot_understory_si_scls(io_si,scls) = hio_npp_froot_understory_si_scls(io_si,scls) + & - ccohort%npp_froot * n_perm2 * AREA * yeardays + ccohort%npp_froot * ccohort%n hio_npp_bsw_understory_si_scls(io_si,scls) = hio_npp_bsw_understory_si_scls(io_si,scls) + & - ccohort%npp_bsw * n_perm2 * AREA * yeardays + ccohort%npp_bsw * ccohort%n hio_npp_bdead_understory_si_scls(io_si,scls) = hio_npp_bdead_understory_si_scls(io_si,scls) + & - ccohort%npp_bdead * n_perm2 * AREA * yeardays + ccohort%npp_bdead * ccohort%n hio_npp_bseed_understory_si_scls(io_si,scls) = hio_npp_bseed_understory_si_scls(io_si,scls) + & - ccohort%npp_bseed * n_perm2 * AREA * yeardays + ccohort%npp_bseed * ccohort%n hio_npp_store_understory_si_scls(io_si,scls) = hio_npp_store_understory_si_scls(io_si,scls) + & - ccohort%npp_store * n_perm2 * AREA * yeardays + ccohort%npp_store * ccohort%n hio_yesterdaycanopylevel_understory_si_scls(io_si,scls) = hio_yesterdaycanopylevel_understory_si_scls(io_si,scls) + & - ccohort%canopy_layer_yesterday * n_perm2 * AREA + ccohort%canopy_layer_yesterday * ccohort%n endif ! ccohort%canopy_layer_yesterday = real(ccohort%canopy_layer, r8) From 416e5901beaf3c165592111d232efb1eeec3bf64 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Fri, 3 Mar 2017 11:23:43 -0800 Subject: [PATCH 19/21] Swapped indices on terminated_nindivs array, bugfix. --- components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 index 774c6308fc..4892de2d6b 100644 --- a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 +++ b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 @@ -1300,7 +1300,7 @@ subroutine update_history_dyn(this,nc,nsites,sites) do i_pft = 1, mxpft do i_scls = 1,nlevsclass_ed i_scpf = (i_pft-1)*nlevsclass_ed + i_scls - hio_m6_si_scpf(io_si,i_scpf) = (sites(s)%terminated_nindivs(i_pft,i_scls,1) + & + hio_m6_si_scpf(io_si,i_scpf) = (sites(s)%terminated_nindivs(i_scls,i_pft,1) + & sites(s)%terminated_nindivs(i_scls,i_pft,2)) * yeardays hio_mortality_canopy_si_scls(io_si,i_scls) = hio_mortality_canopy_si_scls(io_si,i_scls) + & sites(s)%terminated_nindivs(i_scls,i_pft,1) * yeardays From cb364b9e3d1df2cc0f297c6d0e24711c5069e5ba Mon Sep 17 00:00:00 2001 From: ckoven Date: Wed, 8 Mar 2017 19:07:35 -0800 Subject: [PATCH 20/21] cleaned up site pointer issues --- .../clm/src/ED/biogeochem/EDCanopyStructureMod.F90 | 10 +++++----- .../clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 | 9 +++++---- .../clm/src/ED/biogeochem/EDPatchDynamicsMod.F90 | 4 ++-- components/clm/src/ED/biogeochem/EDPhysiologyMod.F90 | 2 +- components/clm/src/ED/main/EDMainMod.F90 | 4 ++-- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/components/clm/src/ED/biogeochem/EDCanopyStructureMod.F90 b/components/clm/src/ED/biogeochem/EDCanopyStructureMod.F90 index 23368746c9..2516b18dfc 100755 --- a/components/clm/src/ED/biogeochem/EDCanopyStructureMod.F90 +++ b/components/clm/src/ED/biogeochem/EDCanopyStructureMod.F90 @@ -307,7 +307,7 @@ subroutine canopy_structure( currentSite ) enddo !currentCohort - call terminate_cohorts(currentPatch) + call terminate_cohorts(currentSite, currentPatch) arealayer(i) = arealayer(i) - sumloss !Update arealayer for diff calculations of layer below. arealayer(i + 1) = arealayer(i + 1) + sumloss @@ -343,9 +343,9 @@ subroutine canopy_structure( currentSite ) enddo !is there still excess area in any layer? - call terminate_cohorts(currentPatch) + call terminate_cohorts(currentSite, currentPatch) call fuse_cohorts(currentPatch) - call terminate_cohorts(currentPatch) + call terminate_cohorts(currentSite, currentPatch) ! ----------- Check cohort area ------------------------------! do i = 1,z @@ -565,9 +565,9 @@ subroutine canopy_structure( currentSite ) endif enddo !is there still not enough canopy area in any layer? - call terminate_cohorts(currentPatch) + call terminate_cohorts(currentSite, currentPatch) call fuse_cohorts(currentPatch) - call terminate_cohorts(currentPatch) + call terminate_cohorts(currentSite, currentPatch) if(promswitch == 1)then !write(fates_log(),*) 'going into cohort check' diff --git a/components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 b/components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 index 1ff9971d82..d02f3c0300 100755 --- a/components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 +++ b/components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 @@ -485,7 +485,7 @@ subroutine zero_cohort(cc_p) end subroutine zero_cohort !-------------------------------------------------------------------------------------! - subroutine terminate_cohorts( patchptr ) + subroutine terminate_cohorts( siteptr, patchptr ) ! ! !DESCRIPTION: ! terminates cohorts when they get too small @@ -495,6 +495,7 @@ subroutine terminate_cohorts( patchptr ) use SFParamsMod, only : SF_val_CWD_frac ! ! !ARGUMENTS + type (ed_site_type), intent(inout), target :: siteptr type (ed_patch_type), intent(inout), target :: patchptr ! ! !LOCAL VARIABLES: @@ -571,10 +572,10 @@ subroutine terminate_cohorts( patchptr ) else levcan = 2 endif - currentPatch%siteptr%terminated_nindivs(currentCohort%size_class,currentCohort%pft,levcan) = & - currentPatch%siteptr%terminated_nindivs(currentCohort%size_class,currentCohort%pft,levcan) + currentCohort%n + siteptr%terminated_nindivs(currentCohort%size_class,currentCohort%pft,levcan) = & + siteptr%terminated_nindivs(currentCohort%size_class,currentCohort%pft,levcan) + currentCohort%n ! - currentPatch%siteptr%termination_carbonflux(levcan) = currentPatch%siteptr%termination_carbonflux(levcan) + & + siteptr%termination_carbonflux(levcan) = siteptr%termination_carbonflux(levcan) + & currentCohort%n * currentCohort%b if (.not. associated(currentCohort%taller)) then currentPatch%tallest => currentCohort%shorter diff --git a/components/clm/src/ED/biogeochem/EDPatchDynamicsMod.F90 b/components/clm/src/ED/biogeochem/EDPatchDynamicsMod.F90 index 237c831af5..fd5423eeec 100755 --- a/components/clm/src/ED/biogeochem/EDPatchDynamicsMod.F90 +++ b/components/clm/src/ED/biogeochem/EDPatchDynamicsMod.F90 @@ -396,7 +396,7 @@ subroutine spawn_patches( currentSite ) !sort out the cohorts, since some of them may be so small as to need removing. call fuse_cohorts(currentPatch) - call terminate_cohorts(currentPatch) + call terminate_cohorts(currentSite, currentPatch) call sort_cohorts(currentPatch) currentPatch => currentPatch%younger @@ -413,7 +413,7 @@ subroutine spawn_patches( currentSite ) currentSite%youngest_patch => new_patch call fuse_cohorts(new_patch) - call terminate_cohorts(new_patch) + call terminate_cohorts(currentSite, new_patch) call sort_cohorts(new_patch) endif !end new_patch area diff --git a/components/clm/src/ED/biogeochem/EDPhysiologyMod.F90 b/components/clm/src/ED/biogeochem/EDPhysiologyMod.F90 index 0cdd239021..f2ffc055e9 100755 --- a/components/clm/src/ED/biogeochem/EDPhysiologyMod.F90 +++ b/components/clm/src/ED/biogeochem/EDPhysiologyMod.F90 @@ -1081,7 +1081,7 @@ subroutine recruitment( t, currentSite, currentPatch ) temp_cohort%laimemory, cohortstatus, temp_cohort%canopy_trim, currentPatch%NCL_p) ! keep track of how many individuals were recruited for passing to history - currentPatch%siteptr%recruitment_rate(ft) = currentPatch%siteptr%recruitment_rate(ft) + temp_cohort%n + currentSite%recruitment_rate(ft) = currentSite%recruitment_rate(ft) + temp_cohort%n endif enddo !pft loop diff --git a/components/clm/src/ED/main/EDMainMod.F90 b/components/clm/src/ED/main/EDMainMod.F90 index d06ff59218..780787e2df 100755 --- a/components/clm/src/ED/main/EDMainMod.F90 +++ b/components/clm/src/ED/main/EDMainMod.F90 @@ -118,7 +118,7 @@ subroutine ed_ecosystem_dynamics(currentSite, bc_in) call fuse_cohorts(currentPatch) ! kills cohorts that are too small - call terminate_cohorts(currentPatch) + call terminate_cohorts(currentSite, currentPatch) currentPatch => currentPatch%younger @@ -341,7 +341,7 @@ subroutine ed_update_site( currentSite, bc_in ) currentPatch => currentSite%oldest_patch do while(associated(currentPatch)) - call terminate_cohorts(currentPatch) + call terminate_cohorts(currentSite, currentPatch) ! FIX(SPM,040314) why is this needed for BFB restarts? Look into this at some point cohort_number = count_cohorts(currentPatch) From c40a748c880175533ca7efcc014e8282830ca127 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Wed, 8 Mar 2017 21:16:46 -0800 Subject: [PATCH 21/21] Fixed some overly long line lengths. --- components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 | 3 ++- components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 b/components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 index d02f3c0300..f1bbdde262 100755 --- a/components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 +++ b/components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 @@ -773,7 +773,8 @@ subroutine fuse_cohorts(patchptr) currentCohort%npp_store = (currentCohort%n*currentCohort%npp_store + nextc%n*nextc%npp_store)/newn ! recent canopy history - currentCohort%canopy_layer_yesterday = (currentCohort%n*currentCohort%canopy_layer_yesterday + nextc%n*nextc%canopy_layer_yesterday)/newn + currentCohort%canopy_layer_yesterday = (currentCohort%n*currentCohort%canopy_layer_yesterday + & + nextc%n*nextc%canopy_layer_yesterday)/newn do i=1, nlevcan if (currentCohort%year_net_uptake(i) == 999._r8 .or. nextc%year_net_uptake(i) == 999._r8) then diff --git a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 index eb95615af3..d7aa01ec11 100644 --- a/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 +++ b/components/clm/src/ED/main/FatesHistoryInterfaceMod.F90 @@ -1227,7 +1227,8 @@ subroutine update_history_dyn(this,nc,nsites,sites) ccohort%npp_bseed * ccohort%n hio_npp_store_understory_si_scls(io_si,scls) = hio_npp_store_understory_si_scls(io_si,scls) + & ccohort%npp_store * ccohort%n - hio_yesterdaycanopylevel_understory_si_scls(io_si,scls) = hio_yesterdaycanopylevel_understory_si_scls(io_si,scls) + & + hio_yesterdaycanopylevel_understory_si_scls(io_si,scls) = & + hio_yesterdaycanopylevel_understory_si_scls(io_si,scls) + & ccohort%canopy_layer_yesterday * ccohort%n endif !