Skip to content

Commit f5bd625

Browse files
authored
Merge pull request #1217 from rgknox/history-flux-diags
time integrated flux diagnostics
2 parents 825579d + c83473d commit f5bd625

12 files changed

+558
-183
lines changed

biogeochem/EDCohortDynamicsMod.F90

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Module EDCohortDynamicsMod
4545
use PRTGenericMod , only : max_nleafage
4646
use FatesConstantsMod , only : ican_upper
4747
use EDTypesMod , only : site_fluxdiags_type
48+
use EDTypesMod , only : elem_diag_type
4849
use PRTGenericMod , only : num_elements
4950
use FatesConstantsMod , only : leaves_on
5051
use FatesConstantsMod , only : leaves_off
@@ -602,7 +603,7 @@ subroutine SendCohortToLitter(csite,cpatch,ccohort,nplant,bc_in)
602603
type(bc_in_type), intent(in) :: bc_in
603604

604605
type(litter_type), pointer :: litt ! Litter object for each element
605-
type(site_fluxdiags_type),pointer :: flux_diags
606+
type(elem_diag_type),pointer :: elflux_diags
606607

607608
real(r8) :: leaf_m ! leaf mass [kg]
608609
real(r8) :: store_m ! storage mass [kg]
@@ -646,7 +647,7 @@ subroutine SendCohortToLitter(csite,cpatch,ccohort,nplant,bc_in)
646647
endif
647648

648649
litt => cpatch%litter(el)
649-
flux_diags => csite%flux_diags(el)
650+
elflux_diags => csite%flux_diags%elem(el)
650651

651652
!adjust how wood is partitioned between the cwd classes based on cohort dbh
652653
call adjust_SF_CWD_frac(ccohort%dbh,ncwd,SF_val_CWD_frac,SF_val_CWD_frac_adj)
@@ -667,12 +668,12 @@ subroutine SendCohortToLitter(csite,cpatch,ccohort,nplant,bc_in)
667668
enddo
668669

669670
! above ground
670-
flux_diags%cwd_ag_input(c) = flux_diags%cwd_ag_input(c) + &
671+
elflux_diags%cwd_ag_input(c) = elflux_diags%cwd_ag_input(c) + &
671672
(struct_m+sapw_m) * SF_val_CWD_frac_adj(c) * &
672673
prt_params%allom_agb_frac(pft) * nplant
673674

674675
! below ground
675-
flux_diags%cwd_bg_input(c) = flux_diags%cwd_bg_input(c) + &
676+
elflux_diags%cwd_bg_input(c) = elflux_diags%cwd_bg_input(c) + &
676677
(struct_m + sapw_m) * SF_val_CWD_frac_adj(c) * &
677678
(1.0_r8 - prt_params%allom_agb_frac(pft)) * nplant
678679

@@ -692,11 +693,11 @@ subroutine SendCohortToLitter(csite,cpatch,ccohort,nplant,bc_in)
692693

693694
end do
694695

695-
flux_diags%leaf_litter_input(pft) = &
696-
flux_diags%leaf_litter_input(pft) + &
696+
elflux_diags%surf_fine_litter_input(pft) = &
697+
elflux_diags%surf_fine_litter_input(pft) + &
697698
(leaf_m+repro_m) * nplant
698-
flux_diags%root_litter_input(pft) = &
699-
flux_diags%root_litter_input(pft) + &
699+
elflux_diags%root_litter_input(pft) = &
700+
elflux_diags%root_litter_input(pft) + &
700701
(fnrt_m+store_m) * nplant
701702

702703

