Skip to content

Commit

Permalink
Merge pull request #2168 from rgknox/clmfates-gru-init-fix
Browse files Browse the repository at this point in the history
initializing gru products to zero in fates runs
  • Loading branch information
ekluzek authored Oct 13, 2023
2 parents 03e9fd5 + b54f1ce commit 77b9f61
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 1 deletion.
74 changes: 74 additions & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,78 @@
===============================================================
Tag name: ctsm5.1.dev143
Originator(s): rgknox (Ryan Knox,LAWRENCE BERKELEY NATIONAL LABORATORY,510-495-)
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
----------------------------------

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
Expand Down
1 change: 1 addition & 0 deletions doc/ChangeSum
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Tag Who Date Summary
============================================================================================================================
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
Expand Down
29 changes: 28 additions & 1 deletion src/biogeochem/CNProductsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -387,6 +399,7 @@ subroutine Restart(this, bounds, ncid, flag, &
! !LOCAL VARIABLES:
logical :: template_provided
logical :: readvar
integer :: g

character(len=*), parameter :: subname = 'Restart'
!-----------------------------------------------------------------------
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -834,7 +861,7 @@ subroutine ComputeSummaryVars(this, bounds)
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) + &
Expand Down

0 comments on commit 77b9f61

Please sign in to comment.