Skip to content

Commit

Permalink
Merge pull request #1 from glemieux/rgknox-fix-10day-phen
Browse files Browse the repository at this point in the history
Updates to PR NGEET#468 (phenology status timers)
  • Loading branch information
rgknox authored Apr 16, 2019
2 parents 3c1f3e6 + b96f529 commit e1d278f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
27 changes: 14 additions & 13 deletions biogeochem/EDPhysiologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ module EDPhysiologyMod
integer, parameter :: i_cdead = 6 ! Array index associated with structural carbon
integer, parameter :: i_crepro = 7 ! Array index associated with reproductive carbon
integer, parameter :: n_cplantpools = 7 ! Size of the carbon only integration framework
integer, parameter :: dleafon_drycheck = 100 ! Drought deciduous leaves max days on check parameter

! ============================================================================

Expand Down Expand Up @@ -566,7 +567,7 @@ subroutine phenology( currentSite, bc_in )
! first flush, but if we dont
! clear this value, it will cause
! leaves to flush later in the year
currentSite%cstatus = 1 ! alter status of site to 'leaves on'
currentSite%cstatus = 1 ! alter status of site to 'leaves off'
currentSite%cleafoffdate = model_day_int ! record leaf off date

if ( debug ) write(fates_log(),*) 'leaves off'
Expand Down Expand Up @@ -718,7 +719,7 @@ subroutine phenology( currentSite, bc_in )
if ( (currentSite%dstatus == 2 .or. currentSite%dstatus == 3 ) .and. &
(model_day_int > numWaterMem) .and. &
(mean_10day_liqvol <= ED_val_phen_drought_threshold) .and. &
(dayssincedleafon > 100 ) ) then
(dayssincedleafon > dleafon_drycheck ) ) then
currentSite%dstatus = 1 ! alter status of site to 'leaves off'
currentSite%dleafoffdate = model_day_int ! record leaf on date
endif
Expand Down Expand Up @@ -770,7 +771,7 @@ subroutine phenology_leafonoff(currentSite)
! for leaves. Time to signal flushing

if (EDPftvarcon_inst%season_decid(ipft) == 1)then
if ( currentSite%cstatus > 1 )then ! we have just moved to leaves being on .
if ( currentSite%cstatus == 2 )then ! we have just moved to leaves being on .
if (currentCohort%status_coh == leaves_off)then ! Are the leaves currently off?
currentCohort%status_coh = leaves_on ! Leaves are on, so change status to
! stop flow of carbon out of bstore.
Expand All @@ -793,7 +794,7 @@ subroutine phenology_leafonoff(currentSite)

!COLD LEAF OFF
if (currentSite%cstatus == 1 .or. currentSite%cstatus == 0)then !past leaf drop day? Leaves still on tree?
if (currentCohort%status_coh == 2)then ! leaves have not dropped
if (currentCohort%status_coh == leaves_on)then ! leaves have not dropped


! This sets the cohort to the "leaves off" flag
Expand Down Expand Up @@ -851,7 +852,7 @@ subroutine phenology_leafonoff(currentSite)

!DROUGHT LEAF OFF
if (currentSite%dstatus == 1 .or. currentSite%dstatus == 0)then
if (currentCohort%status_coh == 2)then ! leaves have not dropped
if (currentCohort%status_coh == leaves_on)then ! leaves have not dropped

! This sets the cohort to the "leaves off" flag
currentCohort%status_coh = leaves_off
Expand Down Expand Up @@ -1030,12 +1031,12 @@ subroutine seed_germination( currentSite, currentPatch )
currentPatch%seed_germination(p) = min(currentSite%seed_bank(p) * &
EDPftvarcon_inst%germination_timescale(p),max_germination)
!set the germination only under the growing season...c.xu
if ( (EDPftvarcon_inst%season_decid(p) == 1) .and. &
(currentSite%cstatus <= 1)) then
if ( (EDPftvarcon_inst%season_decid(p) == itrue) .and. &
(any(currentSite%cstatus == [0,1]))) then
currentPatch%seed_germination(p) = 0.0_r8
endif
if ( (EDPftvarcon_inst%stress_decid(p) == 1) .and. &
(currentSite%dstatus <= 1)) then
if ( (EDPftvarcon_inst%stress_decid(p) == itrue) .and. &
(any(currentSite%dstatus == [0,1]))) then
currentPatch%seed_germination(p) = 0.0_r8
endif
enddo
Expand Down Expand Up @@ -1095,15 +1096,15 @@ subroutine recruitment( currentSite, currentPatch, bc_in )
cohortstatus = leaves_on
temp_cohort%laimemory = 0.0_r8

if ( (EDPftvarcon_inst%season_decid(temp_cohort%pft) == 1) .and. &
(currentSite%cstatus <= 1)) then
if ( (EDPftvarcon_inst%season_decid(temp_cohort%pft) == itrue) .and. &
(any(currentSite%cstatus == [0,1]))) then
temp_cohort%laimemory = b_leaf
b_leaf = 0.0_r8
cohortstatus = leaves_off
endif

if ( (EDPftvarcon_inst%stress_decid(temp_cohort%pft) == 1) .and. &
(currentSite%dstatus <= 1)) then
if ( (EDPftvarcon_inst%stress_decid(temp_cohort%pft) == itrue) .and. &
(any(currentSite%dstatus == [0,1]))) then
temp_cohort%laimemory = b_leaf
b_leaf = 0.0_r8
cohortstatus = leaves_off
Expand Down
8 changes: 4 additions & 4 deletions main/EDInitMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ subroutine set_site_properties( nsites, sites)
integer :: dstat ! drought status phenology flag
real(r8) :: acc_NI
real(r8) :: watermem
real(r8) :: cleafon ! DOY for cold-decid leaf-on, initial guess
real(r8) :: cleafoff ! DOY for cold-decid leaf-off, initial guess
integer :: cleafon ! DOY for cold-decid leaf-on, initial guess
integer :: cleafoff ! DOY for cold-decid leaf-off, initial guess
integer :: dleafoff ! DOY for drought-decid leaf-off, initial guess
integer :: dleafon ! DOY for drought-decid leaf-on, initial guess
!----------------------------------------------------------------------
Expand All @@ -208,8 +208,8 @@ subroutine set_site_properties( nsites, sites)
if ( hlm_is_restart == ifalse ) then

GDD = 30.0_r8
cleafon = 100.0_r8
cleafoff = 300.0_r8
cleafon = 100
cleafoff = 300
cstat = 2 ! Leaves are on
acc_NI = 0.0_r8
dstat = 2 ! Leaves are on
Expand Down
2 changes: 1 addition & 1 deletion main/EDTypesMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ module EDTypesMod
integer :: cleafondate ! model date (day integer) of leaf on (cold):-
integer :: cleafoffdate ! model date (day integer) of leaf off (cold):-
integer :: dleafondate ! model date (day integer) of leaf on drought:-
integer :: dleafoffdate ! model date (day integer) of leaf on drought:-
integer :: dleafoffdate ! model date (day integer) of leaf off drought:-

real(r8) :: water_memory(numWaterMem) ! last 10 days of soil moisture memory...

Expand Down
1 change: 0 additions & 1 deletion main/FatesHistoryInterfaceMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,6 @@ subroutine set_history_var(this, vname, units, long, use_default, avgflag, vtype
! locals
integer :: ub1, lb1, ub2, lb2 ! Bounds for allocating the var
integer :: ityp
integer :: nonfates ! non-optional

logical :: write_var

Expand Down

0 comments on commit e1d278f

Please sign in to comment.