Skip to content

Commit 363aaff

Browse files
committed
Merged with phenology updates. Resolved conflict on parameter file.
2 parents 8fbe5b2 + d2f0907 commit 363aaff

File tree

10 files changed

+668
-390
lines changed

10 files changed

+668
-390
lines changed

biogeochem/EDPhysiologyMod.F90

Lines changed: 274 additions & 178 deletions
Large diffs are not rendered by default.

main/EDInitMod.F90

Lines changed: 68 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module EDInitMod
77
use FatesConstantsMod , only : r8 => fates_r8
88
use FatesConstantsMod , only : ifalse
99
use FatesConstantsMod , only : itrue
10+
use FatesConstantsMod , only : fates_unset_int
1011
use FatesConstantsMod , only : primaryforest
1112
use FatesGlobals , only : endrun => fates_endrun
1213
use EDTypesMod , only : nclmax
@@ -17,14 +18,21 @@ module EDInitMod
1718
use EDPatchDynamicsMod , only : create_patch
1819
use EDTypesMod , only : ed_site_type, ed_patch_type, ed_cohort_type
1920
use EDTypesMod , only : ncwd
20-
use EDTypesMod , only : nuMWaterMem
21+
use EDTypesMod , only : numWaterMem
22+
use EDTypesMod , only : num_vegtemp_mem
2123
use EDTypesMod , only : maxpft
2224
use EDTypesMod , only : AREA
2325
use EDTypesMod , only : init_spread_near_bare_ground
2426
use EDTypesMod , only : init_spread_inventory
2527
use EDTypesMod , only : first_leaf_aclass
2628
use EDTypesMod , only : leaves_on
2729
use EDTypesMod , only : leaves_off
30+
use EDTypesMod , only : phen_cstat_nevercold
31+
use EDTypesMod , only : phen_cstat_iscold
32+
use EDTypesMod , only : phen_dstat_timeoff
33+
use EDTypesMod , only : phen_dstat_moistoff
34+
use EDTypesMod , only : phen_cstat_notcold
35+
use EDTypesMod , only : phen_dstat_moiston
2836
use FatesInterfaceMod , only : bc_in_type
2937
use FatesInterfaceMod , only : hlm_use_planthydro
3038
use FatesInterfaceMod , only : hlm_use_inventory_init
@@ -110,17 +118,18 @@ subroutine zero_site( site_in )
110118
site_in%total_burn_flux_to_atm = 0._r8
111119

112120
! PHENOLOGY
113-
site_in%is_cold = .false. ! Is cold deciduous leaf-off triggered?
114-
site_in%is_drought = .false. ! Is drought deciduous leaf-off triggered?
115-
site_in%ED_GDD_site = nan ! growing degree days
116-
site_in%ncd = nan ! no chilling days
117-
site_in%last_n_days(:) = 999 ! record of last 10 days temperature for senescence model.
118-
site_in%leafondate = 999 ! doy of leaf on
119-
site_in%leafoffdate = 999 ! doy of leaf off
120-
site_in%dleafondate = 999 ! doy of leaf on drought
121-
site_in%dleafoffdate = 999 ! doy of leaf on drought
122-
site_in%water_memory(:) = nan
123121

122+
site_in%cstatus = fates_unset_int ! are leaves in this pixel on or off?
123+
site_in%dstatus = fates_unset_int
124+
site_in%grow_deg_days = nan ! growing degree days
125+
site_in%nchilldays = fates_unset_int
126+
site_in%ncolddays = fates_unset_int
127+
site_in%cleafondate = fates_unset_int ! doy of leaf on
128+
site_in%cleafoffdate = fates_unset_int ! doy of leaf off
129+
site_in%dleafondate = fates_unset_int ! doy of leaf on drought
130+
site_in%dleafoffdate = fates_unset_int ! doy of leaf on drought
131+
site_in%water_memory(:) = nan
132+
site_in%vegtemp_memory(:) = nan ! record of last 10 days temperature for senescence model.
124133

