Skip to content

Commit 296e1d6

Browse files
authored
Merge pull request #1291 from sshu88/fatesluc_cbasedhrv_v2
Bug fix for issue #1289
2 parents 02ee145 + 77e8948 commit 296e1d6

File tree

2 files changed

+26
-24
lines changed

2 files changed

+26
-24
lines changed

biogeochem/EDLoggingMortalityMod.F90

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ module EDLoggingMortalityMod
7373
use FatesConstantsMod , only : hlm_harvest_area_fraction
7474
use FatesConstantsMod , only : hlm_harvest_carbon
7575
use FatesConstantsMod, only : fates_check_param_set
76+
use FatesConstantsMod, only : fates_no_harvest_debt, fates_with_harvest_debt, fates_bypass_harvest_debt
77+
7678
use FatesInterfaceTypesMod , only : numpft
7779
use FatesLandUseChangeMod, only : GetInitLanduseHarvestRate
7880
use FatesLandUseChangeMod, only : GetLUHStatedata
@@ -235,9 +237,6 @@ subroutine LoggingMortality_frac( currentSite, bc_in, pft_i, dbh, canopy_layer,
235237
integer, intent(out) :: harvest_tag(:) ! tag to record the harvest status
236238
! for the calculation of harvest debt in C-based
237239
! harvest mode
238-
! 0 - successful;
239-
! 1 - unsuccessful since not enough carbon
240-
! 2 - not applicable
241240

242241
! Local variables
243242
integer :: cur_harvest_tag ! the harvest tag of the cohort today
@@ -278,10 +277,11 @@ subroutine LoggingMortality_frac( currentSite, bc_in, pft_i, dbh, canopy_layer,
278277
harvest_rate = 0._r8
279278
endif
280279

281-
! For area-based harvest, harvest_tag shall always be 2 (not applicable).
282-
harvest_tag = 2
283-
cur_harvest_tag = 2
284-
elseif (logging_time) then
280+
! For area-based harvest, harvest_tag shall always be fates_bypass_harvest_debt (not applicable).
281+
harvest_tag = fates_bypass_harvest_debt
282+
cur_harvest_tag = fates_bypass_harvest_debt
283+
284+
elseif (logging_time) then
285285

286286
! Pass logging rates to cohort level
287287

@@ -312,8 +312,8 @@ subroutine LoggingMortality_frac( currentSite, bc_in, pft_i, dbh, canopy_layer,
312312
hlm_harvest_rates, frac_site_primary, frac_site_secondary, secondary_young_fraction, secondary_age, harvest_rate)
313313

314314
! For area-based harvest, harvest_tag shall always be 2 (not applicable).
315-
harvest_tag = 2
316-
cur_harvest_tag = 2
315+
harvest_tag = fates_bypass_harvest_debt
316+
cur_harvest_tag = fates_bypass_harvest_debt
317317

318318
if (fates_global_verbose()) then
319319
write(fates_log(), *) 'Successfully Read Harvest Rate from HLM.', hlm_harvest_rates(:), harvest_rate
@@ -336,14 +336,14 @@ subroutine LoggingMortality_frac( currentSite, bc_in, pft_i, dbh, canopy_layer,
336336
else
337337
harvest_rate = 0._r8
338338
! For area-based harvest, harvest_tag shall always be 2 (not applicable).
339-
harvest_tag = 2
340-
cur_harvest_tag = 2
339+
harvest_tag = fates_bypass_harvest_debt
340+
cur_harvest_tag = fates_bypass_harvest_debt
341341
endif
342342

343343
! transfer of area to secondary land is based on overall area affected, not just logged crown area
344344
! l_degrad accounts for the affected area between logged crowns
345345
if(prt_params%woody(pft_i) == itrue)then ! only set logging rates for trees
346-
if (cur_harvest_tag == 0) then
346+
if (cur_harvest_tag == fates_no_harvest_debt .or. cur_harvest_tag == fates_bypass_harvest_debt) then
347347
! direct logging rates, based on dbh min and max criteria
348348
if (dbh >= logging_dbhmin .and. .not. &
349349
((logging_dbhmax < fates_check_param_set) .and. (dbh >= logging_dbhmax )) ) then
@@ -618,10 +618,7 @@ subroutine get_harvest_rate_carbon (patch_land_use_label, hlm_harvest_catnames,
618618
real(r8), intent(in) :: secondary_age ! patch level age_since_anthro_disturbance
619619
real(r8), intent(in) :: harvestable_forest_c(:) ! site level forest c matching criteria available for harvest, kgC site-1
620620
real(r8), intent(out) :: harvest_rate ! area fraction
621-
integer, intent(inout) :: harvest_tag(:) ! 0. normal harvest; 1. current site does not have enough C but
622-
! can perform harvest by ignoring criteria; 2. current site does
623-
! not have enough carbon
624-
! This harvest tag shall be a patch level variable but since all
621+
integer, intent(inout) :: harvest_tag(:) ! This harvest tag can be raused to patch level but since all
625622
! logging functions happen within cohort loop we can only put the
626623
! calculation here. Can think about optimizing the logging calculation
627624
! in the future.
@@ -641,7 +638,7 @@ subroutine get_harvest_rate_carbon (patch_land_use_label, hlm_harvest_catnames,
641638
harvest_rate = 0._r8
642639
harvest_rate_c = 0._r8
643640
harvest_rate_supply = 0._r8
644-
harvest_tag(:) = 2
641+
harvest_tag(:) = fates_bypass_harvest_debt
645642

646643
! Since we have five harvest categories from forcing data but in FATES non-forest harvest
647644
! is merged with forest harvest, we only have three logging type in FATES (primary, secondary
@@ -674,29 +671,29 @@ subroutine get_harvest_rate_carbon (patch_land_use_label, hlm_harvest_catnames,
674671
if(hlm_harvest_catnames(h_index) .eq. "HARVEST_VH1" ) then
675672
if(harvestable_forest_c(h_index) >= harvest_rate_c) then
676673
harvest_rate_supply = harvest_rate_supply + harvestable_forest_c(h_index)
677-
harvest_tag(h_index) = 0
674+
harvest_tag(h_index) = fates_no_harvest_debt
678675
else
679-
harvest_tag(h_index) = 1
676+
harvest_tag(h_index) = fates_with_harvest_debt
680677
end if
681678
end if
682679
else if (patch_land_use_label .eq. secondaryland .and. &
683680
secondary_age >= secondary_age_threshold) then
684681
if(hlm_harvest_catnames(h_index) .eq. "HARVEST_SH1" ) then
685682
if(harvestable_forest_c(h_index) >= harvest_rate_c) then
686683
harvest_rate_supply = harvest_rate_supply + harvestable_forest_c(h_index)
687-
harvest_tag(h_index) = 0
684+
harvest_tag(h_index) = fates_no_harvest_debt
688685
else
689-
harvest_tag(h_index) = 1
686+
harvest_tag(h_index) = fates_with_harvest_debt
690687
end if
691688
end if
692689
else if (patch_land_use_label .eq. secondaryland .and. &
693690
secondary_age < secondary_age_threshold) then
694691
if(hlm_harvest_catnames(h_index) .eq. "HARVEST_SH2" ) then
695692
if(harvestable_forest_c(h_index) >= harvest_rate_c) then
696693
harvest_rate_supply = harvest_rate_supply + harvestable_forest_c(h_index)
697-
harvest_tag(h_index) = 0
694+
harvest_tag(h_index) = fates_no_harvest_debt
698695
else
699-
harvest_tag(h_index) = 1
696+
harvest_tag(h_index) = fates_with_harvest_debt
700697
end if
701698
end if
702699
end if
@@ -1262,7 +1259,7 @@ subroutine get_harvest_debt(site_in, bc_in, harvest_tag)
12621259
end do
12631260
! Next we get the harvest debt through the harvest tag
12641261
do h_index = 1, hlm_num_lu_harvest_cats
1265-
if (harvest_tag(h_index) .eq. 1) then
1262+
if (harvest_tag(h_index) .eq. fates_with_harvest_debt) then
12661263
if(bc_in%hlm_harvest_catnames(h_index) .eq. "HARVEST_VH1") then
12671264
site_in%resources_management%harvest_debt = site_in%resources_management%harvest_debt + &
12681265
harvest_debt_pri

main/FatesConstantsMod.F90

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,11 @@ module FatesConstantsMod
141141
integer, parameter, public :: hlm_harvest_area_fraction = 1 ! Code for harvesting by area
142142
integer, parameter, public :: hlm_harvest_carbon = 2 ! Code for harvesting based on carbon extracted.
143143

144+
! integer labels for specifying harvest debt status
145+
integer, parameter, public :: fates_no_harvest_debt = 0
146+
integer, parameter, public :: fates_with_harvest_debt = 1
147+
integer, parameter, public :: fates_bypass_harvest_debt = 2 ! Do not calculate harvest debt for area based harvest
148+
144149
! integer labels for specifying leaf maintenance respiration models
145150
integer, parameter, public :: lmrmodel_ryan_1991 = 1
146151
integer, parameter, public :: lmrmodel_atkin_etal_2017 = 2

0 commit comments

Comments
 (0)