Skip to content

Commit 7859acd

Browse files
committed
Merge branch 'mpaiao-pr-phen-flags' into mpaiao-pr-decid-streamline
2 parents 93f7fca + 350bc96 commit 7859acd

18 files changed

+231
-290
lines changed

biogeochem/EDCohortDynamicsMod.F90

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Module EDCohortDynamicsMod
3939
use PRTGenericMod , only : num_elements
4040
use FatesConstantsMod , only : leaves_off
4141
use FatesConstantsMod , only : leaves_shedding
42+
use FatesConstantsMod , only : ihard_season_decid
4243
use FatesConstantsMod , only : ihard_stress_decid
4344
use FatesConstantsMod , only : isemi_stress_decid
4445
use EDParamsMod , only : ED_val_cohort_age_fusion_tol
@@ -1389,10 +1390,10 @@ subroutine DamageRecovery(csite,cpatch,ccohort,newly_recovered)
13891390

13901391
!--- Set some logical flags to simplify "if" blocks
13911392
is_hydecid_dormant = &
1392-
any(prt_params%stress_decid(ipft) == [ihard_stress_decid,isemi_stress_decid] ) &
1393+
any(prt_params%phen_leaf_habit(ipft) == [ihard_stress_decid,isemi_stress_decid] ) &
13931394
.and. any(ccohort%status_coh == [leaves_off,leaves_shedding] )
13941395
is_sedecid_dormant = &
1395-
( prt_params%season_decid(ipft) == itrue ) &
1396+
( prt_params%phen_leaf_habit(ipft) == ihard_season_decid ) &
13961397
.and. any(ccohort%status_coh == [leaves_off,leaves_shedding] )
13971398

13981399
! If plants are drought deciduous and are losing or lost all leaves, they cannot