125134
! SEED
126135
site_in%seed_bank(:) = 0._r8
@@ -185,66 +194,61 @@ subroutine set_site_properties( nsites, sites)
185194
!
186195
! !LOCAL VARIABLES:
187196
integer :: s
188-
real(r8) :: leafon
189-
real(r8) :: leafoff
190-
logical :: stat
191-
real(r8) :: NCD
197+
integer :: cstat ! cold status phenology flag
192198
real(r8) :: GDD
193-
logical :: dstat
199+
integer :: dstat ! drought status phenology flag
194200
real(r8) :: acc_NI
195-
real(r8) :: watermem
196-
integer :: dleafoff
197-
integer :: dleafon
201+
real(r8) :: watermem
202+
integer :: cleafon ! DOY for cold-decid leaf-on, initial guess
203+
integer :: cleafoff ! DOY for cold-decid leaf-off, initial guess
204+
integer :: dleafoff ! DOY for drought-decid leaf-off, initial guess
205+
integer :: dleafon ! DOY for drought-decid leaf-on, initial guess
198206
!----------------------------------------------------------------------
199207

200-
if ( hlm_is_restart == ifalse ) then
201-
!initial guess numbers for site condition.
202-
NCD = 0.0_r8
203-
GDD = 30.0_r8
204-
leafon = 100.0_r8
205-
leafoff = 300.0_r8
206-
stat = .false.
207-
acc_NI = 0.0_r8
208-
dstat = .false.
209-
dleafoff = 300
210-
dleafon = 100
211-
watermem = 0.5_r8
212208

213-
else ! assignements for restarts
209+
! If this is not a restart, we need to start with some reasonable
210+
! starting points. If this is a restart, we leave the values
211+
! as unset ints and reals, and let the restart values be read in
212+
! after this routine
213+
214+
if ( hlm_is_restart == ifalse ) then
214215

215-
NCD = 1.0_r8 ! NCD should be 1 on restart
216-
GDD = 0.0_r8
217-
leafon = 0.0_r8
218-
leafoff = 0.0_r8
219-
stat = .false.
216+
GDD = 30.0_r8
217+
cleafon = 100
218+
cleafoff = 300
219+
cstat = phen_cstat_notcold ! Leaves are on
220220
acc_NI = 0.0_r8
221-
dstat = .false.
221+
dstat = phen_dstat_moiston ! Leaves are on
222222
dleafoff = 300
223223
dleafon = 100
224224
watermem = 0.5_r8
225225

226-
endif
227-
228-
do s = 1,nsites
229-
sites(s)%ncd = NCD
230-
sites(s)%leafondate = leafon
231-
sites(s)%leafoffdate = leafoff
232-
sites(s)%dleafoffdate = dleafoff
233-
sites(s)%dleafondate = dleafon
234-
sites(s)%ED_GDD_site = GDD
235-
236-
if ( hlm_is_restart == ifalse ) then
226+
do s = 1,nsites
227+
sites(s)%nchilldays = 0
228+
sites(s)%ncolddays = 0 ! recalculated in phenology
229+
! immediately, so yes this
230+
! is memory-less, but needed
231+
! for first value in history file
232+
233+
sites(s)%cleafondate = cleafon
234+
sites(s)%cleafoffdate = cleafoff
235+
sites(s)%dleafoffdate = dleafoff
236+
sites(s)%dleafondate = dleafon
237+
sites(s)%grow_deg_days = GDD
238+
237239
sites(s)%water_memory(1:numWaterMem) = watermem
238-
end if
239-
240-
sites(s)%is_cold = stat
241-
sites(s)%is_drought = dstat
242-
243-
sites(s)%acc_NI = acc_NI
244-
sites(s)%frac_burnt = 0.0_r8
245-
sites(s)%old_stock = 0.0_r8
246-
247-
end do
240+
sites(s)%vegtemp_memory(1:num_vegtemp_mem) = 0._r8
241+
242+
sites(s)%cstatus = cstat
243+
sites(s)%dstatus = dstat
244+
245+
sites(s)%acc_NI = acc_NI
246+
sites(s)%frac_burnt = 0.0_r8
247+
sites(s)%old_stock = 0.0_r8
248+
249+
end do
250+
251+
end if
248252

249253
return
250254
end subroutine set_site_properties
@@ -439,13 +443,15 @@ subroutine init_cohorts( site_in, patch_in, bc_in)
439443
temp_cohort%laimemory = 0._r8
440444
cstatus = leaves_on
441445

