From 0940a22b1aaeb69218c8b7c9c119b13b4f9bc81b Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Wed, 20 Sep 2023 13:25:38 -0400 Subject: [PATCH 1/4] Extending intialization of cn_products gru_ variables to restarts --- src/biogeochem/CNProductsMod.F90 | 33 +++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/biogeochem/CNProductsMod.F90 b/src/biogeochem/CNProductsMod.F90 index 4ef5c7c86f..7dde2d5727 100644 --- a/src/biogeochem/CNProductsMod.F90 +++ b/src/biogeochem/CNProductsMod.F90 @@ -13,6 +13,7 @@ module CNProductsMod use clm_time_manager , only : get_step_size_real use SpeciesBaseType , only : species_base_type use PatchType , only : patch + use clm_varctl , only : use_fates_bgc ! implicit none private @@ -346,6 +347,17 @@ subroutine InitCold(this, bounds) this%tot_woodprod_grc(g) = 0._r8 end do + ! We don't call the woodproduct fluxes routine if + ! no veg patches are active. This is what happens + ! when fates is on. Woodproduct fluxes use a p2g + ! upscaling for the gru_ pools. Must zero it here then. + if(use_fates_bgc)then + do g = bounds%begg, bounds%endg + this%gru_prod10_gain_grc(g) = 0._r8 + this%gru_prod100_gain_grc(g) = 0._r8 + end do + end if + ! Need to set these patch-level fluxes to 0 everywhere for the sake of special ! landunits (because they don't get set over special landunits in the run loop) do p = bounds%begp, bounds%endp @@ -387,6 +399,7 @@ subroutine Restart(this, bounds, ncid, flag, & ! !LOCAL VARIABLES: logical :: template_provided logical :: readvar + integer :: g character(len=*), parameter :: subname = 'Restart' !----------------------------------------------------------------------- @@ -485,7 +498,20 @@ subroutine Restart(this, bounds, ncid, flag, & end if if (flag == 'read') then + + ! We don't call the woodproduct fluxes routine if + ! no veg patches are active. This is what happens + ! when fates is on. Woodproduct fluxes use a p2g + ! upscaling for the gru_ pools. Must zero it here then. + !if(use_fates_bgc)then + ! do g = bounds%begg, bounds%endg + ! this%gru_prod10_gain_grc(g) = 0._r8 + ! this%gru_prod100_gain_grc(g) = 0._r8 + ! end do + ! end if + call this%ComputeSummaryVars(bounds) + end if end subroutine Restart @@ -789,6 +815,7 @@ subroutine ComputeProductSummaryVars(this, bounds) ! fluxes into wood & crop product pools, from landcover change this%cropprod1_grc(g) = this%cropprod1_grc(g) + this%dwt_cropprod1_gain_grc(g)*dt + this%prod10_grc(g) = this%prod10_grc(g) + this%dwt_prod10_gain_grc(g)*dt this%prod100_grc(g) = this%prod100_grc(g) + this%dwt_prod100_gain_grc(g)*dt @@ -830,11 +857,15 @@ subroutine ComputeSummaryVars(this, bounds) do g = bounds%begg, bounds%endg + print*,this%prod10_grc(g),this%prod100_grc(g), this%prod10_loss_grc(g), & + this%prod100_loss_grc(g), this%cropprod1_loss_grc(g),this%dwt_prod100_gain_grc(g), & + this%dwt_prod10_gain_grc(g), this%gru_prod100_gain_grc(g), this%gru_prod10_gain_grc(g) + ! total wood products this%tot_woodprod_grc(g) = & this%prod10_grc(g) + & this%prod100_grc(g) - + ! total loss from wood products this%tot_woodprod_loss_grc(g) = & this%prod10_loss_grc(g) + & From b210a7898558d78bd212142b33baa67b0a250bb9 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Wed, 20 Sep 2023 14:51:23 -0400 Subject: [PATCH 2/4] removed print statements and uncommented a zeroing block --- src/biogeochem/CNProductsMod.F90 | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/biogeochem/CNProductsMod.F90 b/src/biogeochem/CNProductsMod.F90 index 7dde2d5727..a5f69696b0 100644 --- a/src/biogeochem/CNProductsMod.F90 +++ b/src/biogeochem/CNProductsMod.F90 @@ -503,12 +503,12 @@ subroutine Restart(this, bounds, ncid, flag, & ! no veg patches are active. This is what happens ! when fates is on. Woodproduct fluxes use a p2g ! upscaling for the gru_ pools. Must zero it here then. - !if(use_fates_bgc)then - ! do g = bounds%begg, bounds%endg - ! this%gru_prod10_gain_grc(g) = 0._r8 - ! this%gru_prod100_gain_grc(g) = 0._r8 - ! end do - ! end if + if(use_fates_bgc)then + do g = bounds%begg, bounds%endg + this%gru_prod10_gain_grc(g) = 0._r8 + this%gru_prod100_gain_grc(g) = 0._r8 + end do + end if call this%ComputeSummaryVars(bounds) @@ -857,10 +857,6 @@ subroutine ComputeSummaryVars(this, bounds) do g = bounds%begg, bounds%endg - print*,this%prod10_grc(g),this%prod100_grc(g), this%prod10_loss_grc(g), & - this%prod100_loss_grc(g), this%cropprod1_loss_grc(g),this%dwt_prod100_gain_grc(g), & - this%dwt_prod10_gain_grc(g), this%gru_prod100_gain_grc(g), this%gru_prod10_gain_grc(g) - ! total wood products this%tot_woodprod_grc(g) = & this%prod10_grc(g) + & From 711114ba5862b0acbd0b7c2df1be97ef08fe722c Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Wed, 11 Oct 2023 15:46:03 -0600 Subject: [PATCH 3/4] Updated changelog --- doc/ChangeLog | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 75 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 8e8a99b868..5d12272b34 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,78 @@ =============================================================== +Tag name: ctsm5.1.dev143 +Originator(s): rgknox (Ryan Knox,LAWRENCE BERKELEY NATIONAL LABORATORY,510-495-) +Date: Wed Oct 11 15:37:48 MDT 2023 +One-line Summary: Zeroing of wood product fluxes on fates columns + +Purpose and description of changes +---------------------------------- + +This is a small change that initializes wood product fluxes on fates columns to zero. These +products are otherwise zero'd in a p2c() routine that is incompatible with fates. When +wood product fluxes become available via fates, these routines will be updated. These fluxes +were previously left as uninitialized, which was causing math issues on some compilers. + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +There are no changes to scientifically-supported configurations. + +[ ] clm5_1 + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + + +Bugs fixed or introduced +------------------------ + +Fixes CTSM issue 2165 + + +Notes of particular relevance for users +--------------------------------------- + + +No caveats, no bugs, no issues of relevance. + +No noticable timing changes. + + +Notes of particular relevance for developers: +--------------------------------------------- + +None + + +Testing summary: +---------------- + + regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing): + + cheyenne ---- OK + izumi ------- PASS + + Compared against baseline: ctsm5.1.dev142 + + +Answer changes +-------------- + +Answer changes only on FATES tests, and only on the specific wood product fluxes modified. These values +are now zeros, instead of being uninitialized. Everything else is b4b. + + +Other details +------------- + +No other details. + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev142 Originator(s): samrabin (Sam Rabin, UCAR/TSS, samrabin@ucar.edu) Date: Tue Sep 19 11:30:22 MDT 2023 diff --git a/doc/ChangeSum b/doc/ChangeSum index e11f439658..0f72ce9698 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev143 rgknox 10/11/2023 Zeroing of wood product fluxes on fates columns ctsm5.1.dev142 samrabin 09/19/2023 Merge 5 bit-for-bit pull requests ctsm5.1.dev141 slevis 09/13/2023 Change small snocan to zero ctsm5.1.dev140 afoster 09/12/2023 add lai_streams capability for FATES From b54f1ce2bc7124cbfa8cc6e1d271b216e24a7acc Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 13 Oct 2023 08:53:55 -0600 Subject: [PATCH 4/4] Update changelog date --- doc/ChangeLog | 2 +- doc/ChangeSum | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 5d12272b34..1fa5bc6a80 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,7 @@ =============================================================== Tag name: ctsm5.1.dev143 Originator(s): rgknox (Ryan Knox,LAWRENCE BERKELEY NATIONAL LABORATORY,510-495-) -Date: Wed Oct 11 15:37:48 MDT 2023 +Date: Fri Oct 13 08:53:38 MDT 2023 One-line Summary: Zeroing of wood product fluxes on fates columns Purpose and description of changes diff --git a/doc/ChangeSum b/doc/ChangeSum index 0f72ce9698..b6a5cdd29c 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,6 +1,6 @@ Tag Who Date Summary ============================================================================================================================ - ctsm5.1.dev143 rgknox 10/11/2023 Zeroing of wood product fluxes on fates columns + ctsm5.1.dev143 rgknox 10/13/2023 Zeroing of wood product fluxes on fates columns ctsm5.1.dev142 samrabin 09/19/2023 Merge 5 bit-for-bit pull requests ctsm5.1.dev141 slevis 09/13/2023 Change small snocan to zero ctsm5.1.dev140 afoster 09/12/2023 add lai_streams capability for FATES