Skip to content

Commit

Permalink
Conflict resolutions for phenology refactor. Most related to saving a…
Browse files Browse the repository at this point in the history
…nd tracking number of chilling and number of cold days
  • Loading branch information
rgknox committed Apr 11, 2019
2 parents 9f034f2 + 82498d5 commit 3c1f3e6
Show file tree
Hide file tree
Showing 26 changed files with 2,915 additions and 5,039 deletions.
517 changes: 323 additions & 194 deletions biogeochem/EDCanopyStructureMod.F90

Large diffs are not rendered by default.

209 changes: 171 additions & 38 deletions biogeochem/EDCohortDynamicsMod.F90

Large diffs are not rendered by default.

22 changes: 17 additions & 5 deletions biogeochem/EDLoggingMortalityMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ subroutine IsItLoggingTime(is_master,currentSite)

else if(icode < 0 .and. icode > -366) then
! Logging event every year on specific day of year
if(hlm_day_of_year .eq. icode ) then
if(hlm_day_of_year .eq. abs(icode) ) then
logging_time = .true.
end if

Expand Down Expand Up @@ -151,14 +151,20 @@ end subroutine IsItLoggingTime

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

subroutine LoggingMortality_frac( pft_i, dbh, lmort_direct,lmort_collateral,lmort_infra )
subroutine LoggingMortality_frac( pft_i, dbh, canopy_layer, lmort_direct, &
lmort_collateral, lmort_infra, l_degrad )

! Arguments
integer, intent(in) :: pft_i ! pft index
real(r8), intent(in) :: dbh ! diameter at breast height (cm)
integer, intent(in) :: canopy_layer ! canopy layer of this cohort
real(r8), intent(out) :: lmort_direct ! direct (harvestable) mortality fraction
real(r8), intent(out) :: lmort_collateral ! collateral damage mortality fraction
real(r8), intent(out) :: lmort_infra ! infrastructure mortality fraction
real(r8), intent(out) :: l_degrad ! fraction of trees that are not killed
! but suffer from forest degradation (i.e. they
! are moved to newly-anthro-disturbed secondary
! forest patch)

! Parameters
real(r8), parameter :: adjustment = 1.0 ! adjustment for mortality rates
Expand All @@ -170,31 +176,37 @@ subroutine LoggingMortality_frac( pft_i, dbh, lmort_direct,lmort_collateral,lmor

if (dbh >= logging_dbhmin ) then
lmort_direct = logging_direct_frac * adjustment
lmort_collateral = logging_collateral_frac * adjustment
l_degrad = 0._r8
else
lmort_direct = 0.0_r8
lmort_collateral = 0.0_r8
l_degrad = logging_direct_frac * adjustment
end if

if (dbh >= logging_dbhmax_infra) then
lmort_infra = 0.0_r8
l_degrad = l_degrad + logging_mechanical_frac * adjustment
else
lmort_infra = logging_mechanical_frac * adjustment
end if
!damage rates for size class < & > threshold_size need to be specified seperately

! Collateral damage to smaller plants below the direct logging size threshold
! Collateral damage to smaller plants below the canopy layer
! will be applied via "understory_death" via the disturbance algorithm
if (canopy_layer .eq. 1) then
lmort_collateral = logging_collateral_frac * adjustment
endif

else
lmort_direct = 0.0_r8
lmort_collateral = 0.0_r8
lmort_infra = 0.0_r8
l_degrad = 0.0_r8
end if
else
lmort_direct = 0.0_r8
lmort_collateral = 0.0_r8
lmort_infra = 0.0_r8
l_degrad = 0.0_r8
end if

end subroutine LoggingMortality_frac
Expand Down
5 changes: 3 additions & 2 deletions biogeochem/EDMortalityFunctionsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,11 @@ subroutine Mortality_Derivative( currentSite, currentCohort, bc_in)
! Mortality for trees in the understorey.
!if trees are in the canopy, then their death is 'disturbance'. This probably needs a different terminology
call mortality_rates(currentCohort,bc_in,cmort,hmort,bmort,frmort)
call LoggingMortality_frac(ipft, currentCohort%dbh, &
call LoggingMortality_frac(ipft, currentCohort%dbh, currentCohort%canopy_layer, &
currentCohort%lmort_direct, &
currentCohort%lmort_collateral, &
currentCohort%lmort_infra )
currentCohort%lmort_infra, &
currentCohort%l_degrad)

if (currentCohort%canopy_layer > 1)then

Expand Down
1,247 changes: 731 additions & 516 deletions biogeochem/EDPatchDynamicsMod.F90

Large diffs are not rendered by default.

29 changes: 11 additions & 18 deletions biogeochem/EDPhysiologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ module EDPhysiologyMod

use EDTypesMod , only : numWaterMem
use EDTypesMod , only : dl_sf, dinc_ed
use EDTypesMod , only : external_recruitment
use EDTypesMod , only : ncwd
use EDTypesMod , only : nlevleaf
use EDTypesMod , only : num_vegtemp_mem
Expand Down Expand Up @@ -60,7 +59,6 @@ module EDPhysiologyMod
use FatesAllometryMod , only : bbgw_allom
use FatesAllometryMod , only : carea_allom
use FatesAllometryMod , only : CheckIntegratedAllometries
use FatesAllometryMod , only : StructureResetOfDH

use PRTGenericMod, only : prt_carbon_allom_hyp
use PRTGenericMod, only : leaf_organ
Expand Down Expand Up @@ -259,7 +257,8 @@ subroutine trim_canopy( currentSite )

currentCohort%treesai = tree_sai(currentCohort%pft, currentCohort%dbh, currentCohort%canopy_trim, &
currentCohort%c_area, currentCohort%n, currentCohort%canopy_layer, &
currentPatch%canopy_layer_tlai, currentCohort%treelai,currentCohort%vcmax25top )
currentPatch%canopy_layer_tlai, currentCohort%treelai, &
currentCohort%vcmax25top,0 )