biogeochem/EDMortalityFunctionsMod.F90

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ module EDMortalityFunctionsMod
1616
use FatesConstantsMod , only : cstarvation_model_lin
1717
use FatesConstantsMod , only : cstarvation_model_exp
1818
use FatesConstantsMod , only : nearzero
19+
use FatesConstantsMod , only : ihard_season_decid
1920
use FatesConstantsMod , only : ihard_stress_decid
2021
use FatesConstantsMod , only : isemi_stress_decid
2122
use FatesConstantsMod , only : leaves_off
@@ -112,11 +113,9 @@ subroutine mortality_rates( cohort_in,bc_in, btran_ft, mean_temp, &
112113
! the future we could accelerate senescence to avoid mortality. Note that both drought
113114
! deciduous and cold deciduous are considered here to be consistent with the idea that
114115
! plants without leaves cannot die of hydraulic failure.
115-
is_decid_dormant = & !
116-
( prt_params%stress_decid(cohort_in%pft) == ihard_stress_decid .or. & ! Drought deciduous
117-
prt_params%stress_decid(cohort_in%pft) == isemi_stress_decid .or. & ! Semi-deciduous
118-
prt_params%season_decid(cohort_in%pft) == itrue ) .and. & ! Cold deciduous
119-
( cohort_in%status_coh == leaves_off ) ! ! Fully abscised
116+
is_decid_dormant = & !
117+
any ( prt_params%phen_leaf_habit(cohort_in%pft) == [ihard_season_decid,ihard_stress_decid,isemi_stress_decid]) .and. & ! Deciduous
118+
( cohort_in%status_coh == leaves_off ) ! ! Fully abscised
120119

121120
! Size Dependent Senescence
122121
! rate (r) and inflection point (ip) define the increase in mortality rate with dbh

biogeochem/EDPhysiologyMod.F90

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ module EDPhysiologyMod
6666
use EDParamsMod , only : nclmax
6767
use EDTypesMod , only : AREA,AREA_INV
6868
use FatesConstantsMod , only : leaves_shedding
69+
use FatesConstantsMod , only : ievergreen
70+
use FatesConstantsMod , only : ihard_season_decid
6971
use FatesConstantsMod , only : ihard_stress_decid
7072
use FatesConstantsMod , only : isemi_stress_decid
7173
use EDParamsMod , only : nlevleaf
@@ -769,20 +771,21 @@ subroutine trim_canopy( currentSite )
769771
sla_levleaf = min(sla_max,prt_params%slatop(ipft)/nscaler_levleaf)
770772

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

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

783-
else !evergreen costs
786+
case (ievergreen) !evergreen costs
784787
pft_leaf_lifespan = leaf_long
785-
end if
788+
end select
786789

787790
! Leaf cost at leaf level z (kgC m-2 year-1) accounting for sla profile
788791
! (Convert from SLA in m2g-1 to m2kg-1)
@@ -1234,7 +1237,7 @@ subroutine phenology( currentSite, bc_in )
12341237
! the leaf biomass will be capped at 40% of the biomass the cohort would have if
12351238
! it were in well-watered conditions.
12361239
!---~---
1237-
case_drought_phen: select case (prt_params%stress_decid(ipft))
1240+
case_drought_phen: select case (prt_params%phen_leaf_habit(ipft))
12381241
case (ihard_stress_decid)
12391242
!---~---
12401243
! Default ("hard") drought deciduous phenology. The decision on whether to
@@ -1453,11 +1456,11 @@ subroutine phenology( currentSite, bc_in )
14531456

14541457
! Assign elongation factors for non-drought deciduous PFTs, which will be used
14551458
! to define the cohort status.
1456-
case_cold_phen: select case(prt_params%season_decid(ipft))
1457-
case (ifalse)
1459+
case_cold_phen: select case(prt_params%phen_leaf_habit(ipft))
1460+
case (ievergreen)
14581461
! Evergreen, ensure that elongation factor is always one.
14591462
currentSite%elong_factor(ipft) = 1.0_r8
1460-
case (itrue)
1463+
case (ihard_season_decid)
14611464
! Cold-deciduous. Define elongation factor based on cold status
14621465
select case (currentSite%phen_status(ipft))
14631466
case (phen_cstat_nevercold,phen_cstat_iscold)
@@ -1556,7 +1559,8 @@ subroutine phenology_leafonoff(currentSite)
15561559
! MLO. To avoid duplicating code for drought and cold deciduous PFTs, we first
15571560
! check whether or not it's time to flush or time to shed leaves, then
15581561
! use a common code for flushing or shedding leaves.
1559-
is_time_block: if (prt_params%season_decid(ipft) == itrue) then ! Cold deciduous
1562+
is_time_block: select case (prt_params%phen_leaf_habit(ipft))
1563+
case (ihard_season_decid) ! Cold deciduous
15601564

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

1570-
elseif (any(prt_params%stress_decid(ipft) == [ihard_stress_decid,isemi_stress_decid]) ) then ! Drought deciduous
1574+
case (ihard_stress_decid,isemi_stress_decid) ! Drought deciduous
15711575

15721576
! A. Is this the time for DROUGHT LEAVES to switch to ON?
15731577
is_flushing_time = any( currentSite%phen_status(ipft) == [phen_dstat_moiston,phen_dstat_timeon] ) .and. & ! Leaf flushing time (moisture or time)
@@ -1576,11 +1580,11 @@ subroutine phenology_leafonoff(currentSite)
15761580
! This will be true when leaves are abscissing (partially or fully) due to moisture or time
15771581
is_shedding_time = any( currentSite%phen_status(ipft) == [phen_dstat_moistoff,phen_dstat_timeoff,phen_dstat_pshed] ) .and. &
15781582
any( currentCohort%status_coh == [leaves_on,leaves_shedding] )
1579-
else
1583+
case (ievergreen)
15801584
! This PFT is not deciduous.
15811585
is_flushing_time = .false.
15821586
is_shedding_time = .false.
1583-
end if is_time_block
1587+
end select is_time_block
15841588

15851589

15861590

@@ -2365,19 +2369,17 @@ subroutine SeedGermination( litt, phen_stat, bc_in, currentPatch )
23652369
litt%seed_germ_in(pft) = litt%seed(pft) * seedling_emerg_rate
23662370

23672371
end if if_tfs_or_def
2368-
2369-
!set the germination only under the growing season...c.xu
23702372

2371-
if ((prt_params%season_decid(pft) == itrue ) .and. &
2372-
(any(phen_stat(pft) == [phen_cstat_nevercold,phen_cstat_iscold]))) then
2373-
! no germination for all PFTs when cold
2374-
litt%seed_germ_in(pft) = 0.0_r8
2375-
endif
2376-
2377-
! Drought deciduous, halt germination when status is shedding, even leaves are not
2378-
! completely abscissed. MLO
2379-
select case (prt_params%stress_decid(pft))
2373+
select case (prt_params%phen_leaf_habit(pft))
2374+
case (ihard_season_decid)
2375+
!set the germination only under the growing season...c.xu
2376+
if (any(phen_stat(pft) == [phen_cstat_nevercold,phen_cstat_iscold])) then
2377+
! no germination for all PFTs when cold
2378+
litt%seed_germ_in(pft) = 0.0_r8
2379+
end if
23802380
case (ihard_stress_decid,isemi_stress_decid)
2381+
! Drought deciduous, halt germination when status is shedding, even leaves are not
2382+
! completely abscissed. MLO
23812383
if (any(phen_stat(pft) == [phen_dstat_timeoff,phen_dstat_moistoff,phen_dstat_pshed])) then
23822384
litt%seed_germ_in(pft) = 0.0_r8
23832385
end if
@@ -2486,23 +2488,24 @@ subroutine recruitment(currentSite, currentPatch, bc_in)
24862488
efstem_coh = 1.0_r8
24872489
leaf_status = leaves_on
24882490

2489-
! but if the plant is seasonally (cold) deciduous, and the site status is flagged
2490-
! as "cold", then set the cohort's status to leaves_off, and remember the leaf biomass
2491-
if ((prt_params%season_decid(ft) == itrue) .and. &
2492-
(any(currentSite%phen_status(ft) == [phen_cstat_nevercold, phen_cstat_iscold]))) then
2493-
efleaf_coh = 0.0_r8
2494-
effnrt_coh = 1.0_r8 - fnrt_drop_fraction
2495-
efstem_coh = 1.0_r8 - stem_drop_fraction
2496-
leaf_status = leaves_off
2497-
end if
2498-
2499-
! Or.. if the plant is drought deciduous, make sure leaf status is consistent with the
2500-
! leaf elongation factor.
2501-
! For tissues other than leaves, the actual drop fraction is a combination of the
2502-
! elongation factor (e) and the drop fraction (x), which will ensure that the remaining
2503-
! tissue biomass will be exactly e when x=1, and exactly the original biomass when x = 0.
2504-
select case (prt_params%stress_decid(ft))
2491+
! look for cases in which leaves should be off
2492+
select case (prt_params%phen_leaf_habit(ft))
2493+
case (ihard_season_decid)
2494+
select case(currentSite%phen_status(ft))
2495+
case (phen_cstat_nevercold, phen_cstat_iscold)
2496+
! If the plant is seasonally (cold) deciduous, and the site status is flagged
2497+
! as "cold", then set the cohort's status to leaves_off.
2498+
efleaf_coh = 0.0_r8
2499+
effnrt_coh = 1.0_r8 - fnrt_drop_fraction
2500+
efstem_coh = 1.0_r8 - stem_drop_fraction
2501+
leaf_status = leaves_off
2502+
end select
25052503
case (ihard_stress_decid, isemi_stress_decid)
2504+
! If the plant is drought deciduous, make sure leaf status is consistent with the
2505+
! leaf elongation factor.
2506+
! For tissues other than leaves, the actual drop fraction is a combination of the
2507+
! elongation factor (e) and the drop fraction (x), which will ensure that the remaining
2508+
! tissue biomass will be exactly e when x=1, and exactly the original biomass when x = 0.
25062509
efleaf_coh = currentSite%elong_factor(ft)
25072510
effnrt_coh = 1.0_r8 - (1.0_r8 - efleaf_coh)*fnrt_drop_fraction
25082511
efstem_coh = 1.0_r8 - (1.0_r8 - efleaf_coh)*stem_drop_fraction

functional_unit_testing/parteh/PartehDriver.py

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -176,35 +176,9 @@ def main():
176176
for iplnt in range(num_plants):
177177

178178
ipft = use_pfts[iplnt]
179-
evergreen = np.int(fates_params['evergreen'].data[ipft])
180-
cold_deciduous = np.int(fates_params['season_decid'].data[ipft])
181-
stress_deciduous = np.int(fates_params['stress_decid'].data[ipft])
182-
if(evergreen==1):
183-
if(cold_deciduous==1):
184-
print("Poorly defined phenology mode 0")
185-
exit(2)
186-
if(stress_deciduous==1):
187-
print("Poorly defined phenology mode 1")
188-
exit(2)
189-
phen_type.append(1)
190-
elif(cold_deciduous==1):
191-
if(evergreen==1):
192-
print("Poorly defined phenology mode 2")
193-
exit(2)
194-
if(stress_deciduous==1):
195-
print("Poorly defined phenology mode 3")
196-
exit(2)
197-
phen_type.append(2)
198-
elif(stress_deciduous==1):
199-
if(evergreen==1):
200-
print("Poorly defined phenology mode 4")
201-
exit(2)
202-
if(cold_deciduous==1):
203-
print("Poorly defined phenology mode 5")
204-
exit(2)
205-
phen_type.append(3)
206-
else:
207-
print("Unknown phenology mode ? {} {} {}".format(evergreen,cold_deciduous,stress_deciduous))
179+
phen_leaf_habit = np.int(fates_params['phen_leaf_habit'].data[ipft])
180+
if(phen_leaf_habit < 1 or phen_leaf_habit > 4):
181+
print("Unknown phenology mode ? {}".format(phen_leaf_habit))
208182
exit(2)
209183

210184

functional_unit_testing/parteh/parteh_controls_phenevents_v2.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@
5757

5858
<parteh_parameters >
5959
<pft_par name="parteh_model "> 1 , 1 , 2 , 2 , 2 </pft_par>
60-
<pft_par name="fates_phen_evergreen "> 1 , 0 , 1 , 0 , 0</pft_par>
61-
<pft_par name="fates_phen_season_decid "> 0 , 1 , 0 , 1 , 1</pft_par>
62-
<pft_par name="fates_phen_stress_decid "> 0 , 0 , 0 , 0 , 0</pft_par>
60+
<pft_par name="fates_phen_leaf_habit "> 1 , 2 , 1 , 2 , 2</pft_par>
6361
<pft_par name="fates_seed_alloc "> 0.2 , 0.2 , 0.2 , 0.2 , 0.2</pft_par>
6462
<pft_par name="fates_seed_alloc_mature "> 0.2 , 0.2, 0.2, 0.2, 0.2 </pft_par>
6563
<pft_par name="fates_dbh_repro_threshold "> 30.0 , 30.0 , 30.0, 30.0 , 30.0 </pft_par>

functional_unit_testing/parteh/parteh_controls_smoketests.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@
5757

5858
<parteh_parameters >
5959
<pft_par name="parteh_model "> 1 , 2 , 2 , 2 , 2 </pft_par>
60-
<pft_par name="fates_phen_evergreen "> 1 , 1 , 1 , 1 , 1</pft_par>
61-
<pft_par name="fates_phen_season_decid "> 0 , 0 , 0 , 0 , 0</pft_par>
62-
<pft_par name="fates_phen_stress_decid "> 0 , 0 , 0 , 0 , 0</pft_par>
60+
<pft_par name="fates_phen_leaf_habit "> 1 , 1 , 1 , 1 , 1</pft_par>
6361
<pft_par name="fates_seed_alloc "> 0.2 , 0.2 , 0.2 , 0.2 , 0.2</pft_par>
6462
<pft_par name="fates_seed_alloc_mature "> 0.2 , 0.2, 0.2, 0.2, 0.2 </pft_par>
6563
<pft_par name="fates_dbh_repro_threshold "> 30.0 , 30.0 , 30.0, 30.0 , 30.0 </pft_par>

functional_unit_testing/parteh/parteh_controls_variable_netc.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
<parteh_parameters >
5757
<pft_par name="parteh_model "> 1 , 2 , 2 </pft_par>
58-
<pft_par name="fates_phen_evergreen "> 1 , 1, 1 </pft_par>
58+
<pft_par name="fates_phen_leaf_habit "> 1 , 1, 1 </pft_par>
5959
<pft_par name="fates_seed_alloc "> 0.2 , 0.2, 0.2 </pft_par>
6060
<pft_par name="fates_seed_alloc_mature "> 0.2 , 0.2 , 0.2 </pft_par>
6161
<pft_par name="fates_dbh_repro_threshold "> 30.0 , 30.0 , 30.0 </pft_par>

main/EDInitMod.F90

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ module EDInitMod
4242
use EDTypesMod , only : init_spread_inventory
4343
use FatesConstantsMod , only : leaves_on
4444
use FatesConstantsMod , only : leaves_off
45+
use FatesConstantsMod , only : ievergreen
46+
use FatesConstantsMod , only : ihard_season_decid
4547
use FatesConstantsMod , only : ihard_stress_decid
4648
use FatesConstantsMod , only : isemi_stress_decid
4749
use PRTGenericMod , only : num_elements
@@ -1200,15 +1202,24 @@ subroutine init_cohorts(site_in, patch_in, bc_in)
12001202
efstem_coh = 1.0_r8
12011203
leaf_status = leaves_on
12021204
else
1203-
! use built-in phenology
1204-
if (prt_params%season_decid(pft) == itrue .and. &
1205-
any(site_in%phen_status(pft) == [phen_cstat_nevercold, phen_cstat_iscold])) then
1206-
! Cold deciduous, off season, assume complete abscission
1207-
efleaf_coh = 0.0_r8
1208-
effnrt_coh = 1.0_r8 - fnrt_drop_fraction
1209-
efstem_coh = 1.0_r8 - stem_drop_fraction
1210-
leaf_status = leaves_off
1211-
else if (any(prt_params%stress_decid(pft) == [ihard_stress_decid, isemi_stress_decid])) then
1205+
! use built-in phenology
1206+
phen_select: select case (prt_params%phen_leaf_habit(pft))
1207+
case (ihard_season_decid)
1208+
select case (site_in%phen_status(pft))
1209+
case (phen_cstat_nevercold, phen_cstat_iscold)
1210+
! Cold deciduous, off season, assume complete abscission
1211+
efleaf_coh = 0.0_r8
1212+
effnrt_coh = 1.0_r8 - fnrt_drop_fraction
1213+
efstem_coh = 1.0_r8 - stem_drop_fraction
1214+
leaf_status = leaves_off
1215+
case default
1216+
! Cold deciduous, growing season, assume leaves fully flushed
1217+
efleaf_coh = 1.0_r8
1218+
effnrt_coh = 1.0_r8
1219+
efstem_coh = 1.0_r8
1220+
leaf_status = leaves_on
1221+
end select
1222+
case (ihard_stress_decid, isemi_stress_decid)
12121223
! If the plant is drought deciduous, make sure leaf status is
12131224
! always consistent with the leaf elongation factor. For tissues
12141225
! other than leaves, the actual drop fraction is a combination of the
@@ -1224,14 +1235,13 @@ subroutine init_cohorts(site_in, patch_in, bc_in)
12241235
else
12251236
leaf_status = leaves_off
12261237
end if
1227-
else
1228-
! Evergreens, or deciduous during growing season
1229-
! Assume leaves fully flushed
1230-
efleaf_coh = 1.0_r8
1231-
effnrt_coh = 1.0_r8
1232-
efstem_coh = 1.0_r8
1233-
leaf_status = leaves_on
1234-
end if
1238+
case (ievergreen)
1239+
! Evergreens, assume leaves fully flushed
1240+
efleaf_coh = 1.0_r8
1241+
effnrt_coh = 1.0_r8
1242+
efstem_coh = 1.0_r8
1243+
leaf_status = leaves_on
1244+
end select phen_select
12351245
end if if_spmode
12361246

12371247
! If positive EDPftvarcon_inst%initd is interpreted as initial recruit density.

0 commit comments

Comments
 (0)