biogeochem/EDLoggingMortalityMod.F90

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ module EDLoggingMortalityMod
1919
use FatesPatchMod , only : fates_patch_type
2020
use EDTypesMod , only : site_massbal_type
2121
use EDTypesMod , only : site_fluxdiags_type
22+
use EDTypesMod , only : elem_diag_type
2223
use FatesLitterMod , only : ncwd
2324
use FatesLitterMod , only : ndcmpy
2425
use FatesLitterMod , only : litter_type
@@ -28,6 +29,7 @@ module EDLoggingMortalityMod
2829
use FatesConstantsMod , only : dtype_ilog
2930
use FatesConstantsMod , only : dtype_ifall
3031
use FatesConstantsMod , only : dtype_ifire
32+
use EDTypesMod , only : area_inv
3133
use FatesConstantsMod , only : n_landuse_cats
3234
use EDPftvarcon , only : EDPftvarcon_inst
3335
use EDPftvarcon , only : GetDecompyFrac
@@ -502,8 +504,6 @@ subroutine get_harvestable_carbon (csite, site_area, hlm_harvest_catnames, harve
502504

503505
!USES:
504506
use SFParamsMod, only : SF_val_cwd_frac
505-
use EDTypesMod, only : AREA_INV
506-
507507

508508
! -------------------------------------------------------------------------------------------
509509
!
@@ -556,7 +556,7 @@ subroutine get_harvestable_carbon (csite, site_area, hlm_harvest_catnames, harve
556556
harvestable_cohort_c = logging_direct_frac * ( sapw_m + struct_m ) * &
557557
prt_params%allom_agb_frac(currentCohort%pft) * &
558558
SF_val_CWD_frac(ncwd) * logging_export_frac * &
559-
currentCohort%n * AREA_INV * site_area
559+
currentCohort%n * area_inv * site_area
560560

561561
! No harvest for trees without canopy
562562
if (currentCohort%canopy_layer>=1) then
@@ -795,9 +795,9 @@ subroutine logging_litter_fluxes(currentSite, currentPatch, newPatch, patch_site
795795

796796

797797
!LOCAL VARIABLES:
798-
type(fates_cohort_type), pointer :: currentCohort
798+
type(fates_cohort_type), pointer :: currentCohort
799799
type(site_massbal_type), pointer :: site_mass
800-
type(site_fluxdiags_type), pointer :: flux_diags
800+
type(elem_diag_type), pointer :: elflux_diags
801801
type(litter_type),pointer :: new_litt
802802
type(litter_type),pointer :: cur_litt
803803

@@ -855,12 +855,12 @@ subroutine logging_litter_fluxes(currentSite, currentPatch, newPatch, patch_site
855855

856856

857857
do el = 1,num_elements
858-
858+
859859
element_id = element_list(el)
860860
site_mass => currentSite%mass_balance(el)
861-
flux_diags=> currentSite%flux_diags(el)
861+
elflux_diags=> currentSite%flux_diags%elem(el)
862862
cur_litt => currentPatch%litter(el) ! Litter pool of "current" patch
863-
new_litt => newPatch%litter(el) ! Litter pool of "new" patch
863+
new_litt => newPatch%litter(el) ! Litter pool of "new" patch
864864

865865
! Zero some site level accumulator diagnsotics
866866
trunk_product_site = 0.0_r8
@@ -958,10 +958,10 @@ subroutine logging_litter_fluxes(currentSite, currentPatch, newPatch, patch_site
958958

959959

960960
! Diagnostics on fluxes into the AG and BG CWD pools
961-
flux_diags%cwd_ag_input(c) = flux_diags%cwd_ag_input(c) + &
961+
elflux_diags%cwd_ag_input(c) = elflux_diags%cwd_ag_input(c) + &
962962
SF_val_CWD_frac_adj(c) * ag_wood
963963

964-
flux_diags%cwd_bg_input(c) = flux_diags%cwd_bg_input(c) + &
964+
elflux_diags%cwd_bg_input(c) = elflux_diags%cwd_bg_input(c) + &
965965
SF_val_CWD_frac_adj(c) * bg_wood
966966

967967
! Diagnostic specific to resource management code
@@ -999,10 +999,10 @@ subroutine logging_litter_fluxes(currentSite, currentPatch, newPatch, patch_site
999999

10001000
end do
10011001

1002-
flux_diags%cwd_ag_input(ncwd) = flux_diags%cwd_ag_input(ncwd) + &
1002+
elflux_diags%cwd_ag_input(ncwd) = elflux_diags%cwd_ag_input(ncwd) + &
10031003
SF_val_CWD_frac_adj(ncwd) * ag_wood
10041004

1005-
flux_diags%cwd_bg_input(ncwd) = flux_diags%cwd_bg_input(ncwd) + &
1005+
elflux_diags%cwd_bg_input(ncwd) = elflux_diags%cwd_bg_input(ncwd) + &
10061006
SF_val_CWD_frac_adj(ncwd) * bg_wood
10071007

10081008
if( element_id .eq. carbon12_element) then
@@ -1027,7 +1027,7 @@ subroutine logging_litter_fluxes(currentSite, currentPatch, newPatch, patch_site
10271027
retain_m2
10281028
end do
10291029

1030-
flux_diags%cwd_bg_input(ncwd) = flux_diags%cwd_bg_input(ncwd) + &
1030+
elflux_diags%cwd_bg_input(ncwd) = elflux_diags%cwd_bg_input(ncwd) + &
10311031
bg_wood
10321032

10331033
! ----------------------------------------------------------------------------------------
@@ -1088,10 +1088,10 @@ subroutine logging_litter_fluxes(currentSite, currentPatch, newPatch, patch_site
10881088
end do
10891089

10901090
! track as diagnostic fluxes
1091-
flux_diags%leaf_litter_input(pft) = flux_diags%leaf_litter_input(pft) + &
1091+
elflux_diags%surf_fine_litter_input(pft) = elflux_diags%surf_fine_litter_input(pft) + &
10921092
leaf_litter
10931093

1094-
flux_diags%root_litter_input(pft) = flux_diags%root_litter_input(pft) + &
1094+
elflux_diags%root_litter_input(pft) = elflux_diags%root_litter_input(pft) + &
10951095
root_litter
10961096

10971097
! Logging specific diagnostics
@@ -1116,6 +1116,10 @@ subroutine logging_litter_fluxes(currentSite, currentPatch, newPatch, patch_site
11161116
currentCohort => currentCohort%taller
11171117
end do
11181118

1119+
! Amount of trunk mass exported off site [kg/m2]
1120+
elflux_diags%exported_harvest = elflux_diags%exported_harvest + &
1121+
trunk_product_site * area_inv
1122+
11191123
! Update the amount of carbon exported from the site through logging
11201124
! operations. Currently we assume only above-ground portion
11211125
! of the tree bole that experienced "direct" logging is exported
@@ -1166,7 +1170,6 @@ subroutine UpdateHarvestC(currentSite,bc_out)
11661170
! Harvested C flux in HLM.
11671171
! ----------------------------------------------------------------------------------
11681172
use EDtypesMod , only : ed_site_type
1169-
use EDTypesMod , only : AREA_INV
11701173
use PRTGenericMod , only : element_pos
11711174
use PRTGenericMod , only : carbon12_element
11721175
use FatesInterfaceTypesMod , only : bc_out_type
@@ -1191,20 +1194,20 @@ subroutine UpdateHarvestC(currentSite,bc_out)
11911194
do i_pft = 1,numpft
11921195
bc_out%hrv_deadstemc_to_prod10c = bc_out%hrv_deadstemc_to_prod10c + &
11931196
currentSite%mass_balance(element_pos(carbon12_element))%wood_product_harvest(i_pft) * &
1194-
AREA_INV * EDPftvarcon_inst%harvest_pprod10(i_pft) * unit_trans_factor
1197+
area_inv * EDPftvarcon_inst%harvest_pprod10(i_pft) * unit_trans_factor
11951198
bc_out%hrv_deadstemc_to_prod100c = bc_out%hrv_deadstemc_to_prod100c + &
11961199
currentSite%mass_balance(element_pos(carbon12_element))%wood_product_harvest(i_pft) * &
1197-
AREA_INV * (1._r8 - EDPftvarcon_inst%harvest_pprod10(i_pft)) * unit_trans_factor
1200+
area_inv * (1._r8 - EDPftvarcon_inst%harvest_pprod10(i_pft)) * unit_trans_factor
11981201
end do
11991202

12001203
! land-use-change-associated wood product pools
12011204
do i_pft = 1,numpft
12021205
bc_out%hrv_deadstemc_to_prod10c = bc_out%hrv_deadstemc_to_prod10c + &
12031206
currentSite%mass_balance(element_pos(carbon12_element))%wood_product_landusechange(i_pft) * &
1204-
AREA_INV * EDPftvarcon_inst%landusechange_pprod10(i_pft) * unit_trans_factor
1207+
area_inv * EDPftvarcon_inst%landusechange_pprod10(i_pft) * unit_trans_factor
12051208
bc_out%hrv_deadstemc_to_prod100c = bc_out%hrv_deadstemc_to_prod100c + &
12061209
currentSite%mass_balance(element_pos(carbon12_element))%wood_product_landusechange(i_pft) * &
1207-
AREA_INV * (1._r8 - EDPftvarcon_inst%landusechange_pprod10(i_pft)) * unit_trans_factor
1210+
area_inv * (1._r8 - EDPftvarcon_inst%landusechange_pprod10(i_pft)) * unit_trans_factor
12081211
end do
12091212

12101213
return

0 commit comments

Comments
 (0)