currentCohort%nv = ceiling((currentCohort%treelai+currentCohort%treesai)/dinc_ed)

Expand Down Expand Up @@ -475,17 +474,17 @@ subroutine phenology( currentSite, bc_in )
! in the late autumn.
! This value is used to determine the GDD exceedance threshold
if (hlm_day_of_year == ncdstart)then
currentSite%ncd = 0
currentSite%nchilldays = 0
endif

!Accumulate growing/chilling days after start of counting period
if (temp_in_C < ED_val_phen_chiltemp)then
currentSite%ncd = currentSite%ncd + 1
currentSite%nchilldays = currentSite%nchilldays + 1
endif

!GDD accumulation function, which also depends on chilling days.
! -68 + 638 * (-0.001 * ncd)
gdd_threshold = ED_val_phen_a + ED_val_phen_b*exp(ED_val_phen_c*real(currentSite%ncd,r8))
gdd_threshold = ED_val_phen_a + ED_val_phen_b*exp(ED_val_phen_c*real(currentSite%nchilldays,r8))

!Accumulate temperature of last 10 days.
currentSite%vegtemp_memory(2:num_vegtemp_mem) = currentSite%vegtemp_memory(1:num_vegtemp_mem-1)
Expand Down Expand Up @@ -539,7 +538,7 @@ subroutine phenology( currentSite, bc_in )

if ( (currentSite%cstatus == 1 .or. currentSite%cstatus == 0) .and. &
(currentSite%grow_deg_days > gdd_threshold) .and. &
(currentSite%ncd >= 1) .and. &
(currentSite%nchilldays >= 1) .and. &
(dayssincecleafoff > ED_val_phen_mindayson)) then
currentSite%cstatus = 2 !alter status of site to 'leaves on'
currentSite%cleafondate = model_day_int
Expand Down Expand Up @@ -575,7 +574,7 @@ subroutine phenology( currentSite, bc_in )

! LEAF OFF: COLD LIFESPAN THRESHOLD
! NOTE: Some areas of the planet will never generate a cold day
! and thus %ncd will never go from zero to 1. The following logic
! and thus %nchilldays will never go from zero to 1. The following logic
! when coupled with this fact will essentially prevent cold-deciduous
! plants from re-emerging in areas without at least some cold days

Expand Down Expand Up @@ -965,20 +964,14 @@ subroutine seeds_in( currentSite, cp_pnt )

endif

currentPatch => currentSite%oldest_patch

do while(associated(currentPatch))
if (external_recruitment == 1) then !external seed rain - needed to prevent extinction
do p = 1,numpft
currentPatch%seeds_in(p) = currentPatch%seeds_in(p) + &
do p = 1,numpft
currentPatch%seeds_in(p) = currentPatch%seeds_in(p) + &
EDPftvarcon_inst%seed_rain(p) !KgC/m2/year
currentSite%seed_rain_flux(p) = currentSite%seed_rain_flux(p) + &
currentSite%seed_rain_flux(p) = currentSite%seed_rain_flux(p) + &
EDPftvarcon_inst%seed_rain(p) * currentPatch%area/AREA !KgC/m2/year
enddo
endif
currentPatch => currentPatch%younger
enddo


end subroutine seeds_in

! ============================================================================
Expand Down
Loading

0 comments on commit 3c1f3e6

Please sign in to comment.