Skip to content

Commit c319e67

Browse files
authored
Merge pull request #1406 from glemieux/api40-parameter-file-merge
API 40 parameter file merge
2 parents fe782ba + be3d397 commit c319e67

22 files changed

+2206
-296
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
@@ -67,6 +67,8 @@ module EDPhysiologyMod
6767
use EDParamsMod , only : nclmax
6868
use EDTypesMod , only : AREA,AREA_INV
6969
use FatesConstantsMod , only : leaves_shedding
70+
use FatesConstantsMod , only : ievergreen
71+
use FatesConstantsMod , only : ihard_season_decid
7072
use FatesConstantsMod , only : ihard_stress_decid
7173
use FatesConstantsMod , only : isemi_stress_decid
7274
use EDParamsMod , only : nlevleaf
@@ -766,20 +768,21 @@ subroutine trim_canopy( currentSite )
766768
sla_levleaf = min(sla_max,prt_params%slatop(ipft)/nscaler_levleaf)
767769

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

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

780-
else !evergreen costs
783+
case (ievergreen) !evergreen costs
781784
pft_leaf_lifespan = leaf_long
782-
end if
785+
end select
783786

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

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

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

1625-
elseif (any(prt_params%stress_decid(ipft) == [ihard_stress_decid,isemi_stress_decid]) ) then ! Drought deciduous
1629+
case (ihard_stress_decid,isemi_stress_decid) ! Drought deciduous
16261630

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

16401644

16411645

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

24232427
end if if_tfs_or_def
2424-
2425-
!set the germination only under the growing season...c.xu
24262428

2427-
if ((prt_params%season_decid(pft) == itrue ) .and. &
2428-
(any(cold_stat == [phen_cstat_nevercold,phen_cstat_iscold]))) then
2429-
! no germination for all PFTs when cold
2430-
litt%seed_germ_in(pft) = 0.0_r8
2431-
endif
2432-
2433-
! Drought deciduous, halt germination when status is shedding, even leaves are not
2434-
! completely abscissed. MLO
2435-
select case (prt_params%stress_decid(pft))
2429+
select case (prt_params%phen_leaf_habit(pft))
2430+
case (ihard_season_decid)
2431+
!set the germination only under the growing season...c.xu
2432+
if (any(cold_stat == [phen_cstat_nevercold,phen_cstat_iscold])) then
2433+
! no germination for all PFTs when cold
2434+
litt%seed_germ_in(pft) = 0.0_r8
2435+
end if
24362436
case (ihard_stress_decid,isemi_stress_decid)
2437+
! Drought deciduous, halt germination when status is shedding, even leaves are not
2438+
! completely abscissed. MLO
24372439
if (any(drought_stat(pft) == [phen_dstat_timeoff,phen_dstat_moistoff,phen_dstat_pshed])) then
24382440
litt%seed_germ_in(pft) = 0.0_r8
24392441
end if
@@ -2542,23 +2544,24 @@ subroutine recruitment(currentSite, currentPatch, bc_in)
25422544
efstem_coh = 1.0_r8
25432545
leaf_status = leaves_on
25442546

