Skip to content

Commit

Permalink
Fixed order of operations on mortality condition for age mortality, c…
Browse files Browse the repository at this point in the history
…onditioned some history variables when age is off
  • Loading branch information
rgknox committed Mar 24, 2020
1 parent dd4d196 commit f4afdf2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
9 changes: 7 additions & 2 deletions biogeochem/EDMortalityFunctionsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,16 @@ subroutine mortality_rates( cohort_in,bc_in,cmort,hmort,bmort,frmort,smort,asmor
end if

! if param values have been set then calculate asmort



mort_r_age_senescence = EDPftvarcon_inst%mort_r_age_senescence(cohort_in%pft)
mort_ip_age_senescence = EDPftvarcon_inst%mort_ip_age_senescence(cohort_in%pft)

if ( mort_ip_age_senescence < fates_check_param_set ) then
! Age Dependent Senescence
! rate and inflection point define the change in mortality with age
mort_r_age_senescence = EDPftvarcon_inst%mort_r_age_senescence(cohort_in%pft)
mort_ip_age_senescence = EDPftvarcon_inst%mort_ip_age_senescence(cohort_in%pft)

asmort = 1.0_r8 / (1.0_r8 + exp(-1.0_r8 * mort_r_age_senescence * &
(cohort_in%coage - mort_ip_age_senescence ) ) )
else
Expand Down
29 changes: 18 additions & 11 deletions main/FatesHistoryInterfaceMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module FatesHistoryInterfaceMod
use FatesInterfaceMod , only : hlm_hio_ignore_val
use FatesInterfaceMod , only : hlm_use_planthydro
use FatesInterfaceMod , only : hlm_use_ed_st3
use FatesInterfaceMod , only : hlm_use_cohort_age_tracking
use FatesInterfaceMod , only : numpft
use FatesInterfaceMod , only : hlm_freq_day
use EDParamsMod , only : ED_val_comp_excln
Expand Down Expand Up @@ -2274,10 +2275,15 @@ subroutine update_history_dyn(this,nc,nsites,sites)
(ccohort%lmort_direct+ccohort%lmort_collateral+ccohort%lmort_infra) * ccohort%n
hio_m8_si_scpf(io_si,scpf) = hio_m8_si_scpf(io_si,scpf) + ccohort%frmort*ccohort%n
hio_m9_si_scpf(io_si,scpf) = hio_m9_si_scpf(io_si,scpf) + ccohort%smort*ccohort%n
hio_m10_si_scpf(io_si,scpf) = hio_m10_si_scpf(io_si,scpf) + ccohort%asmort*ccohort%n

hio_m10_si_capf(io_si,capf) = hio_m10_si_capf(io_si,capf) + ccohort%asmort*ccohort%n


if (hlm_use_cohort_age_tracking .eq.itrue) then
hio_m10_si_scpf(io_si,scpf) = hio_m10_si_scpf(io_si,scpf) + ccohort%asmort*ccohort%n
hio_m10_si_capf(io_si,capf) = hio_m10_si_capf(io_si,capf) + ccohort%asmort*ccohort%n
hio_m10_si_scls(io_si,scls) = hio_m10_si_scls(io_si,scls) + ccohort%asmort*ccohort%n
hio_m10_si_cacls(io_si,cacls) = hio_m10_si_cacls(io_si,cacls)+ &
ccohort%asmort*ccohort%n
end if

hio_m1_si_scls(io_si,scls) = hio_m1_si_scls(io_si,scls) + ccohort%bmort*ccohort%n
hio_m2_si_scls(io_si,scls) = hio_m2_si_scls(io_si,scls) + ccohort%hmort*ccohort%n
hio_m3_si_scls(io_si,scls) = hio_m3_si_scls(io_si,scls) + ccohort%cmort*ccohort%n
Expand All @@ -2287,10 +2293,7 @@ subroutine update_history_dyn(this,nc,nsites,sites)
ccohort%frmort*ccohort%n
hio_m9_si_scls(io_si,scls) = hio_m9_si_scls(io_si,scls) + ccohort%smort*ccohort%n

hio_m10_si_scls(io_si,scls) = hio_m10_si_scls(io_si,scls) + ccohort%asmort*ccohort%n

hio_m10_si_cacls(io_si,cacls) = hio_m10_si_cacls(io_si,cacls)+ &
ccohort%asmort*ccohort%n


!C13 discrimination
if(gpp_cached + ccohort%gpp_acc_hold > 0.0_r8)then
Expand All @@ -2302,9 +2305,13 @@ subroutine update_history_dyn(this,nc,nsites,sites)

! number density [/ha]
hio_nplant_si_scpf(io_si,scpf) = hio_nplant_si_scpf(io_si,scpf) + ccohort%n

! number density along the cohort age dimension
hio_nplant_si_capf(io_si,capf) = hio_nplant_si_capf(io_si,capf) + ccohort%n

if (hlm_use_cohort_age_tracking .eq.itrue) then
hio_nplant_si_capf(io_si,capf) = hio_nplant_si_capf(io_si,capf) + ccohort%n
hio_nplant_si_cacls(io_si,cacls) = hio_nplant_si_cacls(io_si,cacls)+ccohort%n
end if

! number density by size and biomass
hio_agb_si_scls(io_si,scls) = hio_agb_si_scls(io_si,scls) + &
total_c * ccohort%n * EDPftvarcon_inst%allom_agb_frac(ccohort%pft) * AREA_INV
Expand All @@ -2322,7 +2329,7 @@ subroutine update_history_dyn(this,nc,nsites,sites)
hio_nplant_si_scag(io_si,iscag) = hio_nplant_si_scag(io_si,iscag) + ccohort%n

hio_nplant_si_scls(io_si,scls) = hio_nplant_si_scls(io_si,scls) + ccohort%n
hio_nplant_si_cacls(io_si,cacls) = hio_nplant_si_cacls(io_si,cacls)+ccohort%n


! update size, age, and PFT - indexed quantities

Expand Down

0 comments on commit f4afdf2

Please sign in to comment.