From 6dc557e31011efa4bf888e372651bed17647d89f Mon Sep 17 00:00:00 2001 From: Charles D Koven Date: Tue, 22 Oct 2024 15:55:16 -0700 Subject: [PATCH 01/20] fixed harvest rates when bare ground >0 --- biogeochem/EDLoggingMortalityMod.F90 | 29 +++++++++++++++----------- biogeochem/EDMortalityFunctionsMod.F90 | 11 +++++----- biogeochem/EDPatchDynamicsMod.F90 | 6 ++---- main/EDMainMod.F90 | 4 ++-- 4 files changed, 26 insertions(+), 24 deletions(-) diff --git a/biogeochem/EDLoggingMortalityMod.F90 b/biogeochem/EDLoggingMortalityMod.F90 index 7ff878dbc6..988add6bdc 100644 --- a/biogeochem/EDLoggingMortalityMod.F90 +++ b/biogeochem/EDLoggingMortalityMod.F90 @@ -207,7 +207,7 @@ subroutine LoggingMortality_frac( currentSite, bc_in, pft_i, dbh, canopy_layer, hlm_harvest_rates, hlm_harvest_catnames, & hlm_harvest_units, & patch_land_use_label, secondary_age, & - frac_site_primary, frac_site_secondary, harvestable_forest_c, & + current_fates_landuse_state_vector, harvestable_forest_c, & harvest_tag) ! Arguments @@ -223,8 +223,7 @@ subroutine LoggingMortality_frac( currentSite, bc_in, pft_i, dbh, canopy_layer, real(r8), intent(in) :: secondary_age ! patch level age_since_anthro_disturbance real(r8), intent(in) :: harvestable_forest_c(:) ! total harvestable forest carbon ! of all hlm harvest categories - real(r8), intent(in) :: frac_site_primary - real(r8), intent(in) :: frac_site_secondary + real(r8), intent(in) :: current_fates_landuse_state_vector(n_landuse_cats) ! [m2/m2] real(r8), intent(out) :: lmort_direct ! direct (harvestable) mortality fraction real(r8), intent(out) :: lmort_collateral ! collateral damage mortality fraction real(r8), intent(out) :: lmort_infra ! infrastructure mortality fraction @@ -309,7 +308,7 @@ subroutine LoggingMortality_frac( currentSite, bc_in, pft_i, dbh, canopy_layer, ! Get the area-based harvest rates based on info passed to FATES from the boundary condition call get_harvest_rate_area (patch_land_use_label, hlm_harvest_catnames, & - hlm_harvest_rates, frac_site_primary, frac_site_secondary, secondary_young_fraction, secondary_age, harvest_rate) + hlm_harvest_rates, current_fates_landuse_state_vector, secondary_young_fraction, secondary_age, harvest_rate) ! For area-based harvest, harvest_tag shall always be 2 (not applicable). harvest_tag = 2 @@ -406,7 +405,7 @@ end subroutine LoggingMortality_frac ! ============================================================================ subroutine get_harvest_rate_area (patch_land_use_label, hlm_harvest_catnames, hlm_harvest_rates, & - frac_site_primary, frac_site_secondary, secondary_young_fraction, secondary_age, harvest_rate) + current_fates_landuse_state_vector, secondary_young_fraction, secondary_age, harvest_rate) ! ------------------------------------------------------------------------------------------- @@ -420,14 +419,16 @@ subroutine get_harvest_rate_area (patch_land_use_label, hlm_harvest_catnames, hl character(len=64), intent(in) :: hlm_harvest_catnames(:) ! names of hlm harvest categories integer, intent(in) :: patch_land_use_label ! patch level land_use_label real(r8), intent(in) :: secondary_age ! patch level age_since_anthro_disturbance - real(r8), intent(in) :: frac_site_primary - real(r8), intent(in) :: frac_site_secondary + real(r8), intent(in) :: current_fates_landuse_state_vector(n_landuse_cats) ! [m2/m2] real(r8), intent(in) :: secondary_young_fraction ! what fraction of secondary land is young secondary land real(r8), intent(out) :: harvest_rate ! Local Variables integer :: h_index ! for looping over harvest categories integer :: icode ! Integer equivalent of the event code (parameter file only allows reals) + real(r8) :: frac_site_primary + real(r8) :: frac_site_secondary + real(r8) :: frac_not_bareground ! Loop around harvest categories to determine the annual hlm harvest rate for the current cohort based on patch history info ! We do account forest only since non-forest harvest has geographical mismatch to LUH2 dataset @@ -456,19 +457,23 @@ subroutine get_harvest_rate_area (patch_land_use_label, hlm_harvest_catnames, hl ! since harvest_rate is specified as a fraction of the gridcell ! also need to put a cap so as not to harvest more primary or secondary area than there is in a gridcell ! For secondary, also need to normalize by the young/old fraction. + ! Lastly, we need to remove the bare ground fraction since the harvest rates are per unit area of the not-bare-ground fraction. + frac_site_primary = current_fates_landuse_state_vector(primaryland) + frac_site_secondary = current_fates_landuse_state_vector(secondaryland) + frac_not_bareground = sum(current_fates_landuse_state_vector(:)) if (patch_land_use_label .eq. primaryland) then - if (frac_site_primary .gt. fates_tiny) then - harvest_rate = min((harvest_rate / frac_site_primary),1._r8) + if (frac_site_primary .gt. fates_tiny .and. frac_not_bareground .gt. fates_tiny) then + harvest_rate = min((harvest_rate / (frac_site_primary / frac_not_bareground)),1._r8) else harvest_rate = 0._r8 endif else if (patch_land_use_label .eq. secondaryland) then ! the .gt. -0.5 in the next line is because frac_site_secondary returns -1 if no secondary area. - if (frac_site_secondary .gt. fates_tiny .and. frac_site_secondary .gt. -0.5_r8) then + if (frac_site_secondary .gt. fates_tiny .and. frac_site_secondary .gt. -0.5_r8 .and. frac_not_bareground .gt. fates_tiny) then if (secondary_age .lt. secondary_age_threshold) then - harvest_rate = min((harvest_rate / (frac_site_secondary * secondary_young_fraction)), 1._r8) + harvest_rate = min((harvest_rate / ((frac_site_secondary / frac_not_bareground) * secondary_young_fraction)), 1._r8) else - harvest_rate = min((harvest_rate / (frac_site_secondary * (1._r8 - secondary_young_fraction))), 1._r8) + harvest_rate = min((harvest_rate / ((frac_site_secondary / frac_not_bareground) * (1._r8 - secondary_young_fraction))), 1._r8) endif else harvest_rate = 0._r8 diff --git a/biogeochem/EDMortalityFunctionsMod.F90 b/biogeochem/EDMortalityFunctionsMod.F90 index 2778f3c0b7..ba65ad0801 100644 --- a/biogeochem/EDMortalityFunctionsMod.F90 +++ b/biogeochem/EDMortalityFunctionsMod.F90 @@ -29,7 +29,7 @@ module EDMortalityFunctionsMod use FatesInterfaceTypesMod , only : hlm_use_tree_damage use EDLoggingMortalityMod , only : LoggingMortality_frac use EDParamsMod , only : fates_mortality_disturbance_fraction - + use FatesConstantsMod , only : n_landuse_cats use PRTGenericMod, only : carbon12_element use PRTGenericMod, only : store_organ use PRTParametersMod , only : prt_params @@ -281,7 +281,7 @@ end subroutine mortality_rates subroutine Mortality_Derivative( currentSite, currentCohort, bc_in, btran_ft, & mean_temp, land_use_label, age_since_anthro_disturbance, & - frac_site_primary, frac_site_secondary, harvestable_forest_c, harvest_tag) + current_fates_landuse_state_vector, harvestable_forest_c, harvest_tag) ! ! !DESCRIPTION: @@ -300,9 +300,8 @@ subroutine Mortality_Derivative( currentSite, currentCohort, bc_in, btran_ft, & real(r8), intent(in) :: mean_temp integer, intent(in) :: land_use_label real(r8), intent(in) :: age_since_anthro_disturbance - real(r8), intent(in) :: frac_site_primary - real(r8), intent(in) :: frac_site_secondary - + real(r8), intent(in) :: current_fates_landuse_state_vector(n_landuse_cats) + real(r8), intent(in) :: harvestable_forest_c(:) ! total carbon available for logging, kgC site-1 integer, intent(out) :: harvest_tag(:) ! tag to record the harvest status ! for the calculation of harvest debt in C-based @@ -340,7 +339,7 @@ subroutine Mortality_Derivative( currentSite, currentCohort, bc_in, btran_ft, & bc_in%hlm_harvest_units, & land_use_label, & age_since_anthro_disturbance, & - frac_site_primary, frac_site_secondary, harvestable_forest_c, harvest_tag) + current_fates_landuse_state_vector, harvestable_forest_c, harvest_tag) if (currentCohort%canopy_layer > 1)then ! Include understory logging mortality rates not associated with disturbance diff --git a/biogeochem/EDPatchDynamicsMod.F90 b/biogeochem/EDPatchDynamicsMod.F90 index 696a88514c..2b1fd242ca 100644 --- a/biogeochem/EDPatchDynamicsMod.F90 +++ b/biogeochem/EDPatchDynamicsMod.F90 @@ -271,8 +271,7 @@ subroutine disturbance_rates( site_in, bc_in) bc_in%hlm_harvest_units, & currentPatch%land_use_label, & currentPatch%age_since_anthro_disturbance, & - current_fates_landuse_state_vector(primaryland), & - current_fates_landuse_state_vector(secondaryland), & + current_fates_landuse_state_vector, & harvestable_forest_c, & harvest_tag) @@ -401,8 +400,7 @@ subroutine disturbance_rates( site_in, bc_in) harvest_rate, harvest_tag) else call get_harvest_rate_area (currentPatch%land_use_label, bc_in%hlm_harvest_catnames, & - bc_in%hlm_harvest_rates, current_fates_landuse_state_vector(primaryland), & - current_fates_landuse_state_vector(secondaryland), secondary_young_fraction, & + bc_in%hlm_harvest_rates, current_fates_landuse_state_vector, secondary_young_fraction, & currentPatch%age_since_anthro_disturbance, harvest_rate) end if diff --git a/main/EDMainMod.F90 b/main/EDMainMod.F90 index 1e7ee14e13..ff36138e03 100644 --- a/main/EDMainMod.F90 +++ b/main/EDMainMod.F90 @@ -478,8 +478,8 @@ subroutine ed_integrate_state_variables(currentSite, bc_in, bc_out ) call Mortality_Derivative(currentSite, currentCohort, bc_in, & currentPatch%btran_ft, mean_temp, & currentPatch%land_use_label, & - currentPatch%age_since_anthro_disturbance, current_fates_landuse_state_vector(primaryland), & - current_fates_landuse_state_vector(secondaryland), harvestable_forest_c, harvest_tag) + currentPatch%age_since_anthro_disturbance, current_fates_landuse_state_vector, & + harvestable_forest_c, harvest_tag) ! ----------------------------------------------------------------------------- ! Apply Plant Allocation and Reactive Transport From dacea7ccc6d9e6fcb0b5f855227c0b628d1e378b Mon Sep 17 00:00:00 2001 From: Charles D Koven Date: Tue, 22 Oct 2024 16:25:22 -0700 Subject: [PATCH 02/20] added primary lands age dist history diagnostic, and updated some var names on secondary diags --- main/FatesHistoryInterfaceMod.F90 | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/main/FatesHistoryInterfaceMod.F90 b/main/FatesHistoryInterfaceMod.F90 index 364ad816cf..769fb2e144 100644 --- a/main/FatesHistoryInterfaceMod.F90 +++ b/main/FatesHistoryInterfaceMod.F90 @@ -113,6 +113,7 @@ module FatesHistoryInterfaceMod use FatesConstantsMod , only : grav_earth use FatesLitterMod , only : litter_type use FatesConstantsMod , only : secondaryland + use FatesConstantsMod , only : primaryland use PRTGenericMod , only : leaf_organ, fnrt_organ, sapw_organ use PRTGenericMod , only : struct_organ, store_organ, repro_organ @@ -664,6 +665,7 @@ module FatesHistoryInterfaceMod integer :: ih_c_lblayer_si_age integer :: ih_agesince_anthrodist_si_age integer :: ih_secondarylands_area_si_age + integer :: ih_primarylands_area_si_age integer :: ih_area_burnt_si_age ! integer :: ih_fire_rate_of_spread_front_si_age integer :: ih_fire_intensity_si_age @@ -3275,6 +3277,7 @@ subroutine update_history_dyn2(this,nc,nsites,sites,bc_in) hio_biomass_si_age => this%hvars(ih_biomass_si_age)%r82d, & hio_agesince_anthrodist_si_age => this%hvars(ih_agesince_anthrodist_si_age)%r82d, & hio_secondarylands_area_si_age => this%hvars(ih_secondarylands_area_si_age)%r82d, & + hio_primarylands_area_si_age => this%hvars(ih_primarylands_area_si_age)%r82d, & hio_area_si_landuse => this%hvars(ih_area_si_landuse)%r82d, & hio_area_burnt_si_age => this%hvars(ih_area_burnt_si_age)%r82d, & ! hio_fire_rate_of_spread_front_si_age => this%hvars(ih_fire_rate_of_spread_front_si_age)%r82d, & @@ -3449,6 +3452,12 @@ subroutine update_history_dyn2(this,nc,nsites,sites,bc_in) hio_secondarylands_area_si_age(io_si,cpatch%age_class) = & hio_secondarylands_area_si_age(io_si,cpatch%age_class) & + cpatch%area * AREA_INV + + else if ( cpatch%land_use_label .eq. primaryland) then + hio_primarylands_area_si_age(io_si,cpatch%age_class) = & + hio_primarylands_area_si_age(io_si,cpatch%age_class) & + + cpatch%area * AREA_INV + endif @@ -7053,20 +7062,27 @@ subroutine define_history_vars(this, initialize_variables) hlms='CLM:ALM', upfreq=group_dyna_complx, ivar=ivar, initialize=initialize_variables, & index=ih_biomass_si_age) - call this%set_history_var(vname='FATES_SECONDAREA_ANTHRODIST_AP', & + call this%set_history_var(vname='FATES_SECONDARY_ANTHRODISTAGE_AP', & units='m2 m-2', & - long='secondary forest patch area age distribution since anthropgenic disturbance', & + long='secondary forest patch area age distribution since anthropogenic disturbance', & use_default='inactive', avgflag='A', vtype=site_age_r8, & hlms='CLM:ALM', upfreq=group_dyna_complx, ivar=ivar, initialize=initialize_variables, & index=ih_agesince_anthrodist_si_age) - call this%set_history_var(vname='FATES_SECONDAREA_DIST_AP', & + call this%set_history_var(vname='FATES_SECONDARY_AREA_AP', & units='m2 m-2', & long='secondary forest patch area age distribution since any kind of disturbance', & use_default='inactive', avgflag='A', vtype=site_age_r8, & hlms='CLM:ALM', upfreq=group_dyna_complx, ivar=ivar, initialize=initialize_variables, & index=ih_secondarylands_area_si_age) + call this%set_history_var(vname='FATES_PRIMARY_AREA_AP', & + units='m2 m-2', & + long='primary forest patch area age distribution since any kind of disturbance', & + use_default='inactive', avgflag='A', vtype=site_age_r8, & + hlms='CLM:ALM', upfreq=group_dyna_complx, ivar=ivar, initialize=initialize_variables, & + index=ih_primarylands_area_si_age) + call this%set_history_var(vname='FATES_FRAGMENTATION_SCALER_SL', units='', & long='factor (0-1) by which litter/cwd fragmentation proceeds relative to max rate by soil layer', & use_default='active', avgflag='A', vtype=site_soil_r8, & From 1895896ea6810755b82ad4a082615b99540e498c Mon Sep 17 00:00:00 2001 From: Charles D Koven Date: Fri, 25 Oct 2024 08:13:06 -0700 Subject: [PATCH 03/20] adding variable names from luh2 harvest drivers --- biogeochem/EDLoggingMortalityMod.F90 | 52 ++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/biogeochem/EDLoggingMortalityMod.F90 b/biogeochem/EDLoggingMortalityMod.F90 index 988add6bdc..54e9f0d71a 100644 --- a/biogeochem/EDLoggingMortalityMod.F90 +++ b/biogeochem/EDLoggingMortalityMod.F90 @@ -67,7 +67,7 @@ module EDLoggingMortalityMod use PRTGenericMod , only : sapw_organ, struct_organ, leaf_organ use PRTGenericMod , only : fnrt_organ, store_organ, repro_organ use FatesAllometryMod , only : set_root_fraction - use FatesConstantsMod , only : primaryland, secondaryland, secondary_age_threshold + use FatesConstantsMod , only : primaryland, secondaryland, secondary_age_threshold, nocomp_bareground_land use FatesConstantsMod , only : fates_tiny use FatesConstantsMod , only : months_per_year, days_per_sec, years_per_day, g_per_kg use FatesConstantsMod , only : hlm_harvest_area_fraction @@ -298,12 +298,17 @@ subroutine LoggingMortality_frac( currentSite, bc_in, pft_i, dbh, canopy_layer, ! Definitions of the underlying harvest land category variables ! these are hardcoded to match the LUH input data via landuse.timseries file (see dynHarvestMod) ! these are fractions of vegetated area harvested, split into five land category variables + + ! if using the classic CLM/ELM surface file, the variable names are: ! HARVEST_VH1 = harvest from primary forest ! HARVEST_VH2 = harvest from primary non-forest ! HARVEST_SH1 = harvest from secondary mature forest ! HARVEST_SH2 = harvest from secondary young forest ! HARVEST_SH3 = harvest from secondary non-forest (assume this is young for biomass) + ! if using the direct LUH2 drivers, the variabel names are instead (if using area-based logging): + ! 'primf_harv', 'primn_harv', 'secmf_harv', 'secyf_harv', 'secnf_harv' + secondary_young_fraction = currentSite%get_secondary_young_fraction() ! Get the area-based harvest rates based on info passed to FATES from the boundary condition @@ -386,16 +391,29 @@ subroutine LoggingMortality_frac( currentSite, bc_in, pft_i, dbh, canopy_layer, endif else - call GetInitLanduseHarvestRate(bc_in, currentSite%min_allowed_landuse_fraction, & - harvest_rate, currentSite%landuse_vector_gt_min) - lmort_direct = 0.0_r8 - lmort_collateral = 0.0_r8 - lmort_infra = 0.0_r8 - l_degrad = 0.0_r8 - if(prt_params%woody(pft_i) == itrue)then - lmort_direct = harvest_rate - else if (canopy_layer .eq. 1) then - l_degrad = harvest_rate + ! the logic below is mainly to prevent conversion of bare ground land; everything else should be primary at this point. + if ( patch_land_use_label .eq. primaryland ) then + call GetInitLanduseHarvestRate(bc_in, currentSite%min_allowed_landuse_fraction, & + harvest_rate, currentSite%landuse_vector_gt_min) + lmort_direct = 0.0_r8 + lmort_collateral = 0.0_r8 + lmort_infra = 0.0_r8 + l_degrad = 0.0_r8 + if(prt_params%woody(pft_i) == itrue)then + lmort_direct = harvest_rate + else if (canopy_layer .eq. 1) then + l_degrad = harvest_rate + endif + else if ( patch_land_use_label .eq. nocomp_bareground_land ) then + lmort_direct = 0.0_r8 + lmort_collateral = 0.0_r8 + lmort_infra = 0.0_r8 + l_degrad = 0.0_r8 + else + write(fates_log(),*) 'trying to transition away from something that isnt either primary or bare ground,' + write(fates_log(),*) 'on what should be a first timestep away from potential vaegetatino. this shouldnt happen.' + write(fates_log(),*) 'exiting' + call endrun(msg=errMsg(sourcefile, __LINE__)) endif endif @@ -431,23 +449,27 @@ subroutine get_harvest_rate_area (patch_land_use_label, hlm_harvest_catnames, hl real(r8) :: frac_not_bareground ! Loop around harvest categories to determine the annual hlm harvest rate for the current cohort based on patch history info - ! We do account forest only since non-forest harvest has geographical mismatch to LUH2 dataset harvest_rate = 0._r8 do h_index = 1,hlm_num_lu_harvest_cats if (patch_land_use_label .eq. primaryland) then if(hlm_harvest_catnames(h_index) .eq. "HARVEST_VH1" .or. & - hlm_harvest_catnames(h_index) .eq. "HARVEST_VH2") then + hlm_harvest_catnames(h_index) .eq. "HARVEST_VH2" .or. & + hlm_harvest_catnames(h_index) .eq. "primf_harv" .or. & + hlm_harvest_catnames(h_index) .eq. "primn_harv") then harvest_rate = harvest_rate + hlm_harvest_rates(h_index) endif else if (patch_land_use_label .eq. secondaryland .and. & secondary_age >= secondary_age_threshold) then - if(hlm_harvest_catnames(h_index) .eq. "HARVEST_SH1") then + if(hlm_harvest_catnames(h_index) .eq. "HARVEST_SH1" .or. & + hlm_harvest_catnames(h_index) .eq. "secmf_harv") then harvest_rate = harvest_rate + hlm_harvest_rates(h_index) endif else if (patch_land_use_label .eq. secondaryland .and. & secondary_age < secondary_age_threshold) then if(hlm_harvest_catnames(h_index) .eq. "HARVEST_SH2" .or. & - hlm_harvest_catnames(h_index) .eq. "HARVEST_SH3") then + hlm_harvest_catnames(h_index) .eq. "HARVEST_SH3" .or. & + hlm_harvest_catnames(h_index) .eq. "secyf_harv" .or. & + hlm_harvest_catnames(h_index) .eq. "secnf_harv") then harvest_rate = harvest_rate + hlm_harvest_rates(h_index) endif endif From 59be47049fae2d2c138b9b5be0cfea7d8db3f64c Mon Sep 17 00:00:00 2001 From: Charles D Koven Date: Fri, 25 Oct 2024 08:14:26 -0700 Subject: [PATCH 04/20] handling open canopy initial landuse harvest conversion case --- biogeochem/FatesLandUseChangeMod.F90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/biogeochem/FatesLandUseChangeMod.F90 b/biogeochem/FatesLandUseChangeMod.F90 index 5873da97eb..bc2339305a 100644 --- a/biogeochem/FatesLandUseChangeMod.F90 +++ b/biogeochem/FatesLandUseChangeMod.F90 @@ -386,6 +386,8 @@ subroutine GetInitLanduseHarvestRate(bc_in, min_allowed_landuse_fraction, harves if ( state_vector(secondaryland) .gt. min_allowed_landuse_fraction) then harvest_rate = state_vector(secondaryland) landuse_vector_gt_min(secondaryland) = .true. + else + harvest_rate = 0._r8 endif end subroutine GetInitLanduseHarvestRate From e1711ab7db7b3600afc7ee330e0572ca55eb5d1e Mon Sep 17 00:00:00 2001 From: Charles D Koven Date: Fri, 25 Oct 2024 08:16:34 -0700 Subject: [PATCH 05/20] removing logic that prevents harvest at too-small rates --- biogeochem/EDPatchDynamicsMod.F90 | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/biogeochem/EDPatchDynamicsMod.F90 b/biogeochem/EDPatchDynamicsMod.F90 index 2b1fd242ca..a6559f5e56 100644 --- a/biogeochem/EDPatchDynamicsMod.F90 +++ b/biogeochem/EDPatchDynamicsMod.F90 @@ -428,11 +428,12 @@ subroutine disturbance_rates( site_in, bc_in) (currentPatch%area - currentPatch%total_canopy_area) * harvest_rate / currentPatch%area endif - ! For nocomp mode, we need to prevent producing too small patches, which may produce small patches - if ((hlm_use_nocomp .eq. itrue) .and. & - (currentPatch%disturbance_rates(dtype_ilog)*currentPatch%area .lt. min_patch_area_forced)) then - currentPatch%disturbance_rates(dtype_ilog) = 0._r8 - end if + ! cdk. Oct. 24, 2024. I don't think we need this anymore. commenting out. + ! ! For nocomp mode, we need to prevent producing too small patches, which may produce small patches + ! if ((hlm_use_nocomp .eq. itrue) .and. & + ! (currentPatch%disturbance_rates(dtype_ilog)*currentPatch%area .lt. min_patch_area_forced)) then + ! currentPatch%disturbance_rates(dtype_ilog) = 0._r8 + ! end if ! fraction of the logging disturbance rate that is non-harvested if (currentPatch%disturbance_rates(dtype_ilog) .gt. nearzero) then From cff10057db186bb40c2d1cbdd5151ac1977a6420 Mon Sep 17 00:00:00 2001 From: Charles D Koven Date: Fri, 25 Oct 2024 08:42:22 -0700 Subject: [PATCH 06/20] deleting most of the secondary-specific hist vars, in prep for adding some as lu-dim vars --- main/FatesHistoryInterfaceMod.F90 | 267 +----------------------------- 1 file changed, 2 insertions(+), 265 deletions(-) diff --git a/main/FatesHistoryInterfaceMod.F90 b/main/FatesHistoryInterfaceMod.F90 index 769fb2e144..6c2097cab3 100644 --- a/main/FatesHistoryInterfaceMod.F90 +++ b/main/FatesHistoryInterfaceMod.F90 @@ -353,12 +353,6 @@ module FatesHistoryInterfaceMod integer :: ih_understory_biomass_si integer :: ih_maint_resp_unreduced_si - integer :: ih_npp_secondary_si - integer :: ih_gpp_secondary_si - integer :: ih_aresp_secondary_si - integer :: ih_maint_resp_secondary_si - integer :: ih_growth_resp_secondary_si - integer :: ih_primaryland_fusion_error_si integer :: ih_area_si_landuse @@ -409,9 +403,7 @@ module FatesHistoryInterfaceMod integer :: ih_err_fates_elem integer :: ih_npatches_si - integer :: ih_npatches_sec_si integer :: ih_ncohorts_si - integer :: ih_ncohorts_sec_si integer :: ih_demotion_carbonflux_si integer :: ih_promotion_carbonflux_si integer :: ih_canopy_mortality_carbonflux_si @@ -429,8 +421,6 @@ module FatesHistoryInterfaceMod integer :: ih_froot_mr_si integer :: ih_livestem_mr_si integer :: ih_livecroot_mr_si - integer :: ih_fraction_secondary_forest_si - integer :: ih_biomass_secondary_forest_si integer :: ih_woodproduct_si integer :: ih_h2oveg_si integer :: ih_h2oveg_dead_si @@ -562,14 +552,6 @@ module FatesHistoryInterfaceMod integer :: ih_m9_si_scls integer :: ih_m10_si_scls - integer :: ih_m1_sec_si_scls - integer :: ih_m2_sec_si_scls - integer :: ih_m3_sec_si_scls - integer :: ih_m7_sec_si_scls - integer :: ih_m8_sec_si_scls - integer :: ih_m9_sec_si_scls - integer :: ih_m10_sec_si_scls - integer :: ih_m10_si_cacls integer :: ih_nplant_si_cacls @@ -619,11 +601,9 @@ module FatesHistoryInterfaceMod ! indices to (site x pft) variables integer :: ih_biomass_si_pft - integer :: ih_biomass_sec_si_pft integer :: ih_leafbiomass_si_pft integer :: ih_storebiomass_si_pft integer :: ih_nindivs_si_pft - integer :: ih_nindivs_sec_si_pft integer :: ih_recruitment_si_pft integer :: ih_recruitment_cflux_si_pft integer :: ih_mortality_si_pft @@ -636,9 +616,7 @@ module FatesHistoryInterfaceMod integer :: ih_canopycrownarea_si_pft integer :: ih_crownarea_si_cnlf integer :: ih_gpp_si_pft - integer :: ih_gpp_sec_si_pft integer :: ih_npp_si_pft - integer :: ih_npp_sec_si_pft integer :: ih_site_dstatus_si_pft integer :: ih_dleafoff_si_pft integer :: ih_dleafon_si_pft @@ -671,8 +649,6 @@ module FatesHistoryInterfaceMod integer :: ih_fire_intensity_si_age integer :: ih_fire_sum_fuel_si_age - integer :: ih_lai_secondary_si - ! indices to (site x height) variables integer :: ih_canopy_height_dist_si_height integer :: ih_leaf_height_dist_si_height @@ -2400,9 +2376,7 @@ subroutine update_history_dyn1(this,nc,nsites,sites,bc_in) real(r8) :: area_frac ! Fraction of area for this patch associate( hio_npatches_si => this%hvars(ih_npatches_si)%r81d, & - hio_npatches_sec_si => this%hvars(ih_npatches_sec_si)%r81d, & hio_ncohorts_si => this%hvars(ih_ncohorts_si)%r81d, & - hio_ncohorts_sec_si => this%hvars(ih_ncohorts_sec_si)%r81d, & hio_trimming_si => this%hvars(ih_trimming_si)%r81d, & hio_area_plant_si => this%hvars(ih_area_plant_si)%r81d, & hio_area_trees_si => this%hvars(ih_area_trees_si)%r81d, & @@ -2455,9 +2429,6 @@ subroutine update_history_dyn1(this,nc,nsites,sites,bc_in) 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_ustory_mortality_carbonflux_si => this%hvars(ih_understory_mortality_carbonflux_si)%r81d, & - hio_lai_secondary_si => this%hvars(ih_lai_secondary_si)%r81d, & - hio_fraction_secondary_forest_si => this%hvars(ih_fraction_secondary_forest_si)%r81d, & - hio_biomass_secondary_forest_si => this%hvars(ih_biomass_secondary_forest_si)%r81d, & hio_woodproduct_si => this%hvars(ih_woodproduct_si)%r81d, & hio_gdd_si => this%hvars(ih_gdd_si)%r81d, & hio_site_ncolddays_si => this%hvars(ih_site_ncolddays_si)%r81d, & @@ -2635,9 +2606,6 @@ subroutine update_history_dyn1(this,nc,nsites,sites,bc_in) ! Increment the number of patches per site hio_npatches_si(io_si) = hio_npatches_si(io_si) + 1._r8 - if ( cpatch%land_use_label .eq. secondaryland ) then - hio_npatches_sec_si(io_si) = hio_npatches_sec_si(io_si) + 1._r8 - end if hio_lai_si(io_si) = hio_lai_si(io_si) + sum( cpatch%canopy_area_profile(:,:,:) * cpatch%tlai_profile(:,:,:) ) * & cpatch%total_canopy_area * AREA_INV @@ -2657,17 +2625,6 @@ subroutine update_history_dyn1(this,nc,nsites,sites,bc_in) hio_tgrowth(io_si) = hio_tgrowth(io_si) + & (cpatch%tveg_lpa%GetMean()- t_water_freeze_k_1atm)*cpatch%area*AREA_INV - ! some diagnostics on secondary forest area and its age distribution - if ( cpatch%land_use_label .eq. secondaryland ) then - hio_fraction_secondary_forest_si(io_si) = hio_fraction_secondary_forest_si(io_si) + & - cpatch%area * AREA_INV - - ! Secondary forest mean LAI - - hio_lai_secondary_si(io_si) = hio_lai_secondary_si(io_si) & - + sum(cpatch%tlai_profile(:,:,:)) * cpatch%total_canopy_area - end if - ! Canopy trimming - degree to which canopy expansion is limited by leaf economics (0-1) if(associated(cpatch%tallest))then hio_trimming_si(io_si) = hio_trimming_si(io_si) + cpatch%tallest%canopy_trim * cpatch%area * AREA_INV @@ -2741,10 +2698,6 @@ subroutine update_history_dyn1(this,nc,nsites,sites,bc_in) ! Increment the number of cohorts per site hio_ncohorts_si(io_si) = hio_ncohorts_si(io_si) + 1._r8 - if ( cpatch%land_use_label .eq. secondaryland ) then - hio_ncohorts_sec_si(io_si) = hio_ncohorts_sec_si(io_si) + 1._r8 - end if - ! Update biomass components ! Mass pools [kg] elloop: do el = 1, num_elements @@ -2794,12 +2747,6 @@ subroutine update_history_dyn1(this,nc,nsites,sites,bc_in) hio_agb_si(io_si) = hio_agb_si(io_si) + n_perm2 * & ( leaf_m + (sapw_m + struct_m + store_m) * prt_params%allom_agb_frac(ccohort%pft) ) - ! track the total biomass on all secondary lands - if ( cpatch%land_use_label .eq. secondaryland ) then - hio_biomass_secondary_forest_si(io_si) = hio_biomass_secondary_forest_si(io_si) + & - total_m * ccohort%n * AREA_INV - endif - if( hlm_parteh_mode == prt_cnp_flex_allom_hyp) then this%hvars(ih_l2fr_si)%r81d(io_si) = & this%hvars(ih_l2fr_si)%r81d(io_si) + & @@ -2971,11 +2918,6 @@ subroutine update_history_dyn1(this,nc,nsites,sites,bc_in) ! Perform any necessary normalizations ! ---------------------------------------------------------------------------------------- - ! divide secondary plant leaf area by secondary forest area to get the secondary forest LAI - if (hio_fraction_secondary_forest_si(io_si) .gt. nearzero) then - hio_lai_secondary_si(io_si) = hio_lai_secondary_si(io_si) / (hio_fraction_secondary_forest_si(io_si)*AREA) - end if - ! Normalize crown-area weighted height if(site_ca>nearzero)then hio_ca_weighted_height_si(io_si) = hio_ca_weighted_height_si(io_si)/site_ca @@ -3105,11 +3047,9 @@ subroutine update_history_dyn2(this,nc,nsites,sites,bc_in) real(r8), parameter :: reallytalltrees = 1000. ! some large number (m) associate( hio_biomass_si_pft => this%hvars(ih_biomass_si_pft)%r82d, & - hio_biomass_sec_si_pft => this%hvars(ih_biomass_sec_si_pft)%r82d, & 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_nindivs_sec_si_pft => this%hvars(ih_nindivs_sec_si_pft)%r82d, & hio_recruitment_si_pft => this%hvars(ih_recruitment_si_pft)%r82d, & hio_recruitment_cflux_si_pft => this%hvars(ih_recruitment_cflux_si_pft)%r82d, & hio_seeds_out_gc_si_pft => this%hvars(ih_seeds_out_gc_si_pft)%r82d, & @@ -3122,9 +3062,7 @@ subroutine update_history_dyn2(this,nc,nsites,sites,bc_in) hio_crownarea_si_pft => this%hvars(ih_crownarea_si_pft)%r82d, & hio_canopycrownarea_si_pft => this%hvars(ih_canopycrownarea_si_pft)%r82d, & hio_gpp_si_pft => this%hvars(ih_gpp_si_pft)%r82d, & - hio_gpp_sec_si_pft => this%hvars(ih_gpp_sec_si_pft)%r82d, & hio_npp_si_pft => this%hvars(ih_npp_si_pft)%r82d, & - hio_npp_sec_si_pft => this%hvars(ih_npp_sec_si_pft)%r82d, & hio_fragmentation_scaler_sl => this%hvars(ih_fragmentation_scaler_sl)%r82d, & hio_litter_in_elem => this%hvars(ih_litter_in_elem)%r82d, & hio_litter_out_elem => this%hvars(ih_litter_out_elem)%r82d, & @@ -3204,14 +3142,7 @@ subroutine update_history_dyn2(this,nc,nsites,sites,bc_in) hio_m10_si_cacls => this%hvars(ih_m10_si_cacls)%r82d) ! Break up associates for NAG compilers - associate(hio_m1_sec_si_scls => this%hvars(ih_m1_sec_si_scls)%r82d, & - hio_m2_sec_si_scls => this%hvars(ih_m2_sec_si_scls)%r82d, & - hio_m3_sec_si_scls => this%hvars(ih_m3_sec_si_scls)%r82d, & - hio_m7_sec_si_scls => this%hvars(ih_m7_sec_si_scls)%r82d, & - hio_m8_sec_si_scls => this%hvars(ih_m8_sec_si_scls)%r82d, & - hio_m9_sec_si_scls => this%hvars(ih_m9_sec_si_scls)%r82d, & - hio_m10_sec_si_scls => this%hvars(ih_m10_sec_si_scls)%r82d, & - hio_c13disc_si_scpf => this%hvars(ih_c13disc_si_scpf)%r82d, & + associate(hio_c13disc_si_scpf => this%hvars(ih_c13disc_si_scpf)%r82d, & hio_cwd_elcwd => this%hvars(ih_cwd_elcwd)%r82d, & hio_cwd_ag_elem => this%hvars(ih_cwd_ag_elem)%r82d, & hio_cwd_bg_elem => this%hvars(ih_cwd_bg_elem)%r82d, & @@ -3597,13 +3528,6 @@ subroutine update_history_dyn2(this,nc,nsites,sites,bc_in) hio_nindivs_si_pft(io_si,ft) = hio_nindivs_si_pft(io_si,ft) + & ccohort%n * AREA_INV - if ( cpatch%land_use_label .eq. secondaryland ) then - hio_nindivs_sec_si_pft(io_si,ft) = hio_nindivs_sec_si_pft(io_si,ft) + & - ccohort%n * AREA_INV - hio_biomass_sec_si_pft(io_si, ft) = hio_biomass_sec_si_pft(io_si, ft) + & - (ccohort%n * AREA_INV) * total_m - end if - if(ccohort%isnew) then hio_recruitment_cflux_si_pft(io_si, ft) = hio_recruitment_cflux_si_pft(io_si, ft) + & (ccohort%n * AREA_INV) * total_m * days_per_year @@ -3695,13 +3619,6 @@ subroutine update_history_dyn2(this,nc,nsites,sites,bc_in) hio_npp_si_pft(io_si, ft) = hio_npp_si_pft(io_si, ft) + & ccohort%npp_acc_hold * n_perm2 / (days_per_year*sec_per_day) - if ( cpatch%land_use_label .eq. secondaryland ) then - hio_gpp_sec_si_pft(io_si, ft) = hio_gpp_sec_si_pft(io_si, ft) + & - ccohort%gpp_acc_hold * n_perm2 / (days_per_year*sec_per_day) - hio_npp_sec_si_pft(io_si, ft) = hio_npp_sec_si_pft(io_si, ft) + & - ccohort%npp_acc_hold * n_perm2 / (days_per_year*sec_per_day) - end if - ! Turnover pools [kgC/day] * [day/yr] = [kgC/yr] sapw_m_turnover = ccohort%prt%GetTurnover(sapw_organ, carbon12_element) * days_per_year store_m_turnover = ccohort%prt%GetTurnover(store_organ, carbon12_element) * days_per_year @@ -3818,23 +3735,6 @@ subroutine update_history_dyn2(this,nc,nsites,sites,bc_in) ccohort%frmort*ccohort%n / m2_per_ha hio_m9_si_scls(io_si,scls) = hio_m9_si_scls(io_si,scls) + ccohort%smort*ccohort%n / m2_per_ha - ! Examine secondary forest mortality and mortality rates - if(cpatch%land_use_label .eq. secondaryland) then - if (hlm_use_cohort_age_tracking .eq.itrue) then - hio_m10_sec_si_scls(io_si,scls) = hio_m10_sec_si_scls(io_si,scls) + & - ccohort%asmort*ccohort%n / m2_per_ha - end if - - hio_m1_sec_si_scls(io_si,scls) = hio_m1_sec_si_scls(io_si,scls) + ccohort%bmort*ccohort%n / m2_per_ha - hio_m2_sec_si_scls(io_si,scls) = hio_m2_sec_si_scls(io_si,scls) + ccohort%hmort*ccohort%n / m2_per_ha - hio_m3_sec_si_scls(io_si,scls) = hio_m3_sec_si_scls(io_si,scls) + ccohort%cmort*ccohort%n / m2_per_ha - hio_m7_sec_si_scls(io_si,scls) = hio_m7_sec_si_scls(io_si,scls) + & - (ccohort%lmort_direct+ccohort%lmort_collateral+ccohort%lmort_infra) * ccohort%n / m2_per_ha - hio_m8_sec_si_scls(io_si,scls) = hio_m8_sec_si_scls(io_si,scls) + & - ccohort%frmort*ccohort%n / m2_per_ha - hio_m9_sec_si_scls(io_si,scls) = hio_m9_sec_si_scls(io_si,scls) + ccohort%smort*ccohort%n / m2_per_ha - end if - !C13 discrimination if(abs(gpp_cached_scpf(scpf)-hlm_hio_ignore_val)>nearzero .and. & (gpp_cached_scpf(scpf) + ccohort%gpp_acc_hold) > 0.0_r8) then @@ -4453,12 +4353,6 @@ subroutine update_history_dyn2(this,nc,nsites,sites,bc_in) hio_mortality_canopy_si_scls(io_si,i_scls) = hio_mortality_canopy_si_scls(io_si,i_scls) + & sites(s)%fmort_rate_canopy(i_scls, ft) / m2_per_ha - ! Shijie: Think about how to add later? - !if ( cpatch%land_use_label .eq. secondaryland ) then - ! hio_mortality_canopy_secondary_si_scls(io_si,i_scls) = hio_mortality_canopy_secondary_si_scls(io_si,i_scls) + & - ! sites(s)%term_nindivs_canopy(i_scls,ft) * days_per_year / m2_per_ha - !end if - ! the fire mortality rates for each layer are total dead, since the usable ! output will then normalize by the counts, we are allowed to sum over layers hio_mortality_understory_si_scpf(io_si,i_scpf) = hio_mortality_understory_si_scpf(io_si,i_scpf) + & @@ -4949,15 +4843,10 @@ subroutine update_history_hifrq1(this,nc,nsites,sites,bc_in,bc_out,dt_tstep) associate( hio_gpp_si => this%hvars(ih_gpp_si)%r81d, & - hio_gpp_secondary_si => this%hvars(ih_gpp_secondary_si)%r81d, & hio_npp_si => this%hvars(ih_npp_si)%r81d, & - hio_npp_secondary_si => this%hvars(ih_npp_secondary_si)%r81d, & hio_aresp_si => this%hvars(ih_aresp_si)%r81d, & - hio_aresp_secondary_si => this%hvars(ih_aresp_secondary_si)%r81d, & hio_maint_resp_si => this%hvars(ih_maint_resp_si)%r81d, & - hio_maint_resp_secondary_si => this%hvars(ih_maint_resp_secondary_si)%r81d, & hio_growth_resp_si => this%hvars(ih_growth_resp_si)%r81d, & - hio_growth_resp_secondary_si => this%hvars(ih_growth_resp_secondary_si)%r81d, & hio_c_stomata_si => this%hvars(ih_c_stomata_si)%r81d, & hio_c_lblayer_si => this%hvars(ih_c_lblayer_si)%r81d, & hio_vis_rad_err_si => this%hvars(ih_vis_rad_err_si)%r81d, & @@ -5115,24 +5004,6 @@ subroutine update_history_hifrq1(this,nc,nsites,sites,bc_in,bc_out,dt_tstep) hio_maint_resp_unreduced_si(io_si) = hio_maint_resp_unreduced_si(io_si) + & ccohort%resp_m_unreduced * n_perm2 * dt_tstep_inv - ! Secondary forest only - if(cpatch%land_use_label .eq. secondaryland) then - hio_npp_secondary_si(io_si) = hio_npp_secondary_si(io_si) + & - ccohort%npp_tstep * n_perm2 * dt_tstep_inv - - hio_gpp_secondary_si(io_si) = hio_gpp_secondary_si(io_si) + & - ccohort%gpp_tstep * n_perm2 * dt_tstep_inv - - hio_aresp_secondary_si(io_si) = hio_aresp_secondary_si(io_si) + & - ccohort%resp_tstep * n_perm2 * dt_tstep_inv - - hio_growth_resp_secondary_si(io_si) = hio_growth_resp_secondary_si(io_si) + & - ccohort%resp_g_tstep * n_perm2 * dt_tstep_inv - - hio_maint_resp_secondary_si(io_si) = hio_maint_resp_secondary_si(io_si) + & - ccohort%resp_m * n_perm2 * dt_tstep_inv - end if - ! Maintenance respiration of different organs hio_leaf_mr_si(io_si) = hio_leaf_mr_si(io_si) + ccohort%rdark & * n_perm2 @@ -6139,18 +6010,6 @@ subroutine define_history_vars(this, initialize_variables) upfreq=group_dyna_simple, ivar=ivar, initialize=initialize_variables, & index=ih_ncohorts_si) - call this%set_history_var(vname='FATES_NPATCHES_SECONDARY', units='', & - long='total number of patches per site', use_default='active', & - avgflag='A', vtype=site_r8, hlms='CLM:ALM', & - upfreq=group_dyna_simple, ivar=ivar, initialize=initialize_variables, & - index=ih_npatches_sec_si) - - call this%set_history_var(vname='FATES_NCOHORTS_SECONDARY', units='', & - long='total number of cohorts per site', use_default='active', & - avgflag='A', vtype=site_r8, hlms='CLM:ALM', & - upfreq=group_dyna_simple, ivar=ivar, initialize=initialize_variables, & - index=ih_ncohorts_sec_si) - ! Patch variables call this%set_history_var(vname='FATES_TRIMMING', units='1', & long='degree to which canopy expansion is limited by leaf economics (0-1)', & @@ -6240,34 +6099,12 @@ subroutine define_history_vars(this, initialize_variables) upfreq=group_dyna_simple, ivar=ivar, initialize=initialize_variables, & index=ih_elai_si) - call this%set_history_var(vname='FATES_LAI_SECONDARY', units='m2 m-2', & - long='leaf area index per m2 land area, secondary patches', & - use_default='active', avgflag='A', vtype=site_r8, hlms='CLM:ALM', & - upfreq=group_dyna_simple, ivar=ivar, initialize=initialize_variables, & - index=ih_lai_secondary_si) - - - - ! Secondary forest area and age diagnostics - - call this%set_history_var(vname='FATES_SECONDARY_FOREST_FRACTION', & - units='m2 m-2', long='secondary forest fraction', & - use_default='active', avgflag='A', vtype=site_r8, hlms='CLM:ALM', & - upfreq=group_dyna_simple, ivar=ivar, initialize=initialize_variables, & - index=ih_fraction_secondary_forest_si) - - call this%set_history_var(vname='FATES_WOOD_PRODUCT', units='kg m-2', & + call this%set_history_var(vname='FATES_WOOD_PRODUCT', units='kg m-2', & long='total wood product from logging in kg carbon per m2 land area', & use_default='active', avgflag='A', vtype=site_r8, hlms='CLM:ALM', & upfreq=group_dyna_simple, ivar=ivar, initialize=initialize_variables, & index=ih_woodproduct_si) - call this%set_history_var(vname='FATES_SECONDARY_FOREST_VEGC', & - units='kg m-2', & - long='biomass on secondary lands in kg carbon per m2 land area (mult by FATES_SECONDARY_FOREST_FRACTION to get per secondary forest area)', & - use_default='active', avgflag='A', vtype=site_r8, & - hlms='CLM:ALM', upfreq=group_dyna_simple, ivar=ivar, initialize=initialize_variables, & - index=ih_biomass_secondary_forest_si) ! Fire Variables call this%set_history_var(vname='FATES_NESTEROV_INDEX', units='', & @@ -6840,12 +6677,6 @@ subroutine define_history_vars(this, initialize_variables) upfreq=group_dyna_complx, ivar=ivar, initialize=initialize_variables, & index=ih_biomass_si_pft) - call this%set_history_var(vname='FATES_VEGC_SE_PF', units='kg m-2', & - long='total PFT-level biomass in kg of carbon per land area, secondary patches', & - use_default='active', avgflag='A', vtype=site_pft_r8, hlms='CLM:ALM', & - upfreq=group_dyna_complx, ivar=ivar, initialize=initialize_variables, & - index=ih_biomass_sec_si_pft) - call this%set_history_var(vname='FATES_RECRUITMENT_CFLUX_PF', units='kg m-2 yr-1', & long='total PFT-level biomass of new recruits in kg of carbon per land area', & use_default='active', avgflag='A', vtype=site_pft_r8, hlms='CLM:ALM', & @@ -6888,30 +6719,12 @@ subroutine define_history_vars(this, initialize_variables) upfreq=group_dyna_complx, ivar=ivar, initialize=initialize_variables, & index=ih_npp_si_pft) - call this%set_history_var(vname='FATES_GPP_SE_PF', units='kg m-2 s-1', & - long='total PFT-level GPP in kg carbon per m2 land area per second, secondary patches', & - use_default='active', avgflag='A', vtype=site_pft_r8, hlms='CLM:ALM', & - upfreq=group_dyna_complx, ivar=ivar, initialize=initialize_variables, & - index=ih_gpp_sec_si_pft) - - call this%set_history_var(vname='FATES_NPP_SE_PF', units='kg m-2 s-1', & - long='total PFT-level NPP in kg carbon per m2 land area per second, secondary patches', & - use_default='active', avgflag='A', vtype=site_pft_r8, hlms='CLM:ALM', & - upfreq=group_dyna_complx, ivar=ivar, initialize=initialize_variables, & - index=ih_npp_sec_si_pft) - call this%set_history_var(vname='FATES_NPLANT_PF', units='m-2', & long='total PFT-level number of individuals per m2 land area', & use_default='active', avgflag='A', vtype=site_pft_r8, hlms='CLM:ALM', & upfreq=group_dyna_complx, ivar=ivar, initialize=initialize_variables, & index=ih_nindivs_si_pft) - call this%set_history_var(vname='FATES_NPLANT_SEC_PF', units='m-2', & - long='total PFT-level number of individuals per m2 land area, secondary patches', & - use_default='active', avgflag='A', vtype=site_pft_r8, hlms='CLM:ALM', & - upfreq=group_dyna_complx, ivar=ivar, initialize=initialize_variables, & - index=ih_nindivs_sec_si_pft) - call this%set_history_var(vname='FATES_RECRUITMENT_PF', & units='m-2 yr-1', & long='PFT-level recruitment rate in number of individuals per m2 land area per year', & @@ -8060,27 +7873,6 @@ subroutine define_history_vars(this, initialize_variables) hlms='CLM:ALM', upfreq=group_dyna_complx, ivar=ivar, & initialize=initialize_variables, index = ih_m3_si_scls) - call this%set_history_var(vname='FATES_MORTALITY_BACKGROUND_SE_SZ', & - units = 'm-2 yr-1', & - long='background mortality by size in number of plants per m2 per year, secondary patches', & - use_default='active', avgflag='A', vtype=site_size_r8, & - hlms='CLM:ALM', upfreq=group_dyna_complx, ivar=ivar, & - initialize=initialize_variables, index = ih_m1_sec_si_scls) - - call this%set_history_var(vname='FATES_MORTALITY_HYDRAULIC_SE_SZ', & - units = 'm-2 yr-1', & - long='hydraulic mortality by size in number of plants per m2 per year, secondary patches', & - use_default='active', avgflag='A', vtype=site_size_r8, & - hlms='CLM:ALM', upfreq=group_dyna_complx, ivar=ivar, & - initialize=initialize_variables, index = ih_m2_sec_si_scls) - - call this%set_history_var(vname='FATES_MORTALITY_CSTARV_SE_SZ', & - units = 'm-2 yr-1', & - long='carbon starvation mortality by size in number of plants per m2 per year, secondary patches', & - use_default='active', avgflag='A', vtype=site_size_r8, & - hlms='CLM:ALM', upfreq=group_dyna_complx, ivar=ivar, & - initialize=initialize_variables, index = ih_m3_sec_si_scls) - call this%set_history_var(vname='FATES_MORTALITY_IMPACT_SZ', & units = 'm-2 yr-1', & long='impact mortality by size in number of plants per m2 per year', & @@ -8137,34 +7929,6 @@ subroutine define_history_vars(this, initialize_variables) hlms='CLM:ALM', upfreq=group_dyna_complx, ivar=ivar, & initialize=initialize_variables, index = ih_m10_si_cacls) - call this%set_history_var(vname='FATES_MORTALITY_LOGGING_SE_SZ', & - units = 'm-2 yr-1', & - long='logging mortality by size in number of plants per m2 per event, secondary patches', & - use_default='active', avgflag='A', vtype=site_size_r8, & - hlms='CLM:ALM', upfreq=group_dyna_complx, ivar=ivar, & - initialize=initialize_variables, index = ih_m7_sec_si_scls) - - call this%set_history_var(vname='FATES_MORTALITY_FREEZING_SE_SZ', & - units = 'm-2 event-1', & - long='freezing mortality by size in number of plants per m2 per event, secondary patches', & - use_default='active', avgflag='A', vtype=site_size_r8, & - hlms='CLM:ALM', upfreq=group_dyna_complx, ivar=ivar, & - initialize=initialize_variables, index = ih_m8_sec_si_scls) - - call this%set_history_var(vname='FATES_MORTALITY_SENESCENCE_SE_SZ', & - units = 'm-2 yr-1', & - long='senescence mortality by size in number of plants per m2 per event, secondary patches', & - use_default='active', avgflag='A', vtype=site_size_r8, & - hlms='CLM:ALM', upfreq=group_dyna_complx, ivar=ivar, & - initialize=initialize_variables, index = ih_m9_sec_si_scls) - - call this%set_history_var(vname='FATES_MORTALITY_AGESCEN_SE_SZ', & - units = 'm-2 yr-1', & - long='age senescence mortality by size in number of plants per m2 per year, secondary patches', & - use_default='active', avgflag='A', vtype=site_size_r8, & - hlms='CLM:ALM', upfreq=group_dyna_complx, ivar=ivar, & - initialize=initialize_variables, index = ih_m10_sec_si_scls) - call this%set_history_var(vname='FATES_NPP_CANOPY_SZ', units = 'kg m-2 s-1', & long='NPP of canopy plants by size class in kg carbon per m2 per second', & use_default='inactive', avgflag='A', vtype=site_size_r8, & @@ -8614,43 +8378,22 @@ subroutine define_history_vars(this, initialize_variables) use_default='active', avgflag='A', vtype=site_r8, hlms='CLM:ALM', & upfreq=group_hifr_simple, ivar=ivar, initialize=initialize_variables, index = ih_npp_si) - call this%set_history_var(vname='FATES_NPP_SECONDARY', units='kg m-2 s-1', & - long='net primary production in kg carbon per m2 per second, secondary patches', & - use_default='active', avgflag='A', vtype=site_r8, hlms='CLM:ALM', & - upfreq=group_hifr_simple, ivar=ivar, initialize=initialize_variables, index = ih_npp_secondary_si) - call this%set_history_var(vname='FATES_GPP', units='kg m-2 s-1', & long='gross primary production in kg carbon per m2 per second', & use_default='active', avgflag='A', vtype=site_r8, hlms='CLM:ALM', & upfreq=group_hifr_simple, ivar=ivar, initialize=initialize_variables, index = ih_gpp_si) - call this%set_history_var(vname='FATES_GPP_SECONDARY', units='kg m-2 s-1', & - long='gross primary production in kg carbon per m2 per second, secondary patches', & - use_default='active', avgflag='A', vtype=site_r8, hlms='CLM:ALM', & - upfreq=group_hifr_simple, ivar=ivar, initialize=initialize_variables, index = ih_gpp_secondary_si) - call this%set_history_var(vname='FATES_AUTORESP', units='kg m-2 s-1', & long='autotrophic respiration in kg carbon per m2 per second', & use_default='active', avgflag='A', vtype=site_r8, hlms='CLM:ALM', & upfreq=group_hifr_simple, ivar=ivar, initialize=initialize_variables, index = ih_aresp_si) - call this%set_history_var(vname='FATES_AUTORESP_SECONDARY', units='kg m-2 s-1', & - long='autotrophic respiration in kg carbon per m2 per second, secondary patches', & - use_default='active', avgflag='A', vtype=site_r8, hlms='CLM:ALM', & - upfreq=group_hifr_simple, ivar=ivar, initialize=initialize_variables, index = ih_aresp_secondary_si) - call this%set_history_var(vname='FATES_GROWTH_RESP', units='kg m-2 s-1', & long='growth respiration in kg carbon per m2 per second', & use_default='active', avgflag='A', vtype=site_r8, hlms='CLM:ALM', & upfreq=group_hifr_simple, ivar=ivar, initialize=initialize_variables, & index = ih_growth_resp_si) - call this%set_history_var(vname='FATES_GROWTH_RESP_SECONDARY', units='kg m-2 s-1', & - long='growth respiration in kg carbon per m2 per second, secondary patches', & - use_default='active', avgflag='A', vtype=site_r8, hlms='CLM:ALM', & - upfreq=group_hifr_simple, ivar=ivar, initialize=initialize_variables, & - index = ih_growth_resp_secondary_si) - call this%set_history_var(vname='FATES_MAINT_RESP', units='kg m-2 s-1', & long='maintenance respiration in kg carbon per m2 land area per second', & use_default='active', avgflag='A', vtype=site_r8, hlms='CLM:ALM', & @@ -8663,12 +8406,6 @@ subroutine define_history_vars(this, initialize_variables) upfreq=group_hifr_simple, ivar=ivar, initialize=initialize_variables, & index = ih_maint_resp_unreduced_si) - call this%set_history_var(vname='FATES_MAINT_RESP_SECONDARY', units='kg m-2 s-1', & - long='maintenance respiration in kg carbon per m2 land area per second, secondary patches', & - use_default='active', avgflag='A', vtype=site_r8, hlms='CLM:ALM', & - upfreq=group_hifr_simple, ivar=ivar, initialize=initialize_variables, & - index = ih_maint_resp_secondary_si) - ! fast fluxes separated canopy/understory call this%set_history_var(vname='FATES_GPP_CANOPY', units='kg m-2 s-1', & long='gross primary production of canopy plants in kg carbon per m2 per second', & From a580785d5ca49b04079dd3f4a77a21d8e024119e Mon Sep 17 00:00:00 2001 From: Charles D Koven Date: Fri, 25 Oct 2024 09:03:37 -0700 Subject: [PATCH 07/20] added two new hist vars: biomass and burned area, by land use type --- main/FatesHistoryInterfaceMod.F90 | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/main/FatesHistoryInterfaceMod.F90 b/main/FatesHistoryInterfaceMod.F90 index 6c2097cab3..98438ab1c2 100644 --- a/main/FatesHistoryInterfaceMod.F90 +++ b/main/FatesHistoryInterfaceMod.F90 @@ -355,7 +355,12 @@ module FatesHistoryInterfaceMod integer :: ih_primaryland_fusion_error_si + ! land-use-resolved variables integer :: ih_area_si_landuse + integer :: ih_biomass_si_landuse + integer :: ih_burnedarea_si_landuse + + ! land use by land use variables integer :: ih_disturbance_rate_si_lulu integer :: ih_transition_matrix_si_lulu @@ -3209,7 +3214,9 @@ subroutine update_history_dyn2(this,nc,nsites,sites,bc_in) hio_agesince_anthrodist_si_age => this%hvars(ih_agesince_anthrodist_si_age)%r82d, & hio_secondarylands_area_si_age => this%hvars(ih_secondarylands_area_si_age)%r82d, & hio_primarylands_area_si_age => this%hvars(ih_primarylands_area_si_age)%r82d, & - hio_area_si_landuse => this%hvars(ih_area_si_landuse)%r82d, & + hio_area_si_landuse => this%hvars(ih_area_si_landuse)%r82d, & + hio_biomass_si_landuse => this%hvars(ih_biomass_si_landuse)%r82d, & + hio_burnedarea_si_landuse => this%hvars(ih_burnedarea_si_landuse)%r82d, & hio_area_burnt_si_age => this%hvars(ih_area_burnt_si_age)%r82d, & ! hio_fire_rate_of_spread_front_si_age => this%hvars(ih_fire_rate_of_spread_front_si_age)%r82d, & hio_fire_intensity_si_age => this%hvars(ih_fire_intensity_si_age)%r82d, & @@ -3353,6 +3360,10 @@ subroutine update_history_dyn2(this,nc,nsites,sites,bc_in) hio_area_si_landuse(io_si, cpatch%land_use_label) = & hio_area_si_landuse(io_si, cpatch%land_use_label) & + cpatch%area * AREA_INV + + hio_burnedarea_si_landuse(io_si, cpatch%land_use_label) = & + hio_burnedarea_si_landuse(io_si, cpatch%land_use_label) + & + cpatch%frac_burnt * cpatch%area * AREA_INV / sec_per_day end if ! Increment some patch-age-resolved diagnostics @@ -3540,6 +3551,11 @@ subroutine update_history_dyn2(this,nc,nsites,sites,bc_in) hio_biomass_si_age(io_si,cpatch%age_class) = hio_biomass_si_age(io_si,cpatch%age_class) & + total_m * ccohort%n * AREA_INV + ! biomass by land use type + hio_biomass_si_landuse(io_si, cpatch%land_use_label) = & + hio_biomass_si_landuse(io_si, cpatch%land_use_label) & + + total_m * ccohort%n * AREA_INV + if (ccohort%canopy_layer .eq. 1) then storec_canopy_scpf(i_scpf) = & storec_canopy_scpf(i_scpf) + ccohort%n * store_m @@ -6660,7 +6676,17 @@ subroutine define_history_vars(this, initialize_variables) long='patch area by land use type', use_default='active', & avgflag='A', vtype=site_landuse_r8, hlms='CLM:ALM', upfreq=group_dyna_complx, & ivar=ivar, initialize=initialize_variables, index=ih_area_si_landuse) - + + call this%set_history_var(vname='FATES_VEGC_LU', units='kg m-2', & + long='Vegetation Carbon by land use type', use_default='active', & + avgflag='A', vtype=site_landuse_r8, hlms='CLM:ALM', upfreq=group_dyna_complx, & + ivar=ivar, initialize=initialize_variables, index=ih_biomass_si_landuse) + + call this%set_history_var(vname='FATES_BURNEDAREA_LU', units='s-1', & + long='burned area by land use type', use_default='active', & + avgflag='A', vtype=site_landuse_r8, hlms='CLM:ALM', upfreq=group_dyna_complx, & + ivar=ivar, initialize=initialize_variables, index=ih_burnedarea_si_landuse) + call this%set_history_var(vname='FATES_TRANSITION_MATRIX_LULU', units='m2 m-2 yr-1', & long='land use transition matrix', use_default='active', & avgflag='A', vtype=site_lulu_r8, hlms='CLM:ALM', upfreq=group_dyna_complx, ivar=ivar, & From 56882373d160aa8ea085b0a743793ea015349974 Mon Sep 17 00:00:00 2001 From: Charles D Koven Date: Fri, 25 Oct 2024 09:17:06 -0700 Subject: [PATCH 08/20] added two more hist vars: GPP and NPP, by land use type --- main/FatesHistoryInterfaceMod.F90 | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/main/FatesHistoryInterfaceMod.F90 b/main/FatesHistoryInterfaceMod.F90 index 98438ab1c2..a537887b32 100644 --- a/main/FatesHistoryInterfaceMod.F90 +++ b/main/FatesHistoryInterfaceMod.F90 @@ -359,6 +359,8 @@ module FatesHistoryInterfaceMod integer :: ih_area_si_landuse integer :: ih_biomass_si_landuse integer :: ih_burnedarea_si_landuse + integer :: ih_gpp_si_landuse + integer :: ih_npp_si_landuse ! land use by land use variables integer :: ih_disturbance_rate_si_lulu @@ -5131,6 +5133,8 @@ subroutine update_history_hifrq2(this,nc,nsites,sites,bc_in,bc_out,dt_tstep) 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, & + hio_gpp_si_landuse => this%hvars(ih_gpp_si_landuse)%r82d, & + hio_npp_si_landuse => this%hvars(ih_npp_si_landuse)%r82d, & hio_c_stomata_si_age => this%hvars(ih_c_stomata_si_age)%r82d, & hio_c_lblayer_si_age => this%hvars(ih_c_lblayer_si_age)%r82d, & hio_parsun_z_si_cnlf => this%hvars(ih_parsun_z_si_cnlf)%r82d, & @@ -5255,6 +5259,14 @@ subroutine update_history_hifrq2(this,nc,nsites,sites,bc_in,bc_out,dt_tstep) hio_npp_si_age(io_si,cpatch%age_class) = hio_npp_si_age(io_si,cpatch%age_class) & + npp * ccohort%n * dt_tstep_inv + if (cpatch%land_use_label .gt. nocomp_bareground_land) then + hio_gpp_si_landuse(io_si,cpatch%land_use_label) = hio_gpp_si_landuse(io_si,cpatch%land_use_label) & + + ccohort%gpp_tstep * ccohort%n * dt_tstep_inv + + hio_npp_si_landuse(io_si,cpatch%land_use_label) = hio_npp_si_landuse(io_si,cpatch%land_use_label) & + + npp * ccohort%n * dt_tstep_inv + end if + ! accumulate fluxes on canopy- and understory- separated fluxes if (ccohort%canopy_layer .eq. 1) then @@ -8566,6 +8578,18 @@ subroutine define_history_vars(this, initialize_variables) hlms='CLM:ALM', upfreq=group_hifr_complx, ivar=ivar, initialize=initialize_variables, & index = ih_gpp_si_age) + call this%set_history_var(vname='FATES_NPP_LU', units='kg m-2 s-1', & + long='net primary productivity by age bin in kg carbon per m2 per second', & + use_default='inactive', avgflag='A', vtype=site_landuse_r8, & + hlms='CLM:ALM', upfreq=group_hifr_complx, ivar=ivar, initialize=initialize_variables, & + index = ih_npp_si_landuse) + + call this%set_history_var(vname='FATES_GPP_LU', units='kg m-2 s-1', & + long='gross primary productivity by age bin in kg carbon per m2 per second', & + use_default='inactive', avgflag='A', vtype=site_landuse_r8, & + hlms='CLM:ALM', upfreq=group_hifr_complx, ivar=ivar, initialize=initialize_variables, & + index = ih_gpp_si_landuse) + call this%set_history_var(vname='FATES_RDARK_USTORY_SZ', & units = 'kg m-2 s-1', & long='dark respiration for understory plants in kg carbon per m2 per second by size', & From 52462b5b4c7aab61ddef6bd6675e5161a28dba44 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 1 Nov 2024 12:15:39 -0600 Subject: [PATCH 09/20] Fix typo in comment. --- biogeochem/EDLoggingMortalityMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/biogeochem/EDLoggingMortalityMod.F90 b/biogeochem/EDLoggingMortalityMod.F90 index 54e9f0d71a..8d6a6cf843 100644 --- a/biogeochem/EDLoggingMortalityMod.F90 +++ b/biogeochem/EDLoggingMortalityMod.F90 @@ -306,7 +306,7 @@ subroutine LoggingMortality_frac( currentSite, bc_in, pft_i, dbh, canopy_layer, ! HARVEST_SH2 = harvest from secondary young forest ! HARVEST_SH3 = harvest from secondary non-forest (assume this is young for biomass) - ! if using the direct LUH2 drivers, the variabel names are instead (if using area-based logging): + ! if using the direct LUH2 drivers, the variable names are instead (if using area-based logging): ! 'primf_harv', 'primn_harv', 'secmf_harv', 'secyf_harv', 'secnf_harv' secondary_young_fraction = currentSite%get_secondary_young_fraction() From f19848b02d55a82a1a32cfb2af06c6a57d6338ab Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 1 Nov 2024 12:17:46 -0600 Subject: [PATCH 10/20] Simplify "prevent conversion of bare ground land" logic. --- biogeochem/EDLoggingMortalityMod.F90 | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/biogeochem/EDLoggingMortalityMod.F90 b/biogeochem/EDLoggingMortalityMod.F90 index 8d6a6cf843..214de27289 100644 --- a/biogeochem/EDLoggingMortalityMod.F90 +++ b/biogeochem/EDLoggingMortalityMod.F90 @@ -392,24 +392,19 @@ subroutine LoggingMortality_frac( currentSite, bc_in, pft_i, dbh, canopy_layer, else ! the logic below is mainly to prevent conversion of bare ground land; everything else should be primary at this point. + lmort_direct = 0.0_r8 + lmort_collateral = 0.0_r8 + lmort_infra = 0.0_r8 + l_degrad = 0.0_r8 if ( patch_land_use_label .eq. primaryland ) then call GetInitLanduseHarvestRate(bc_in, currentSite%min_allowed_landuse_fraction, & harvest_rate, currentSite%landuse_vector_gt_min) - lmort_direct = 0.0_r8 - lmort_collateral = 0.0_r8 - lmort_infra = 0.0_r8 - l_degrad = 0.0_r8 if(prt_params%woody(pft_i) == itrue)then lmort_direct = harvest_rate else if (canopy_layer .eq. 1) then l_degrad = harvest_rate endif - else if ( patch_land_use_label .eq. nocomp_bareground_land ) then - lmort_direct = 0.0_r8 - lmort_collateral = 0.0_r8 - lmort_infra = 0.0_r8 - l_degrad = 0.0_r8 - else + else if ( patch_land_use_label .ne. nocomp_bareground_land ) then write(fates_log(),*) 'trying to transition away from something that isnt either primary or bare ground,' write(fates_log(),*) 'on what should be a first timestep away from potential vaegetatino. this shouldnt happen.' write(fates_log(),*) 'exiting' From 111278a4238051be3b3974001ccd25b3aaf825f2 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 1 Nov 2024 12:21:17 -0600 Subject: [PATCH 11/20] Undo an indentation change. --- main/FatesHistoryInterfaceMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/FatesHistoryInterfaceMod.F90 b/main/FatesHistoryInterfaceMod.F90 index a537887b32..5fd398b724 100644 --- a/main/FatesHistoryInterfaceMod.F90 +++ b/main/FatesHistoryInterfaceMod.F90 @@ -6127,7 +6127,7 @@ subroutine define_history_vars(this, initialize_variables) upfreq=group_dyna_simple, ivar=ivar, initialize=initialize_variables, & index=ih_elai_si) - call this%set_history_var(vname='FATES_WOOD_PRODUCT', units='kg m-2', & + call this%set_history_var(vname='FATES_WOOD_PRODUCT', units='kg m-2', & long='total wood product from logging in kg carbon per m2 land area', & use_default='active', avgflag='A', vtype=site_r8, hlms='CLM:ALM', & upfreq=group_dyna_simple, ivar=ivar, initialize=initialize_variables, & From 96aeedb42016cb9ff8f36471577aed7f1f66bb43 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Mon, 6 Jan 2025 11:57:47 -0700 Subject: [PATCH 12/20] fix npp by age calculation --- main/FatesHistoryInterfaceMod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/FatesHistoryInterfaceMod.F90 b/main/FatesHistoryInterfaceMod.F90 index 2210028481..1f7092d5df 100644 --- a/main/FatesHistoryInterfaceMod.F90 +++ b/main/FatesHistoryInterfaceMod.F90 @@ -5256,14 +5256,14 @@ subroutine update_history_hifrq2(this,nc,nsites,sites,bc_in,bc_out,dt_tstep) + ccohort%gpp_tstep * ccohort%n * dt_tstep_inv hio_npp_si_age(io_si,cpatch%age_class) = hio_npp_si_age(io_si,cpatch%age_class) & - + npp * ccohort%n * dt_tstep_inv + + ccohort%npp_acc_hold * ccohort%n * dt_tstep_inv if (cpatch%land_use_label .gt. nocomp_bareground_land) then hio_gpp_si_landuse(io_si,cpatch%land_use_label) = hio_gpp_si_landuse(io_si,cpatch%land_use_label) & + ccohort%gpp_tstep * ccohort%n * dt_tstep_inv hio_npp_si_landuse(io_si,cpatch%land_use_label) = hio_npp_si_landuse(io_si,cpatch%land_use_label) & - + npp * ccohort%n * dt_tstep_inv + + ccohort%npp_acc_hold * ccohort%n * dt_tstep_inv end if ! accumulate fluxes on canopy- and understory- separated fluxes From cd6931f25e988515dd729430021af9607228aade Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Mon, 6 Jan 2025 11:59:21 -0700 Subject: [PATCH 13/20] fix bad merge deconflict and remove old secondary history variable --- main/FatesHistoryInterfaceMod.F90 | 5 ----- 1 file changed, 5 deletions(-) diff --git a/main/FatesHistoryInterfaceMod.F90 b/main/FatesHistoryInterfaceMod.F90 index 1f7092d5df..b1ad28f773 100644 --- a/main/FatesHistoryInterfaceMod.F90 +++ b/main/FatesHistoryInterfaceMod.F90 @@ -8435,11 +8435,6 @@ subroutine define_history_vars(this, initialize_variables) use_default='active', avgflag='A', vtype=site_r8, hlms='CLM:ALM', & upfreq=group_hifr_simple, ivar=ivar, initialize=initialize_variables, index = ih_gpp_si) - call this%set_history_var(vname='FATES_GPP_SECONDARY', units='kg m-2 s-1', & - long='gross primary production in kg carbon per m2 per second, secondary patches', & - use_default='active', avgflag='A', vtype=site_r8, hlms='CLM:ALM', & - upfreq=group_hifr_simple, ivar=ivar, initialize=initialize_variables, index = ih_gpp_secondary_si) - call this%set_history_var(vname='FATES_MAINT_RESP', units='kg m-2 s-1', & long='maintenance respiration in kg carbon per m2 land area per second', & use_default='active', avgflag='A', vtype=site_r8, hlms='CLM:ALM', & From 69e7433f441dc6fc557d31586e1db4121ea2ddb9 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Tue, 7 Jan 2025 15:35:33 -0800 Subject: [PATCH 14/20] remove npp by age from high frequency history This is clean up from the deconflict merge --- main/FatesHistoryInterfaceMod.F90 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/main/FatesHistoryInterfaceMod.F90 b/main/FatesHistoryInterfaceMod.F90 index b1ad28f773..7fa41d9fc1 100644 --- a/main/FatesHistoryInterfaceMod.F90 +++ b/main/FatesHistoryInterfaceMod.F90 @@ -5136,7 +5136,6 @@ subroutine update_history_hifrq2(this,nc,nsites,sites,bc_in,bc_out,dt_tstep) 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, & hio_gpp_si_landuse => this%hvars(ih_gpp_si_landuse)%r82d, & hio_npp_si_landuse => this%hvars(ih_npp_si_landuse)%r82d, & hio_c_stomata_si_age => this%hvars(ih_c_stomata_si_age)%r82d, & @@ -5255,9 +5254,6 @@ subroutine update_history_hifrq2(this,nc,nsites,sites,bc_in,bc_out,dt_tstep) hio_gpp_si_age(io_si,cpatch%age_class) = hio_gpp_si_age(io_si,cpatch%age_class) & + ccohort%gpp_tstep * ccohort%n * dt_tstep_inv - hio_npp_si_age(io_si,cpatch%age_class) = hio_npp_si_age(io_si,cpatch%age_class) & - + ccohort%npp_acc_hold * ccohort%n * dt_tstep_inv - if (cpatch%land_use_label .gt. nocomp_bareground_land) then hio_gpp_si_landuse(io_si,cpatch%land_use_label) = hio_gpp_si_landuse(io_si,cpatch%land_use_label) & + ccohort%gpp_tstep * ccohort%n * dt_tstep_inv From e4a163d72f3f21b14bd969d0e462480182470d43 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Tue, 7 Jan 2025 15:55:19 -0800 Subject: [PATCH 15/20] move npp by land use out of high frequency section This cleans up a bad deconflict merge --- main/FatesHistoryInterfaceMod.F90 | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/main/FatesHistoryInterfaceMod.F90 b/main/FatesHistoryInterfaceMod.F90 index 7fa41d9fc1..c4653b191f 100644 --- a/main/FatesHistoryInterfaceMod.F90 +++ b/main/FatesHistoryInterfaceMod.F90 @@ -3227,6 +3227,7 @@ subroutine update_history_dyn2(this,nc,nsites,sites,bc_in) hio_zstar_si_age => this%hvars(ih_zstar_si_age)%r82d, & hio_biomass_si_age => this%hvars(ih_biomass_si_age)%r82d, & hio_npp_si_age => this%hvars(ih_npp_si_age)%r82d, & + hio_npp_si_landuse => this%hvars(ih_npp_si_landuse)%r82d, & hio_agesince_anthrodist_si_age => this%hvars(ih_agesince_anthrodist_si_age)%r82d, & hio_secondarylands_area_si_age => this%hvars(ih_secondarylands_area_si_age)%r82d, & hio_primarylands_area_si_age => this%hvars(ih_primarylands_area_si_age)%r82d, & @@ -3380,6 +3381,9 @@ subroutine update_history_dyn2(this,nc,nsites,sites,bc_in) hio_burnedarea_si_landuse(io_si, cpatch%land_use_label) = & hio_burnedarea_si_landuse(io_si, cpatch%land_use_label) + & cpatch%frac_burnt * cpatch%area * AREA_INV / sec_per_day + + hio_npp_si_landuse(io_si,cpatch%land_use_label) = hio_npp_si_landuse(io_si,cpatch%land_use_label) & + + ccohort%npp_acc_hold * ccohort%n * dt_tstep_inv end if ! Increment some patch-age-resolved diagnostics @@ -5137,7 +5141,6 @@ subroutine update_history_hifrq2(this,nc,nsites,sites,bc_in,bc_out,dt_tstep) 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_gpp_si_landuse => this%hvars(ih_gpp_si_landuse)%r82d, & - hio_npp_si_landuse => this%hvars(ih_npp_si_landuse)%r82d, & hio_c_stomata_si_age => this%hvars(ih_c_stomata_si_age)%r82d, & hio_c_lblayer_si_age => this%hvars(ih_c_lblayer_si_age)%r82d, & hio_parsun_z_si_cnlf => this%hvars(ih_parsun_z_si_cnlf)%r82d, & @@ -5257,9 +5260,6 @@ subroutine update_history_hifrq2(this,nc,nsites,sites,bc_in,bc_out,dt_tstep) if (cpatch%land_use_label .gt. nocomp_bareground_land) then hio_gpp_si_landuse(io_si,cpatch%land_use_label) = hio_gpp_si_landuse(io_si,cpatch%land_use_label) & + ccohort%gpp_tstep * ccohort%n * dt_tstep_inv - - hio_npp_si_landuse(io_si,cpatch%land_use_label) = hio_npp_si_landuse(io_si,cpatch%land_use_label) & - + ccohort%npp_acc_hold * ccohort%n * dt_tstep_inv end if ! accumulate fluxes on canopy- and understory- separated fluxes @@ -6693,6 +6693,12 @@ subroutine define_history_vars(this, initialize_variables) if_dyn1: if(hlm_hist_level_dynam>1) then + call this%set_history_var(vname='FATES_NPP_LU', units='kg m-2 s-1', & + long='net primary productivity by age bin in kg carbon per m2 per second', & + use_default='inactive', avgflag='A', vtype=site_landuse_r8, & + hlms='CLM:ALM', upfreq=group_hifr_complx, ivar=ivar, initialize=initialize_variables, & + index = ih_npp_si_landuse) + call this%set_history_var(vname='FATES_PATCHAREA_LU', units='m2 m-2', & long='patch area by land use type', use_default='active', & avgflag='A', vtype=site_landuse_r8, hlms='CLM:ALM', upfreq=group_dyna_complx, & @@ -8571,12 +8577,6 @@ subroutine define_history_vars(this, initialize_variables) hlms='CLM:ALM', upfreq=group_hifr_complx, ivar=ivar, initialize=initialize_variables, & index = ih_gpp_si_age) - call this%set_history_var(vname='FATES_NPP_LU', units='kg m-2 s-1', & - long='net primary productivity by age bin in kg carbon per m2 per second', & - use_default='inactive', avgflag='A', vtype=site_landuse_r8, & - hlms='CLM:ALM', upfreq=group_hifr_complx, ivar=ivar, initialize=initialize_variables, & - index = ih_npp_si_landuse) - call this%set_history_var(vname='FATES_GPP_LU', units='kg m-2 s-1', & long='gross primary productivity by age bin in kg carbon per m2 per second', & use_default='inactive', avgflag='A', vtype=site_landuse_r8, & From 70c21a3e0fdbc8774f6f782992f41df37ce25805 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Fri, 10 Jan 2025 10:22:28 -0800 Subject: [PATCH 16/20] fix update frequency setting for FATES_NPP_LU --- main/FatesHistoryInterfaceMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/FatesHistoryInterfaceMod.F90 b/main/FatesHistoryInterfaceMod.F90 index c4653b191f..1ee55d66a4 100644 --- a/main/FatesHistoryInterfaceMod.F90 +++ b/main/FatesHistoryInterfaceMod.F90 @@ -6696,7 +6696,7 @@ subroutine define_history_vars(this, initialize_variables) call this%set_history_var(vname='FATES_NPP_LU', units='kg m-2 s-1', & long='net primary productivity by age bin in kg carbon per m2 per second', & use_default='inactive', avgflag='A', vtype=site_landuse_r8, & - hlms='CLM:ALM', upfreq=group_hifr_complx, ivar=ivar, initialize=initialize_variables, & + hlms='CLM:ALM', upfreq=group_dyna_complx, ivar=ivar, initialize=initialize_variables, & index = ih_npp_si_landuse) call this%set_history_var(vname='FATES_PATCHAREA_LU', units='m2 m-2', & From 33dcdf69450abda3e0b619f02dba82dd0e5f8ff7 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux <7565064+glemieux@users.noreply.github.com> Date: Fri, 10 Jan 2025 11:25:33 -0800 Subject: [PATCH 17/20] Update biogeochem/EDLoggingMortalityMod.F90 Minor typo fix --- biogeochem/EDLoggingMortalityMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/biogeochem/EDLoggingMortalityMod.F90 b/biogeochem/EDLoggingMortalityMod.F90 index 214de27289..478374ab10 100644 --- a/biogeochem/EDLoggingMortalityMod.F90 +++ b/biogeochem/EDLoggingMortalityMod.F90 @@ -406,7 +406,7 @@ subroutine LoggingMortality_frac( currentSite, bc_in, pft_i, dbh, canopy_layer, endif else if ( patch_land_use_label .ne. nocomp_bareground_land ) then write(fates_log(),*) 'trying to transition away from something that isnt either primary or bare ground,' - write(fates_log(),*) 'on what should be a first timestep away from potential vaegetatino. this shouldnt happen.' + write(fates_log(),*) 'on what should be a first timestep away from potential vegetation. This should not happen.' write(fates_log(),*) 'exiting' call endrun(msg=errMsg(sourcefile, __LINE__)) endif From ee0e47fe076927185458efe261d09a0192cdc0a0 Mon Sep 17 00:00:00 2001 From: Charlie Koven Date: Fri, 17 Jan 2025 12:10:47 -0800 Subject: [PATCH 18/20] fix typos in FatesHistoryInterfaceMod.F90 --- main/FatesHistoryInterfaceMod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/FatesHistoryInterfaceMod.F90 b/main/FatesHistoryInterfaceMod.F90 index 1ee55d66a4..43594af6a6 100644 --- a/main/FatesHistoryInterfaceMod.F90 +++ b/main/FatesHistoryInterfaceMod.F90 @@ -6694,7 +6694,7 @@ subroutine define_history_vars(this, initialize_variables) if_dyn1: if(hlm_hist_level_dynam>1) then call this%set_history_var(vname='FATES_NPP_LU', units='kg m-2 s-1', & - long='net primary productivity by age bin in kg carbon per m2 per second', & + long='net primary productivity by land use type in kg carbon per m2 per second', & use_default='inactive', avgflag='A', vtype=site_landuse_r8, & hlms='CLM:ALM', upfreq=group_dyna_complx, ivar=ivar, initialize=initialize_variables, & index = ih_npp_si_landuse) @@ -8578,7 +8578,7 @@ subroutine define_history_vars(this, initialize_variables) index = ih_gpp_si_age) call this%set_history_var(vname='FATES_GPP_LU', units='kg m-2 s-1', & - long='gross primary productivity by age bin in kg carbon per m2 per second', & + long='gross primary productivity by land use type in kg carbon per m2 per second', & use_default='inactive', avgflag='A', vtype=site_landuse_r8, & hlms='CLM:ALM', upfreq=group_hifr_complx, ivar=ivar, initialize=initialize_variables, & index = ih_gpp_si_landuse) From e118d40cc497fdfcc58021c714eb80ce569b11a2 Mon Sep 17 00:00:00 2001 From: Charlie Koven Date: Fri, 17 Jan 2025 12:13:02 -0800 Subject: [PATCH 19/20] delete commented-out text in EDPatchDynamicsMod.F90 --- biogeochem/EDPatchDynamicsMod.F90 | 7 ------- 1 file changed, 7 deletions(-) diff --git a/biogeochem/EDPatchDynamicsMod.F90 b/biogeochem/EDPatchDynamicsMod.F90 index b489854e99..dac910bf10 100644 --- a/biogeochem/EDPatchDynamicsMod.F90 +++ b/biogeochem/EDPatchDynamicsMod.F90 @@ -427,13 +427,6 @@ subroutine disturbance_rates( site_in, bc_in) (currentPatch%area - currentPatch%total_canopy_area) * harvest_rate / currentPatch%area endif - ! cdk. Oct. 24, 2024. I don't think we need this anymore. commenting out. - ! ! For nocomp mode, we need to prevent producing too small patches, which may produce small patches - ! if ((hlm_use_nocomp .eq. itrue) .and. & - ! (currentPatch%disturbance_rates(dtype_ilog)*currentPatch%area .lt. min_patch_area_forced)) then - ! currentPatch%disturbance_rates(dtype_ilog) = 0._r8 - ! end if - ! fraction of the logging disturbance rate that is non-harvested if (currentPatch%disturbance_rates(dtype_ilog) .gt. nearzero) then currentPatch%fract_ldist_not_harvested = dist_rate_ldist_notharvested / & From 694e8064a4e717a51980d62fd49746c0f858c938 Mon Sep 17 00:00:00 2001 From: Gregory Lemieux Date: Thu, 30 Jan 2025 16:56:41 -0700 Subject: [PATCH 20/20] correct location of FATES_NPP_LU calculation --- main/FatesHistoryInterfaceMod.F90 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/main/FatesHistoryInterfaceMod.F90 b/main/FatesHistoryInterfaceMod.F90 index 21e49513bd..770867d805 100644 --- a/main/FatesHistoryInterfaceMod.F90 +++ b/main/FatesHistoryInterfaceMod.F90 @@ -3386,9 +3386,6 @@ subroutine update_history_dyn2(this,nc,nsites,sites,bc_in) hio_burnedarea_si_landuse(io_si, cpatch%land_use_label) = & hio_burnedarea_si_landuse(io_si, cpatch%land_use_label) + & cpatch%frac_burnt * cpatch%area * AREA_INV / sec_per_day - - hio_npp_si_landuse(io_si,cpatch%land_use_label) = hio_npp_si_landuse(io_si,cpatch%land_use_label) & - + ccohort%npp_acc_hold * ccohort%n * dt_tstep_inv end if ! Increment some patch-age-resolved diagnostics @@ -3660,6 +3657,11 @@ subroutine update_history_dyn2(this,nc,nsites,sites,bc_in) hio_npp_si_pft(io_si, ft) = hio_npp_si_pft(io_si, ft) + & ccohort%npp_acc_hold * n_perm2 / (days_per_year*sec_per_day) + if (cpatch%land_use_label .gt. nocomp_bareground_land) then + hio_npp_si_landuse(io_si,cpatch%land_use_label) = hio_npp_si_landuse(io_si,cpatch%land_use_label) & + + ccohort%npp_acc_hold * n_perm2 / (days_per_year*sec_per_day) + end if + ! Turnover pools [kgC/day] * [day/yr] = [kgC/yr] sapw_m_turnover = ccohort%prt%GetTurnover(sapw_organ, carbon12_element) * days_per_year store_m_turnover = ccohort%prt%GetTurnover(store_organ, carbon12_element) * days_per_year