From 847ac985d169fff5f6e61df4db4ec073f79b210e Mon Sep 17 00:00:00 2001 From: Peter Schwartz Date: Thu, 29 Feb 2024 22:56:17 -0600 Subject: [PATCH 1/2] Add TCS_MONTH_END to restart file --- components/elm/src/data_types/GridcellDataType.F90 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/elm/src/data_types/GridcellDataType.F90 b/components/elm/src/data_types/GridcellDataType.F90 index 092cbd4e1378..3b52a7a47af0 100644 --- a/components/elm/src/data_types/GridcellDataType.F90 +++ b/components/elm/src/data_types/GridcellDataType.F90 @@ -647,6 +647,10 @@ subroutine grc_cs_restart(this, bounds, ncid, flag) long_name='total carbon storage at the beginning of a month', units='gC/m^2', & interpinic_flag='interp', readvar=readvar, data=this%tcs_month_beg) + call restartvar(ncid=ncid, flag=flag, varname='TCS_MONTH_END', xtype=ncd_double, & + dim1name='gridcell', & + long_name='total carbon storage at the end of a month', units='gC/m^2', & + interpinic_flag='interp', readvar=readvar, data=this%tcs_month_end) end subroutine grc_cs_restart !------------------------------------------------------------------------ From 92a1a985821068db7930b6d69708975295eac08e Mon Sep 17 00:00:00 2001 From: Peter Schwartz Date: Thu, 29 Feb 2024 23:23:50 -0600 Subject: [PATCH 2/2] Change time check for end of month in CNPBudgetMod --- components/elm/src/biogeochem/CNPBudgetMod.F90 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/components/elm/src/biogeochem/CNPBudgetMod.F90 b/components/elm/src/biogeochem/CNPBudgetMod.F90 index c1f4b5d44079..a06e9b512c68 100644 --- a/components/elm/src/biogeochem/CNPBudgetMod.F90 +++ b/components/elm/src/biogeochem/CNPBudgetMod.F90 @@ -1204,8 +1204,7 @@ subroutine CBudget_SetEndingMonthlyStates(bounds, col_cs, grc_cs) ) ! Get current and previous dates to determine if a new month started - call get_prev_date(year_curr, month_curr, day_curr, sec_curr); - call get_prev_date(year_prev, month_prev, day_prev, sec_prev) + call get_curr_date(year_curr, month_curr, day_curr, sec_curr); ! If at the beginning of a simulation, save grid-level TCS based on ! 'begcb' from the current time step @@ -1219,7 +1218,7 @@ subroutine CBudget_SetEndingMonthlyStates(bounds, col_cs, grc_cs) ! If multiple steps into a simulation and the last time step was the ! end of a month, save grid-level TCS based on 'endcb' from the last ! time step - if (get_nstep() > 1 .and. day_prev == 1 .and. sec_prev == 0) then + if (get_nstep() > 1 .and. day_curr == 1 .and. sec_curr == 0) then call c2g( bounds, & endcb(bounds%begc:bounds%endc), & tcs_month_end_grc(bounds%begg:bounds%endg), &