Skip to content

Commit

Permalink
Merge branch 'master' into hieight_based_sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
ckoven committed Dec 20, 2018
2 parents 143ab36 + 52894bd commit 10a0b83
Show file tree
Hide file tree
Showing 15 changed files with 2,422 additions and 1,007 deletions.
20 changes: 17 additions & 3 deletions biogeochem/EDPatchDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1145,14 +1145,20 @@ subroutine mortality_litter_fluxes(currentSite, cp_target, new_patch_target, pat
!not right to recalcualte dmort here.
canopy_dead = currentCohort%n * min(1.0_r8,currentCohort%dmort * hlm_freq_day * fates_mortality_disturbance_fraction)



canopy_mortality_woody_litter(p)= canopy_mortality_woody_litter(p) + &
canopy_dead*(struct_c + sapw_c)
canopy_mortality_leaf_litter(p) = canopy_mortality_leaf_litter(p) + &
canopy_dead*leaf_c

! Some plants upon death will transfer storage carbon to seed production
! Storage carbon that is not transferred to seeds goes to root litter flux

canopy_mortality_root_litter(p) = canopy_mortality_root_litter(p) + &
canopy_dead*(fnrt_c + store_c)
canopy_dead*(fnrt_c + store_c*(1.0_r8-EDPftvarcon_inst%allom_frbstor_repro(p)) )

currentSite%seed_bank(p) = currentSite%seed_bank(p) + &
canopy_dead * store_c * EDPftvarcon_inst%allom_frbstor_repro(p)/AREA


if( hlm_use_planthydro == itrue ) then
call AccumulateMortalityWaterStorage(currentSite,currentCohort, canopy_dead)
Expand Down Expand Up @@ -1316,6 +1322,8 @@ subroutine create_patch(currentSite, new_patch, age, areap,cwd_ag_local,cwd_bg_l
new_patch%frac_burnt = 0._r8
new_patch%total_tree_area = 0.0_r8
new_patch%NCL_p = 1



end subroutine create_patch

Expand Down Expand Up @@ -1440,6 +1448,12 @@ subroutine zero_patch(cp_p)
currentPatch%c_stomata = 0.0_r8 ! This is calculated immediately before use
currentPatch%c_lblayer = 0.0_r8

currentPatch%solar_zenith_flag = .false.
currentPatch%solar_zenith_angle = nan

currentPatch%gnd_alb_dir(:) = nan
currentPatch%gnd_alb_dif(:) = nan

end subroutine zero_patch

! ============================================================================
Expand Down
38 changes: 29 additions & 9 deletions biogeochem/EDPhysiologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ subroutine non_canopy_derivs( currentSite, currentPatch, bc_in )
! update fragmenting pool fluxes
call cwd_input( currentSite, currentPatch)
call cwd_out( currentSite, currentPatch, bc_in)

do p = 1,numpft
currentSite%dseed_dt(p) = currentSite%dseed_dt(p) + &
(currentPatch%seeds_in(p) - currentPatch%seed_decay(p) - &
Expand Down Expand Up @@ -792,6 +792,7 @@ subroutine seeds_in( currentSite, cp_pnt )
type(ed_cohort_type), pointer :: currentCohort
integer :: p
logical :: pft_present(maxpft)
real(r8) :: store_c_to_repro ! carbon sent from storage to reproduction upon death [kg/plant]
real(r8) :: npfts_present
!----------------------------------------------------------------------

Expand Down Expand Up @@ -822,10 +823,18 @@ subroutine seeds_in( currentSite, cp_pnt )
currentPatch => cp_pnt
currentCohort => currentPatch%tallest
do while (associated(currentCohort))

! a certain fraction of bstore goes to clonal reproduction when plants die
store_c_to_repro = currentCohort%prt%GetState(store_organ,all_carbon_elements) * &
EDPftvarcon_inst%allom_frbstor_repro(currentCohort%pft)

do p = 1, numpft
if (pft_present(p)) then
currentPatch%seeds_in(p) = currentPatch%seeds_in(p) + currentCohort%seed_prod * currentCohort%n / &
(currentPatch%area * npfts_present)

currentPatch%seeds_in(p) = currentPatch%seeds_in(p) + &
(currentCohort%seed_prod * currentCohort%n - &
currentCohort%dndt*store_c_to_repro) &
/(currentPatch%area * npfts_present)
endif
end do
currentCohort => currentCohort%shorter
Expand All @@ -836,8 +845,15 @@ subroutine seeds_in( currentSite, cp_pnt )
currentCohort => currentPatch%tallest
do while (associated(currentCohort))
p = currentCohort%pft

! a certain fraction of bstore goes to clonal reproduction when plants die
store_c_to_repro = currentCohort%prt%GetState(store_organ,all_carbon_elements) * &
EDPftvarcon_inst%allom_frbstor_repro(p)

currentPatch%seeds_in(p) = currentPatch%seeds_in(p) + &
currentCohort%seed_prod * currentCohort%n/currentPatch%area
(currentCohort%seed_prod * currentCohort%n - &
currentCohort%dndt*store_c_to_repro)/currentPatch%area

currentCohort => currentCohort%shorter
enddo !cohort loop

Expand Down Expand Up @@ -913,13 +929,18 @@ subroutine seed_germination( currentSite, currentPatch )

do p = 1,numpft
currentPatch%seed_germination(p) = min(currentSite%seed_bank(p) * &
EDPftvarcon_inst%germination_timescale(p),max_germination)
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%status == 1)then
currentPatch%seed_germination(p) = 0.0_r8
endif
if (EDPftvarcon_inst%stress_decid(p) == 1.and.currentSite%dstatus == 1)then
currentPatch%seed_germination(p) = 0.0_r8
endif
enddo

end subroutine seed_germination

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

subroutine recruitment( currentSite, currentPatch, bc_in )
!
! !DESCRIPTION:
Expand Down Expand Up @@ -1134,9 +1155,8 @@ subroutine CWD_Input( currentSite, currentPatch)
! the litter flux has already been counted since it captured
! the losses of live trees and those flagged for death


currentPatch%root_litter_in(pft) = currentPatch%root_litter_in(pft) + &
(fnrt_c + store_c ) * dead_n
(fnrt_c + store_c*(1._r8-EDPftvarcon_inst%allom_frbstor_repro(pft)) ) * dead_n

! Update diagnostics that track resource management
currentSite%resources_management%delta_litter_stock = &
Expand Down
2 changes: 1 addition & 1 deletion biogeochem/FatesAllometryMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2156,7 +2156,7 @@ subroutine StructureResetOfDH( bdead, ipft, canopy_trim, d, h )
! of the diameter increment
counter = 0
step_frac = step_frac0
do while( (bdead-bt_dead) > calloc_abs_error )
do while( (bdead-bt_dead) > calloc_abs_error .and. dbt_dead_dd>0.0_r8)

! vulnerable to div0
dd = step_frac*(bdead-bt_dead)/dbt_dead_dd
Expand Down
1 change: 1 addition & 0 deletions biogeophys/EDBtranMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ module EDBtranMod

public :: btran_ed
public :: get_active_suction_layers
public :: check_layer_water

contains

Expand Down
Loading

0 comments on commit 10a0b83

Please sign in to comment.