From 84cca7ecfd3365f5352be9d8989ee1cffb744a71 Mon Sep 17 00:00:00 2001 From: Gautam Bisht Date: Thu, 29 Feb 2024 19:33:45 -0800 Subject: [PATCH 1/3] Writes/reads C budget related variables in history file The `TCS_MONTH_BEGIN` variable is written and read from the ELM restart file. [BFB] --- components/elm/src/main/restFileMod.F90 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/elm/src/main/restFileMod.F90 b/components/elm/src/main/restFileMod.F90 index 18f3c523de76..58554b50974e 100644 --- a/components/elm/src/main/restFileMod.F90 +++ b/components/elm/src/main/restFileMod.F90 @@ -404,6 +404,8 @@ subroutine restFile_write( bounds, file, & call veg_ps%Restart(bounds, ncid, flag='write') call veg_pf%Restart(bounds, ncid, flag='write') call crop_vars%Restart(bounds, ncid, flag='write') + + call grc_cs%Restart(bounds, ncid, flag='write') end if @@ -627,6 +629,8 @@ subroutine restFile_read( bounds, file, & call veg_ps%Restart(bounds, ncid, flag='read') call veg_pf%Restart(bounds, ncid, flag='read') call crop_vars%Restart(bounds, ncid, flag='read') + + call grc_cs%Restart(bounds, ncid, flag='read') end if if (use_fates) then From ede745a1351e3e47f53ab9890bfbbb5a147dcf45 Mon Sep 17 00:00:00 2001 From: Gautam Bisht Date: Thu, 29 Feb 2024 19:40:56 -0800 Subject: [PATCH 2/3] Fixes a local variable name --- components/elm/src/biogeochem/CNPBudgetMod.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/elm/src/biogeochem/CNPBudgetMod.F90 b/components/elm/src/biogeochem/CNPBudgetMod.F90 index 0a8117ecc45a..16d9f9fe7183 100644 --- a/components/elm/src/biogeochem/CNPBudgetMod.F90 +++ b/components/elm/src/biogeochem/CNPBudgetMod.F90 @@ -1200,7 +1200,7 @@ subroutine CBudget_SetEndingMonthlyStates(bounds, col_cs, grc_cs) associate( & begcb => col_cs%begcb , & ! Input : [real(r8) (:) ] carbon mass begining of the time step endcb => col_cs%endcb , & ! Input : [real(r8) (:) ] carbon mass begining of the time step - tcs_month_end_grc => grc_cs%tcs_month_beg & ! Output: [real(r8) (:) ] grid-level carbon mass at the begining of a month + tcs_month_beg_grc => grc_cs%tcs_month_beg & ! Output: [real(r8) (:) ] grid-level carbon mass at the begining of a month ) ! Get current and previous dates to determine if a new month started @@ -1212,7 +1212,7 @@ subroutine CBudget_SetEndingMonthlyStates(bounds, col_cs, grc_cs) if ( day_curr == 1 .and. sec_curr == 0 .and. get_nstep() <= 1 ) then call c2g( bounds, & begcb(bounds%begc:bounds%endc), & - tcs_month_end_grc(bounds%begg:bounds%endg), & + tcs_month_beg_grc(bounds%begg:bounds%endg), & c2l_scale_type= 'unity', l2g_scale_type='unity' ) endif @@ -1222,7 +1222,7 @@ subroutine CBudget_SetEndingMonthlyStates(bounds, col_cs, grc_cs) if (get_nstep() > 1 .and. day_prev == 1 .and. sec_prev == 0) then call c2g( bounds, & endcb(bounds%begc:bounds%endc), & - tcs_month_end_grc(bounds%begg:bounds%endg), & + tcs_month_beg_grc(bounds%begg:bounds%endg), & c2l_scale_type= 'unity', l2g_scale_type='unity' ) endif From e9ba2e674c99b94cea47f014cb109d0da3714a23 Mon Sep 17 00:00:00 2001 From: Gautam Bisht Date: Thu, 29 Feb 2024 20:00:22 -0800 Subject: [PATCH 3/3] Fixes the typo --- components/elm/src/biogeochem/CNPBudgetMod.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/elm/src/biogeochem/CNPBudgetMod.F90 b/components/elm/src/biogeochem/CNPBudgetMod.F90 index 16d9f9fe7183..c1f4b5d44079 100644 --- a/components/elm/src/biogeochem/CNPBudgetMod.F90 +++ b/components/elm/src/biogeochem/CNPBudgetMod.F90 @@ -1200,7 +1200,7 @@ subroutine CBudget_SetEndingMonthlyStates(bounds, col_cs, grc_cs) associate( & begcb => col_cs%begcb , & ! Input : [real(r8) (:) ] carbon mass begining of the time step endcb => col_cs%endcb , & ! Input : [real(r8) (:) ] carbon mass begining of the time step - tcs_month_beg_grc => grc_cs%tcs_month_beg & ! Output: [real(r8) (:) ] grid-level carbon mass at the begining of a month + tcs_month_end_grc => grc_cs%tcs_month_end & ! Output: [real(r8) (:) ] grid-level carbon mass at the ending of a month ) ! Get current and previous dates to determine if a new month started @@ -1212,7 +1212,7 @@ subroutine CBudget_SetEndingMonthlyStates(bounds, col_cs, grc_cs) if ( day_curr == 1 .and. sec_curr == 0 .and. get_nstep() <= 1 ) then call c2g( bounds, & begcb(bounds%begc:bounds%endc), & - tcs_month_beg_grc(bounds%begg:bounds%endg), & + tcs_month_end_grc(bounds%begg:bounds%endg), & c2l_scale_type= 'unity', l2g_scale_type='unity' ) endif @@ -1222,7 +1222,7 @@ subroutine CBudget_SetEndingMonthlyStates(bounds, col_cs, grc_cs) if (get_nstep() > 1 .and. day_prev == 1 .and. sec_prev == 0) then call c2g( bounds, & endcb(bounds%begc:bounds%endc), & - tcs_month_beg_grc(bounds%begg:bounds%endg), & + tcs_month_end_grc(bounds%begg:bounds%endg), & c2l_scale_type= 'unity', l2g_scale_type='unity' ) endif