442-
if( EDPftvarcon_inst%season_decid(pft) == itrue .and. site_in%is_cold ) then
446+
if( EDPftvarcon_inst%season_decid(pft) == itrue .and. &
447+
any(site_in%cstatus == [phen_cstat_nevercold,phen_cstat_iscold])) then
443448
temp_cohort%laimemory = b_leaf
444449
b_leaf = 0._r8
445450
cstatus = leaves_off
446451
endif
447-
448-
if ( EDPftvarcon_inst%stress_decid(pft) == itrue .and. site_in%is_drought ) then
452+
453+
if ( EDPftvarcon_inst%stress_decid(pft) == itrue .and. &
454+
any(site_in%dstatus == [phen_dstat_timeoff,phen_dstat_moistoff])) then
449455
temp_cohort%laimemory = b_leaf
450456
b_leaf = 0._r8
451457
cstatus = leaves_off

main/EDMainMod.F90

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ module EDMainMod
4242
use EDtypesMod , only : ed_patch_type
4343
use EDtypesMod , only : ed_cohort_type
4444
use EDTypesMod , only : AREA
45+
use EDTypesMod , only : phen_dstat_moiston
46+
use EDTypesMod , only : phen_dstat_timeon
4547
use FatesConstantsMod , only : itrue,ifalse
4648
use FatesConstantsMod , only : primaryforest, secondaryforest
4749
use FatesPlantHydraulicsMod , only : do_growthrecruiteffects
@@ -270,6 +272,7 @@ subroutine ed_integrate_state_variables(currentSite, bc_in )
270272
real(r8) :: cohort_biomass_store ! remembers the biomass in the cohort for balance checking
271273
real(r8) :: dbh_old ! dbh of plant before daily PRT [cm]
272274
real(r8) :: hite_old ! height of plant before daily PRT [m]
275+
logical :: is_drought ! logical for if the plant (site) is in a drought state
273276
real(r8) :: leaf_c
274277
real(r8) :: delta_dbh ! correction for dbh
275278
real(r8) :: delta_hite ! correction for hite
@@ -361,9 +364,13 @@ subroutine ed_integrate_state_variables(currentSite, bc_in )
361364

362365

363366
! Conduct Maintenance Turnover (parteh)
364-
365367
call currentCohort%prt%CheckMassConservation(ft,3)
366-
call PRTMaintTurnover(currentCohort%prt,ft,currentSite%is_drought)
368+
if(any(currentSite%dstatus == [phen_dstat_moiston,phen_dstat_timeon])) then
369+
is_drought = .false.
370+
else
371+
is_drought = .true.
372+
end if
373+
call PRTMaintTurnover(currentCohort%prt,ft,is_drought)
367374
call currentCohort%prt%CheckMassConservation(ft,4)
368375

369376
leaf_c = currentCohort%prt%GetState(leaf_organ, all_carbon_elements)
@@ -750,8 +757,8 @@ subroutine bypass_dynamics(currentSite)
750757
currentCohort%frmort = 0.0_r8
751758

752759
currentCohort%dndt = 0.0_r8
753-
currentCohort%dhdt = 0.0_r8
754-
currentCohort%ddbhdt = 0.0_r8
760+
currentCohort%dhdt = 0.0_r8
761+
currentCohort%ddbhdt = 0.0_r8
755762

756763
currentCohort => currentCohort%taller
757764
enddo

main/EDTypesMod.F90

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ module EDTypesMod
7676

7777
integer, parameter :: leaves_on = 2 ! Flag specifying that a deciduous plant has leaves
7878
! and should be allocating to them as well
79+
7980
integer, parameter :: leaves_off = 1 ! Flag specifying that a deciduous plant has dropped
8081
! its leaves and should not be trying to allocate
8182
! towards any growth.
@@ -107,14 +108,28 @@ module EDTypesMod
107108
integer, parameter :: numWaterMem = 10 ! watermemory saved as site level var
108109

109110
! BIOLOGY/BIOGEOCHEMISTRY
110-
integer , parameter :: SENES = 10 ! Window of time over which we track temp for cold sensecence (days)
111+
integer , parameter :: num_vegtemp_mem = 10 ! Window of time over which we track temp for cold sensecence (days)
111112
real(r8), parameter :: dinc_ed = 1.0_r8 ! size of VAI bins (LAI+SAI) [CHANGE THIS NAME WITH NEXT INTERFACE
112113
! UPDATE]
113114
integer , parameter :: N_DIST_TYPES = 3 ! Disturbance Modes 1) tree-fall, 2) fire, 3) logging
114115
integer , parameter :: dtype_ifall = 1 ! index for naturally occuring tree-fall generated event
115116
integer , parameter :: dtype_ifire = 2 ! index for fire generated disturbance event
116117
integer , parameter :: dtype_ilog = 3 ! index for logging generated disturbance event
117118

