Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
707dacb
This PR replaces the multiple leaf phenological habit flags with a si…
mpaiao Mar 10, 2025
6a0dd67
Update several tests in PRTParamsFATESMod.F90 to comply with the sing…
mpaiao Mar 10, 2025
b80aac3
Load flag for season deciduous PFT to the mortality function module.
mpaiao Mar 10, 2025
a376436
Fix forgotten endif when transitioning to select case.
mpaiao Mar 10, 2025
8db13c2
Fix another bug in the if/select case transition.
mpaiao Mar 10, 2025
f37947f
Removed fates_phen_evergreen that was left in fates_params_default.cdl
mpaiao Mar 10, 2025
94b9c39
changed comp_excln parameter to -1 (rank-ordered, deterministic sorting)
ckoven Mar 13, 2025
c74a714
changed default logging parameters to create clearcut rather than red…
ckoven Mar 13, 2025
350bc96
Replace if statement with select case, following @glemieux's suggestion.
mpaiao Mar 24, 2025
687dc3c
fix typo in description of fates_mort_disturb_frac
jennykowalcz Apr 23, 2025
710e371
Merge tag 'sci.1.83.0_api.39.0.0' into mpaiao-pr-phen-flags
glemieux May 6, 2025
e4ece7c
Merge remote-tracking branch 'origin/main' into comp_excln
glemieux May 8, 2025
6d87569
add patch parameter file and archived api39 cdl
glemieux May 8, 2025
857d278
Merge remote-tracking branch 'origin/main' into clearcut_logging
glemieux May 8, 2025
5cdda52
add patch parameter file
glemieux May 8, 2025
39e57d3
update base to be the default
glemieux May 8, 2025
1417939
Merge remote-tracking branch 'ckoven/clearcut_logging' into api40-par…
glemieux May 8, 2025
7f148f5
add patch parameter file for #1355
glemieux May 12, 2025
4d2e62c
Merge remote-tracking branch 'marcos/mpaiao-pr-phen-flags' into api40…
glemieux May 12, 2025
07cc7ca
switch which patch references the archived default
glemieux May 12, 2025
be3d397
Merge remote-tracking branch 'jennyk/jkowalcz-fix-param-file-typos' i…
glemieux May 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions biogeochem/EDCohortDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Module EDCohortDynamicsMod
use PRTGenericMod , only : num_elements
use FatesConstantsMod , only : leaves_off
use FatesConstantsMod , only : leaves_shedding
use FatesConstantsMod , only : ihard_season_decid
use FatesConstantsMod , only : ihard_stress_decid
use FatesConstantsMod , only : isemi_stress_decid
use EDParamsMod , only : ED_val_cohort_age_fusion_tol
Expand Down Expand Up @@ -1389,10 +1390,10 @@ subroutine DamageRecovery(csite,cpatch,ccohort,newly_recovered)

!--- Set some logical flags to simplify "if" blocks
is_hydecid_dormant = &
any(prt_params%stress_decid(ipft) == [ihard_stress_decid,isemi_stress_decid] ) &
any(prt_params%phen_leaf_habit(ipft) == [ihard_stress_decid,isemi_stress_decid] ) &
.and. any(ccohort%status_coh == [leaves_off,leaves_shedding] )
is_sedecid_dormant = &
( prt_params%season_decid(ipft) == itrue ) &
( prt_params%phen_leaf_habit(ipft) == ihard_season_decid ) &
.and. any(ccohort%status_coh == [leaves_off,leaves_shedding] )