2545-
! but if the plant is seasonally (cold) deciduous, and the site status is flagged
2546-
! as "cold", then set the cohort's status to leaves_off, and remember the leaf biomass
2547-
if ((prt_params%season_decid(ft) == itrue) .and. &
2548-
(any(currentSite%cstatus == [phen_cstat_nevercold, phen_cstat_iscold]))) then
2549-
efleaf_coh = 0.0_r8
2550-
effnrt_coh = 1.0_r8 - fnrt_drop_fraction
2551-
efstem_coh = 1.0_r8 - stem_drop_fraction
2552-
leaf_status = leaves_off
2553-
end if
2554-
2555-
! Or.. if the plant is drought deciduous, make sure leaf status is consistent with the
2556-
! leaf elongation factor.
2557-
! For tissues other than leaves, the actual drop fraction is a combination of the
2558-
! elongation factor (e) and the drop fraction (x), which will ensure that the remaining
2559-
! tissue biomass will be exactly e when x=1, and exactly the original biomass when x = 0.
2560-
select case (prt_params%stress_decid(ft))
2547+
! look for cases in which leaves should be off
2548+
select case (prt_params%phen_leaf_habit(ft))
2549+
case (ihard_season_decid)
2550+
select case(currentSite%cstatus)
2551+
case (phen_cstat_nevercold, phen_cstat_iscold)
2552+
! If the plant is seasonally (cold) deciduous, and the site status is flagged
2553+
! as "cold", then set the cohort's status to leaves_off.
2554+
efleaf_coh = 0.0_r8
2555+
effnrt_coh = 1.0_r8 - fnrt_drop_fraction
2556+
efstem_coh = 1.0_r8 - stem_drop_fraction
2557+
leaf_status = leaves_off
2558+
end select
25612559
case (ihard_stress_decid, isemi_stress_decid)
2560+
! If the plant is drought deciduous, make sure leaf status is consistent with the
2561+
! leaf elongation factor.
2562+
! For tissues other than leaves, the actual drop fraction is a combination of the
2563+
! elongation factor (e) and the drop fraction (x), which will ensure that the remaining
2564+
! tissue biomass will be exactly e when x=1, and exactly the original biomass when x = 0.
25622565
efleaf_coh = currentSite%elong_factor(ft)
25632566
effnrt_coh = 1.0_r8 - (1.0_r8 - efleaf_coh)*fnrt_drop_fraction
25642567
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: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ module EDInitMod
4141
use EDTypesMod , only : init_spread_inventory
4242
use FatesConstantsMod , only : leaves_on
4343
use FatesConstantsMod , only : leaves_off
44+
use FatesConstantsMod , only : ievergreen
45+
use FatesConstantsMod , only : ihard_season_decid
4446
use FatesConstantsMod , only : ihard_stress_decid
4547
use FatesConstantsMod , only : isemi_stress_decid
4648
use PRTGenericMod , only : num_elements
@@ -1143,15 +1145,23 @@ subroutine init_cohorts(site_in, patch_in, bc_in)
11431145
efstem_coh = 1.0_r8
11441146
leaf_status = leaves_on
11451147
else
1146-
! use built-in phenology
1147-
if (prt_params%season_decid(pft) == itrue .and. &
1148-
any(site_in%cstatus == [phen_cstat_nevercold, phen_cstat_iscold])) then
1149-
! Cold deciduous, off season, assume complete abscission
1150-
efleaf_coh = 0.0_r8
1151-
effnrt_coh = 1.0_r8 - fnrt_drop_fraction
1152-
efstem_coh = 1.0_r8 - stem_drop_fraction
1153-
leaf_status = leaves_off
1154-
else if (any(prt_params%stress_decid(pft) == [ihard_stress_decid, isemi_stress_decid])) then
1148+
! use built-in phenology
1149+
phen_select: select case (prt_params%phen_leaf_habit(pft))
1150+
case (ihard_season_decid)
1151+
if ( any(site_in%cstatus == [phen_cstat_nevercold, phen_cstat_iscold]) ) then
1152+
! Cold deciduous, off season, assume complete abscission
1153+
efleaf_coh = 0.0_r8
1154+
effnrt_coh = 1.0_r8 - fnrt_drop_fraction
1155+
efstem_coh = 1.0_r8 - stem_drop_fraction
1156+
leaf_status = leaves_off
1157+
else
1158+
! Cold deciduous, growing season, assume leaves fully flushed
1159+
efleaf_coh = 1.0_r8
1160+
effnrt_coh = 1.0_r8
1161+
efstem_coh = 1.0_r8
1162+
leaf_status = leaves_on
1163+
end if
1164+
case (ihard_stress_decid, isemi_stress_decid)
11551165
! If the plant is drought deciduous, make sure leaf status is
11561166
! always consistent with the leaf elongation factor. For tissues
11571167
! other than leaves, the actual drop fraction is a combination of the
@@ -1167,14 +1177,13 @@ subroutine init_cohorts(site_in, patch_in, bc_in)
11671177
else
11681178
leaf_status = leaves_off
11691179
end if
1170-
else
1171-
! Evergreens, or deciduous during growing season
1172-
! Assume leaves fully flushed
1173-
efleaf_coh = 1.0_r8
1174-
effnrt_coh = 1.0_r8
1175-
efstem_coh = 1.0_r8
1176-
leaf_status = leaves_on
1177-
end if
1180+
case (ievergreen)
1181+
! Evergreens, assume leaves fully flushed
1182+
efleaf_coh = 1.0_r8
1183+
effnrt_coh = 1.0_r8
1184+
efstem_coh = 1.0_r8
1185+
leaf_status = leaves_on
1186+
end select phen_select
11781187
end if if_spmode
11791188

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

0 commit comments

Comments
 (0)