119+
120+
! Phenology status flag definitions (cold type is cstat, dry type is dstat)
121+
122+
integer, parameter :: phen_cstat_nevercold = 0 ! This (location/plant) has not experienced a cold period over a large number
123+
! of days, leaves are dropped and flagged as non-cold region
124+
integer, parameter :: phen_cstat_iscold = 1 ! This (location/plant) is in a cold-state where leaves should have fallen
125+
integer, parameter :: phen_cstat_notcold = 2 ! This site is in a warm-state where leaves are allowed to flush
126+
127+
integer, parameter :: phen_dstat_timeoff = 0 ! Leaves off due to time exceedance (drought phenology)
128+
integer, parameter :: phen_dstat_moistoff = 1 ! Leaves off due to moisture avail (drought phenology)
129+
integer, parameter :: phen_dstat_moiston = 2 ! Leaves on due to moisture avail (drought phenology)
130+
integer, parameter :: phen_dstat_timeon = 3 ! Leaves on due to time exceedance (drought phenology)
131+
132+
118133
! SPITFIRE
119134
integer, parameter :: NCWD = 4 ! number of coarse woody debris pools (twig,s branch,l branch, trunk)
120135
integer , parameter :: NFSC = NCWD+2 ! number fuel size classes (4 cwd size classes, leaf litter, and grass)
@@ -611,15 +626,26 @@ module EDTypesMod
611626

612627

613628
! PHENOLOGY
614-
real(r8) :: ED_GDD_site ! ED Phenology growing degree days.
615-
logical :: is_cold ! is this site/column in a cold-status where its cohorts drop leaves?
616-
logical :: is_drought ! is this site/column in a drought-status where its cohorts drop leaves?
617-
real(r8) :: ncd ! no chilling days:-
618-
real(r8) :: last_n_days(senes) ! record of last 10 days temperature for senescence model. deg C
619-
integer :: leafondate ! doy of leaf on:-
620-
integer :: leafoffdate ! doy of leaf off:-
621-
integer :: dleafondate ! doy of leaf on drought:-
622-
integer :: dleafoffdate ! doy of leaf on drought:-
629+
real(r8) :: grow_deg_days ! Phenology growing degree days
630+
631+
integer :: cstatus ! are leaves in this pixel on or off for cold decid
632+
! 0 = this site has not experienced a cold period over at least
633+
! 400 days, leaves are dropped and flagged as non-cold region
634+
! 1 = this site is in a cold-state where leaves should have fallen
635+
! 2 = this site is in a warm-state where leaves are allowed to flush
636+
integer :: dstatus ! are leaves in this pixel on or off for drought decid
637+
! 0 = leaves off due to time exceedance
638+
! 1 = leaves off due to moisture avail
639+
! 2 = leaves on due to moisture avail
640+
! 3 = leaves on due to time exceedance
641+
integer :: nchilldays ! num chilling days: (for botta gdd trheshold calculation)
642+
integer :: ncolddays ! num cold days: (must exceed threshold to drop leaves)
643+
real(r8) :: vegtemp_memory(num_vegtemp_mem) ! record of last 10 days temperature for senescence model. deg C
644+
integer :: cleafondate ! model date (day integer) of leaf on (cold):-
645+
integer :: cleafoffdate ! model date (day integer) of leaf off (cold):-
646+
integer :: dleafondate ! model date (day integer) of leaf on drought:-
647+
integer :: dleafoffdate ! model date (day integer) of leaf off drought:-
648+
623649
real(r8) :: water_memory(numWaterMem) ! last 10 days of soil moisture memory...
624650

625651
!SEED BANK

main/FatesConstantsMod.F90

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ module FatesConstantsMod
1515
integer, parameter :: fates_short_string_length = 32
1616
integer, parameter :: fates_long_string_length = 199
1717

18-
! Unset and various other 'special' values
18+
! Used to initialize and test unset integers
1919
integer, parameter :: fates_unset_int = -9999
20-
real(fates_r8), parameter :: fates_unset_r8 = -9999._fates_r8
21-
20+
21+
! Used to initialize and test unset r8s
22+
real(fates_r8), parameter :: fates_unset_r8 = -1.e36_fates_r8
23+
2224
! Integer equivalent of true (in case some compilers dont auto convert)
2325
integer, parameter :: itrue = 1
2426

0 commit comments

Comments
 (0)