! If plants are drought deciduous and are losing or lost all leaves, they cannot
Expand Down
9 changes: 4 additions & 5 deletions biogeochem/EDMortalityFunctionsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module EDMortalityFunctionsMod
use FatesConstantsMod , only : cstarvation_model_lin
use FatesConstantsMod , only : cstarvation_model_exp
use FatesConstantsMod , only : nearzero
use FatesConstantsMod , only : ihard_season_decid
use FatesConstantsMod , only : ihard_stress_decid
use FatesConstantsMod , only : isemi_stress_decid
use FatesConstantsMod , only : leaves_off
Expand Down Expand Up @@ -112,11 +113,9 @@ subroutine mortality_rates( cohort_in,bc_in, btran_ft, mean_temp, &
! the future we could accelerate senescence to avoid mortality. Note that both drought
! deciduous and cold deciduous are considered here to be consistent with the idea that
! plants without leaves cannot die of hydraulic failure.
is_decid_dormant = & !
( prt_params%stress_decid(cohort_in%pft) == ihard_stress_decid .or. & ! Drought deciduous
prt_params%stress_decid(cohort_in%pft) == isemi_stress_decid .or. & ! Semi-deciduous
prt_params%season_decid(cohort_in%pft) == itrue ) .and. & ! Cold deciduous
( cohort_in%status_coh == leaves_off ) ! ! Fully abscised
is_decid_dormant = & !
any ( prt_params%phen_leaf_habit(cohort_in%pft) == [ihard_season_decid,ihard_stress_decid,isemi_stress_decid]) .and. & ! Deciduous
( cohort_in%status_coh == leaves_off ) ! ! Fully abscised

! Size Dependent Senescence
! rate (r) and inflection point (ip) define the increase in mortality rate with dbh
Expand Down
81 changes: 42 additions & 39 deletions biogeochem/EDPhysiologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ module EDPhysiologyMod
use EDParamsMod , only : nclmax
use EDTypesMod , only : AREA,AREA_INV
use FatesConstantsMod , only : leaves_shedding
use FatesConstantsMod , only : ievergreen
use FatesConstantsMod , only : ihard_season_decid
use FatesConstantsMod , only : ihard_stress_decid
use FatesConstantsMod , only : isemi_stress_decid
use EDParamsMod , only : nlevleaf
Expand Down Expand Up @@ -766,20 +768,21 @@ subroutine trim_canopy( currentSite )
sla_levleaf = min(sla_max,prt_params%slatop(ipft)/nscaler_levleaf)

! Find the realised leaf lifespan, depending on the leaf phenology.
if (prt_params%season_decid(ipft) == itrue) then
select case (prt_params%phen_leaf_habit(ipft))
case (ihard_season_decid)
! Cold-deciduous costs. Assume time-span to be 1 year to be consistent
! with FATES default
pft_leaf_lifespan = decid_leaf_long_max

elseif (any(prt_params%stress_decid(ipft) == [ihard_stress_decid,isemi_stress_decid]) )then
case (ihard_stress_decid,isemi_stress_decid)
! Drought-decidous costs. Assume time-span to be the least between
! 1 year and the life span provided by the parameter file.
pft_leaf_lifespan = &
min(decid_leaf_long_max,leaf_long)

else !evergreen costs
case (ievergreen) !evergreen costs
pft_leaf_lifespan = leaf_long
end if
end select

! Leaf cost at leaf level z (kgC m-2 year-1) accounting for sla profile
! (Convert from SLA in m2g-1 to m2kg-1)
Expand Down Expand Up @@ -1289,7 +1292,7 @@ subroutine phenology( currentSite, bc_in )
! the leaf biomass will be capped at 40% of the biomass the cohort would have if
! it were in well-watered conditions.
!---~---
case_drought_phen: select case (prt_params%stress_decid(ipft))
case_drought_phen: select case (prt_params%phen_leaf_habit(ipft))
case (ihard_stress_decid)
!---~---
! Default ("hard") drought deciduous phenology. The decision on whether to
Expand Down Expand Up @@ -1508,11 +1511,11 @@ subroutine phenology( currentSite, bc_in )

! Assign elongation factors for non-drought deciduous PFTs, which will be used
! to define the cohort status.
case_cold_phen: select case(prt_params%season_decid(ipft))
case (ifalse)
case_cold_phen: select case(prt_params%phen_leaf_habit(ipft))
case (ievergreen)
! Evergreen, ensure that elongation factor is always one.
currentSite%elong_factor(ipft) = 1.0_r8
case (itrue)
case (ihard_season_decid)
! Cold-deciduous. Define elongation factor based on cold status
select case (currentSite%cstatus)
case (phen_cstat_nevercold,phen_cstat_iscold)
Expand Down Expand Up @@ -1611,7 +1614,8 @@ subroutine phenology_leafonoff(currentSite)
! MLO. To avoid duplicating code for drought and cold deciduous PFTs, we first
! check whether or not it's time to flush or time to shed leaves, then
! use a common code for flushing or shedding leaves.
is_time_block: if (prt_params%season_decid(ipft) == itrue) then ! Cold deciduous
is_time_block: select case (prt_params%phen_leaf_habit(ipft))
case (ihard_season_decid) ! Cold deciduous

! A. Is this the time for COLD LEAVES to switch to ON?
is_flushing_time = ( currentSite%cstatus == phen_cstat_notcold .and. & ! We just moved to leaves being on
Expand All @@ -1622,7 +1626,7 @@ subroutine phenology_leafonoff(currentSite)
( currentCohort%dbh > EDPftvarcon_inst%phen_cold_size_threshold(ipft) .or. & ! Grasses are big enough or...
prt_params%woody(ipft) == itrue ) ! this is a woody PFT.

elseif (any(prt_params%stress_decid(ipft) == [ihard_stress_decid,isemi_stress_decid]) ) then ! Drought deciduous
case (ihard_stress_decid,isemi_stress_decid) ! Drought deciduous

! A. Is this the time for DROUGHT LEAVES to switch to ON?
is_flushing_time = any( currentSite%dstatus(ipft) == [phen_dstat_moiston,phen_dstat_timeon] ) .and. & ! Leaf flushing time (moisture or time)
Expand All @@ -1631,11 +1635,11 @@ subroutine phenology_leafonoff(currentSite)
! This will be true when leaves are abscissing (partially or fully) due to moisture or time
is_shedding_time = any( currentSite%dstatus(ipft) == [phen_dstat_moistoff,phen_dstat_timeoff,phen_dstat_pshed] ) .and. &
any( currentCohort%status_coh == [leaves_on,leaves_shedding] )
else
case (ievergreen)
! This PFT is not deciduous.
is_flushing_time = .false.
is_shedding_time = .false.
end if is_time_block
end select is_time_block



Expand Down Expand Up @@ -2421,19 +2425,17 @@ subroutine SeedGermination( litt, cold_stat, drought_stat, bc_in, currentPatch )
litt%seed_germ_in(pft) = litt%seed(pft) * seedling_emerg_rate

end if if_tfs_or_def

!set the germination only under the growing season...c.xu

if ((prt_params%season_decid(pft) == itrue ) .and. &
(any(cold_stat == [phen_cstat_nevercold,phen_cstat_iscold]))) then
! no germination for all PFTs when cold
litt%seed_germ_in(pft) = 0.0_r8
endif

! Drought deciduous, halt germination when status is shedding, even leaves are not
! completely abscissed. MLO
select case (prt_params%stress_decid(pft))
select case (prt_params%phen_leaf_habit(pft))
case (ihard_season_decid)
!set the germination only under the growing season...c.xu
if (any(cold_stat == [phen_cstat_nevercold,phen_cstat_iscold])) then
! no germination for all PFTs when cold
litt%seed_germ_in(pft) = 0.0_r8
end if
case (ihard_stress_decid,isemi_stress_decid)
! Drought deciduous, halt germination when status is shedding, even leaves are not
! completely abscissed. MLO
if (any(drought_stat(pft) == [phen_dstat_timeoff,phen_dstat_moistoff,phen_dstat_pshed])) then
litt%seed_germ_in(pft) = 0.0_r8
end if
Expand Down Expand Up @@ -2542,23 +2544,24 @@ subroutine recruitment(currentSite, currentPatch, bc_in)
efstem_coh = 1.0_r8
leaf_status = leaves_on

! but if the plant is seasonally (cold) deciduous, and the site status is flagged
! as "cold", then set the cohort's status to leaves_off, and remember the leaf biomass
if ((prt_params%season_decid(ft) == itrue) .and. &
(any(currentSite%cstatus == [phen_cstat_nevercold, phen_cstat_iscold]))) then
efleaf_coh = 0.0_r8
effnrt_coh = 1.0_r8 - fnrt_drop_fraction
efstem_coh = 1.0_r8 - stem_drop_fraction
leaf_status = leaves_off
end if

! Or.. if the plant is drought deciduous, make sure leaf status is consistent with the
! leaf elongation factor.
! For tissues other than leaves, the actual drop fraction is a combination of the
! elongation factor (e) and the drop fraction (x), which will ensure that the remaining
! tissue biomass will be exactly e when x=1, and exactly the original biomass when x = 0.
select case (prt_params%stress_decid(ft))
! look for cases in which leaves should be off
select case (prt_params%phen_leaf_habit(ft))
case (ihard_season_decid)
select case(currentSite%cstatus)
case (phen_cstat_nevercold, phen_cstat_iscold)
! If the plant is seasonally (cold) deciduous, and the site status is flagged
! as "cold", then set the cohort's status to leaves_off.
efleaf_coh = 0.0_r8
effnrt_coh = 1.0_r8 - fnrt_drop_fraction
efstem_coh = 1.0_r8 - stem_drop_fraction
leaf_status = leaves_off
end select
case (ihard_stress_decid, isemi_stress_decid)
! If the plant is drought deciduous, make sure leaf status is consistent with the
! leaf elongation factor.
! For tissues other than leaves, the actual drop fraction is a combination of the
! elongation factor (e) and the drop fraction (x), which will ensure that the remaining
! tissue biomass will be exactly e when x=1, and exactly the original biomass when x = 0.
efleaf_coh = currentSite%elong_factor(ft)
effnrt_coh = 1.0_r8 - (1.0_r8 - efleaf_coh)*fnrt_drop_fraction
efstem_coh = 1.0_r8 - (1.0_r8 - efleaf_coh)*stem_drop_fraction
Expand Down
32 changes: 3 additions & 29 deletions functional_unit_testing/parteh/PartehDriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,35 +176,9 @@ def main():
for iplnt in range(num_plants):

ipft = use_pfts[iplnt]
evergreen = np.int(fates_params['evergreen'].data[ipft])
cold_deciduous = np.int(fates_params['season_decid'].data[ipft])
stress_deciduous = np.int(fates_params['stress_decid'].data[ipft])
if(evergreen==1):
if(cold_deciduous==1):
print("Poorly defined phenology mode 0")
exit(2)
if(stress_deciduous==1):
print("Poorly defined phenology mode 1")
exit(2)
phen_type.append(1)
elif(cold_deciduous==1):
if(evergreen==1):
print("Poorly defined phenology mode 2")
exit(2)
if(stress_deciduous==1):
print("Poorly defined phenology mode 3")
exit(2)
phen_type.append(2)
elif(stress_deciduous==1):
if(evergreen==1):
print("Poorly defined phenology mode 4")
exit(2)
if(cold_deciduous==1):
print("Poorly defined phenology mode 5")
exit(2)
phen_type.append(3)
else:
print("Unknown phenology mode ? {} {} {}".format(evergreen,cold_deciduous,stress_deciduous))
phen_leaf_habit = np.int(fates_params['phen_leaf_habit'].data[ipft])
if(phen_leaf_habit < 1 or phen_leaf_habit > 4):
print("Unknown phenology mode ? {}".format(phen_leaf_habit))
exit(2)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@

<parteh_parameters >
<pft_par name="parteh_model "> 1 , 1 , 2 , 2 , 2 </pft_par>
<pft_par name="fates_phen_evergreen "> 1 , 0 , 1 , 0 , 0</pft_par>
<pft_par name="fates_phen_season_decid "> 0 , 1 , 0 , 1 , 1</pft_par>
<pft_par name="fates_phen_stress_decid "> 0 , 0 , 0 , 0 , 0</pft_par>
<pft_par name="fates_phen_leaf_habit "> 1 , 2 , 1 , 2 , 2</pft_par>
<pft_par name="fates_seed_alloc "> 0.2 , 0.2 , 0.2 , 0.2 , 0.2</pft_par>
<pft_par name="fates_seed_alloc_mature "> 0.2 , 0.2, 0.2, 0.2, 0.2 </pft_par>
<pft_par name="fates_dbh_repro_threshold "> 30.0 , 30.0 , 30.0, 30.0 , 30.0 </pft_par>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@

<parteh_parameters >
<pft_par name="parteh_model "> 1 , 2 , 2 , 2 , 2 </pft_par>
<pft_par name="fates_phen_evergreen "> 1 , 1 , 1 , 1 , 1</pft_par>
<pft_par name="fates_phen_season_decid "> 0 , 0 , 0 , 0 , 0</pft_par>
<pft_par name="fates_phen_stress_decid "> 0 , 0 , 0 , 0 , 0</pft_par>
<pft_par name="fates_phen_leaf_habit "> 1 , 1 , 1 , 1 , 1</pft_par>
<pft_par name="fates_seed_alloc "> 0.2 , 0.2 , 0.2 , 0.2 , 0.2</pft_par>
<pft_par name="fates_seed_alloc_mature "> 0.2 , 0.2, 0.2, 0.2, 0.2 </pft_par>
<pft_par name="fates_dbh_repro_threshold "> 30.0 , 30.0 , 30.0, 30.0 , 30.0 </pft_par>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

<parteh_parameters >
<pft_par name="parteh_model "> 1 , 2 , 2 </pft_par>
<pft_par name="fates_phen_evergreen "> 1 , 1, 1 </pft_par>
<pft_par name="fates_phen_leaf_habit "> 1 , 1, 1 </pft_par>
<pft_par name="fates_seed_alloc "> 0.2 , 0.2, 0.2 </pft_par>
<pft_par name="fates_seed_alloc_mature "> 0.2 , 0.2 , 0.2 </pft_par>
<pft_par name="fates_dbh_repro_threshold "> 30.0 , 30.0 , 30.0 </pft_par>
Expand Down
43 changes: 26 additions & 17 deletions main/EDInitMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ module EDInitMod
use EDTypesMod , only : init_spread_inventory
use FatesConstantsMod , only : leaves_on
use FatesConstantsMod , only : leaves_off
use FatesConstantsMod , only : ievergreen
use FatesConstantsMod , only : ihard_season_decid
use FatesConstantsMod , only : ihard_stress_decid
use FatesConstantsMod , only : isemi_stress_decid
use PRTGenericMod , only : num_elements
Expand Down Expand Up @@ -1143,15 +1145,23 @@ subroutine init_cohorts(site_in, patch_in, bc_in)
efstem_coh = 1.0_r8
leaf_status = leaves_on
else
! use built-in phenology
if (prt_params%season_decid(pft) == itrue .and. &
any(site_in%cstatus == [phen_cstat_nevercold, phen_cstat_iscold])) then
! Cold deciduous, off season, assume complete abscission
efleaf_coh = 0.0_r8
effnrt_coh = 1.0_r8 - fnrt_drop_fraction
efstem_coh = 1.0_r8 - stem_drop_fraction
leaf_status = leaves_off
else if (any(prt_params%stress_decid(pft) == [ihard_stress_decid, isemi_stress_decid])) then
! use built-in phenology
phen_select: select case (prt_params%phen_leaf_habit(pft))
case (ihard_season_decid)
if ( any(site_in%cstatus == [phen_cstat_nevercold, phen_cstat_iscold]) ) then
! Cold deciduous, off season, assume complete abscission
efleaf_coh = 0.0_r8
effnrt_coh = 1.0_r8 - fnrt_drop_fraction
efstem_coh = 1.0_r8 - stem_drop_fraction
leaf_status = leaves_off
else
! Cold deciduous, growing season, assume leaves fully flushed
efleaf_coh = 1.0_r8
effnrt_coh = 1.0_r8
efstem_coh = 1.0_r8
leaf_status = leaves_on
end if
case (ihard_stress_decid, isemi_stress_decid)
! If the plant is drought deciduous, make sure leaf status is
! always consistent with the leaf elongation factor. For tissues
! other than leaves, the actual drop fraction is a combination of the
Expand All @@ -1167,14 +1177,13 @@ subroutine init_cohorts(site_in, patch_in, bc_in)
else
leaf_status = leaves_off
end if
else
! Evergreens, or deciduous during growing season
! Assume leaves fully flushed
efleaf_coh = 1.0_r8
effnrt_coh = 1.0_r8
efstem_coh = 1.0_r8
leaf_status = leaves_on
end if
case (ievergreen)
! Evergreens, assume leaves fully flushed
efleaf_coh = 1.0_r8
effnrt_coh = 1.0_r8
efstem_coh = 1.0_r8
leaf_status = leaves_on
end select phen_select
end if if_spmode

! If positive EDPftvarcon_inst%initd is interpreted as initial recruit density.
Expand Down
Loading