@@ -5,6 +5,8 @@ module FatesCohortMod
55 use FatesConstantsMod, only : ifalse, itrue
66 use FatesConstantsMod, only : nearzero
77 use FatesConstantsMod, only : ican_upper, ican_ustory
8+ use FatesConstantsMod, only : sec_per_day, days_per_year
9+ use FatesConstantsMod, only : days_per_sec, years_per_day
810 use EDParamsMod, only : nlevleaf
911 use FatesGlobals, only : endrun = > fates_endrun
1012 use FatesGlobals, only : fates_log
@@ -286,6 +288,7 @@ module FatesCohortMod
286288 procedure :: Copy
287289 procedure :: FreeMemory
288290 procedure :: CanUpperUnder
291+ procedure , public :: SumMortForHistory
289292 procedure :: InitPRTBoundaryConditions
290293 procedure :: UpdateCohortBioPhysRates
291294 procedure :: Dump
@@ -1001,6 +1004,44 @@ end function CanUpperUnder
10011004
10021005 ! ===========================================================================
10031006
1007+ function SumMortForHistory (this , per_year ) result(mort_sum)
1008+ !
1009+ ! DESCRIPTION:
1010+ ! Sum the various cohort-level mortality variables for saving to history.
1011+ ! Units depend on per_year:
1012+ ! per_year true: kg m-2 yr-1
1013+ ! per_year false: kg m-2 s-1
1014+
1015+ ! ARGUMENTS:
1016+ class(fates_cohort_type) :: this ! current cohort of interest
1017+ logical :: per_year
1018+ !
1019+ ! VARIABLES
1020+ ! Units depend on per_year; see description above.
1021+ real (r8 ) :: mort_natural
1022+ real (r8 ) :: mort_logging
1023+ real (r8 ) :: mort_sum
1024+
1025+ ! "Natural" mortality
1026+ mort_natural = this% bmort + this% hmort + this% cmort + this% frmort + this% smort + this% asmort + this% dgmort
1027+ if (.not. per_year) then
1028+ ! Convert kg m-2 yr-1 to kg m-2 s-1
1029+ mort_natural = mort_natural * days_per_sec * years_per_day
1030+ end if
1031+
1032+ ! Logging mortality
1033+ mort_logging = this% lmort_direct + this% lmort_collateral + this% lmort_infra
1034+ if (per_year) then
1035+ ! Convert kg m-2 s-1 to kg m-2 yr-1
1036+ mort_logging = mort_logging * sec_per_day * days_per_year
1037+ end if
1038+
1039+ mort_sum = mort_natural + mort_logging
1040+
1041+ end function SumMortForHistory
1042+
1043+ ! ===========================================================================
1044+
10041045 subroutine Dump (this )
10051046 !
10061047 ! DESCRIPTION:
0 commit comments