Skip to content

Commit

Permalink
Merge commit 'f2869fe202f71c4fd8c854fce47089630b4396c5' into clm50cos…
Browse files Browse the repository at this point in the history
…latfirefix

This is a fix for ESCOMP#787 for DWT_SLASH
  • Loading branch information
ekluzek committed Aug 28, 2019
2 parents 63b2c81 + f2869fe commit 986cf49
Show file tree
Hide file tree
Showing 12 changed files with 1,147 additions and 752 deletions.
2 changes: 1 addition & 1 deletion bld/namelist_files/namelist_defaults_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
<!-- The default filenames are given relative to the root directory
for the CLM2 data in the CESM distribution -->
<!-- Plant function types (relative to {csmdata}) -->
<paramfile phys="clm5_0">lnd/clm2/paramdata/clm5_params.c190529.nc</paramfile>
<paramfile phys="clm5_0">lnd/clm2/paramdata/clm5_params.c190729.nc</paramfile>
<paramfile phys="clm4_5">lnd/clm2/paramdata/clm_params.c190518.nc</paramfile>

<!-- ================================================================== -->
Expand Down
179 changes: 179 additions & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,183 @@
===============================================================
Tag name: ctsm1.0.dev056
Originator(s): sacks (Bill Sacks)
Date: Fri Aug 16 11:44:43 MDT 2019
One-line Summary: Start adding water tracers to LakeHydrology, and related refactoring

Purpose of changes
------------------

Start adding water tracers to LakeHydrology, beginning with some initial
things done for snow.

This also includes some significant refactoring to allow LakeHydrology
to reuse some of the same snow code used for non-lake columns.

Bugs fixed or introduced
------------------------

Issues fixed (include CTSM Issue #):
- Partially addresses ESCOMP/ctsm#775 (Implement water tracers for
initial snow-related code in LakeHydrology)

Known bugs found since the previous tag (include github issue ID):
The following will be fixed in an upcoming tag:
- ESCOMP/ctsm#783 (frac_sno is always 0 for lake points)
- ESCOMP/ctsm#784 (Suggested algebraic rework of frac_sno calculation)
- ESCOMP/ctsm#785 (Threshold for explicit snow pack initiation should
use frac_sno_eff, not frac_sno)

Significant changes to scientifically-supported configurations
--------------------------------------------------------------

Does this tag change answers significantly for any of the following physics configurations?
(Details of any changes will be given in the "Answer changes" section below.)

[Put an [X] in the box for any configuration with significant answer changes.]

[ ] clm5_0

[ ] ctsm5_0-nwp

[ ] clm4_5

Notes of particular relevance for users
---------------------------------------

Caveats for users (e.g., need to interpolate initial conditions): none

Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none

Changes made to namelist defaults (e.g., changed parameter values): none

Changes to the datasets (e.g., parameter, surface or initial files): none

Substantial timing or memory changes: none

Notes of particular relevance for developers: (including Code reviews and testing)
---------------------------------------------
NOTE: Be sure to review the steps in README.CHECKLIST.master_tags as well as the coding style in the Developers Guide

Caveats for developers (e.g., code that is duplicated that requires double maintenance): none

Changes to tests or testing: none

Code reviewed by: self


CTSM testing:

[PASS means all tests PASS and OK means tests PASS other than expected fails.]

build-namelist tests:

cheyenne - not run

tools-tests (test/tools):

cheyenne - not run

PTCLM testing (tools/shared/PTCLM/test):

cheyenne - not run

python testing (see instructions in python/README.md; document testing done):

(any machine) - not run

regular tests (aux_clm):

cheyenne ---- ok
hobart ------ ok

ok means tests pass, answers change as expected

Note: Did most testing on 054dc95b (before the small change in
7e4e52a9); just ran
LWISO_Ld10.f10_f10_musgs.I2000Clm50BgcCropGs.cheyenne_gnu.clm-coldStart
on the final commit

If the tag used for baseline comparisons was NOT the previous tag, note that here:


Answer changes
--------------

Changes answers relative to baseline: YES

If a tag changes answers relative to baseline comparison the
following should be filled in (otherwise remove this section):

Summarize any changes to answers, i.e.,
- what code configurations: all
- what platforms/compilers: all
- nature of change (roundoff; larger than roundoff/same climate; new climate): roundoff

There are two answer-changes here:

(1) Roundoff-level changes due to changing some order of operations
for the updating of snow_depth and dz for lakes: The previous
code effectively used (qflx_snow_grnd(c)/bifall(c))*dtime,
whereas the new code uses (qflx_snow_grnd(c)*dtime)/bifall(c);
similarly, the dz update differs.

(2) A change in FSNO_EFF for lakes: previously, this was set to 0
when there was no snow. Now this is set consistently with other
landunits, for which it is 1 even if there is no snow. Note that
this only affects the FSNO_EFF diagnostic field, and nothing
else.

If bitwise differences were observed, how did you show they were no worse
than roundoff?

I confirmed that the order-of-operations change is the only
answer-changing part of this tag by comparing against a one-off
from master with the following diffs; this comparison was
bit-for-bit except for changes in the FSNO_EFF diagnostic field:

diff --git a/src/biogeophys/LakeHydrologyMod.F90 b/src/biogeophys/LakeHydrologyMod.F90
index 91ddfc79..9711dad7 100644
--- a/src/biogeophys/LakeHydrologyMod.F90
+++ b/src/biogeophys/LakeHydrologyMod.F90
@@ -126,6 +126,8 @@ subroutine LakeHydrology(bounds, &
real(r8) :: heatsum(bounds%begc:bounds%endc) ! used in case above [J/m^2]
real(r8) :: snowmass ! liquid+ice snow mass in a layer [kg/m2]
real(r8) :: snowcap_scl_fct ! temporary factor used to correct for snow capping
+ real(r8) :: temp_snow_depth
+ real(r8) :: newsnow
real(r8), parameter :: snow_bd = 250._r8 ! assumed snow bulk density (for lakes w/out resolved snow layers) [kg/m^3]
! Should only be used for frost below.
!-----------------------------------------------------------------------
@@ -246,8 +248,10 @@ subroutine LakeHydrology(bounds, &
! U.S.Department of Agriculture Forest Service, Project F,
! Progress Rep. 1, Alta Avalanche Study Center:Snow Layer Densification.

- dz_snowf = qflx_snow_grnd(c)/bifall(c)
- snow_depth(c) = snow_depth(c) + dz_snowf*dtime
+ temp_snow_depth = snow_depth(c)
+ newsnow = qflx_snow_grnd(c)*dtime
+ snow_depth(c) = snow_depth(c) + newsnow/bifall(c)
+ dz_snowf = (snow_depth(c) - temp_snow_depth)/dtime
if (snl(c) == 0) then
h2osno_no_layers(c) = h2osno_no_layers(c) + qflx_snow_grnd(c)*dtime ! snow water equivalent (mm)
else

If this tag changes climate describe the run(s) done to evaluate the new
climate (put details of the simulations in the experiment database)
- casename: N/A

URL for LMWG diagnostics output used to validate new climate: N/A


Detailed list of changes
------------------------

List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none

Pull Requests that document the changes (include PR ids): none

===============================================================
===============================================================
Tag name: ctsm1.0.dev055
Originator(s): sacks (Bill Sacks)
Date: Tue Aug 6 14:06:50 MDT 2019
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
============================================================================================================================
ctsm1.0.dev056 sacks 08/16/2019 Start adding water tracers to LakeHydrology, and related refactoring
ctsm1.0.dev055 sacks 08/06/2019 Modularize snow cover fraction method
ctsm1.0.dev054 sacks 08/02/2019 Fix interpolation of surfdat soil layers so we can use interpolation for 10SL case
ctsm1.0.dev053 slevis 08/01/2019 Soil layer definition clean-up and user-defined option
Expand Down
63 changes: 44 additions & 19 deletions src/biogeochem/CNVegCarbonFluxType.F90
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ module CNVegCarbonFluxType
real(r8), pointer :: dwt_conv_cflux_dribbled_grc (:) ! (gC/m2/s) dwt_conv_cflux_grc dribbled evenly throughout the year
real(r8), pointer :: dwt_wood_productc_gain_patch (:) ! (gC/m2/s) addition to wood product pools from landcover change; although this is a patch-level flux, it is expressed per unit GRIDCELL area
real(r8), pointer :: dwt_crop_productc_gain_patch (:) ! (gC/m2/s) addition to crop product pools from landcover change; although this is a patch-level flux, it is expressed per unit GRIDCELL area
real(r8), pointer :: dwt_slash_cflux_col (:) ! (gC/m2/s) conversion slash flux due to landcover change
real(r8), pointer :: dwt_slash_cflux_patch (:) ! (gC/m2/s) conversion slash flux due to landcover change
real(r8), pointer :: dwt_slash_cflux_grc (:) ! (gC/m2/s) dwt_slash_cflux_patch summed to the gridcell-level
real(r8), pointer :: dwt_frootc_to_litr_met_c_col (:,:) ! (gC/m3/s) fine root to litter due to landcover change
real(r8), pointer :: dwt_frootc_to_litr_cel_c_col (:,:) ! (gC/m3/s) fine root to litter due to landcover change
real(r8), pointer :: dwt_frootc_to_litr_lig_c_col (:,:) ! (gC/m3/s) fine root to litter due to landcover change
Expand Down Expand Up @@ -629,7 +630,8 @@ subroutine InitAllocate(this, bounds, carbon_type)
allocate(this%harvest_c_to_litr_lig_c_col (begc:endc,1:nlevdecomp_full)); this%harvest_c_to_litr_lig_c_col (:,:)=nan
allocate(this%harvest_c_to_cwdc_col (begc:endc,1:nlevdecomp_full)); this%harvest_c_to_cwdc_col (:,:)=nan

allocate(this%dwt_slash_cflux_col (begc:endc)) ; this%dwt_slash_cflux_col (:) =nan
allocate(this%dwt_slash_cflux_patch (begp:endp)) ; this%dwt_slash_cflux_patch (:) =nan
allocate(this%dwt_slash_cflux_grc (begg:endg)) ; this%dwt_slash_cflux_grc (:) =nan
allocate(this%dwt_frootc_to_litr_met_c_col (begc:endc,1:nlevdecomp_full)); this%dwt_frootc_to_litr_met_c_col (:,:)=nan
allocate(this%dwt_frootc_to_litr_cel_c_col (begc:endc,1:nlevdecomp_full)); this%dwt_frootc_to_litr_cel_c_col (:,:)=nan
allocate(this%dwt_frootc_to_litr_lig_c_col (begc:endc,1:nlevdecomp_full)); this%dwt_frootc_to_litr_lig_c_col (:,:)=nan
Expand Down Expand Up @@ -2876,10 +2878,19 @@ subroutine InitHistory(this, bounds, carbon_type)
'(per-area-gridcell; only makes sense with dov2xy=.false.)', &
ptr_patch=this%dwt_wood_productc_gain_patch, default='inactive')

this%dwt_slash_cflux_col(begc:endc) = spval
call hist_addfld1d (fname='DWT_SLASH_CFLUX', units='gC/m^2/s', &
avgflag='A', long_name='slash C flux to litter and CWD due to land use', &
ptr_col=this%dwt_slash_cflux_col)
this%dwt_slash_cflux_grc(begg:endg) = spval
call hist_addfld1d (fname='DWT_SLASH_CFLUX', units='gC/m^2/s', &
avgflag='A', &
long_name='slash C flux (to litter diagnostic only) (0 at all times except first timestep of year)', &
ptr_gcell=this%dwt_slash_cflux_grc)

this%dwt_slash_cflux_patch(begp:endp) = spval
call hist_addfld1d (fname='DWT_SLASH_CFLUX_PATCH', units='gC/m^2/s', &
avgflag='A', &
long_name='patch-level slash C flux (to litter diagnostic only) ' // &
'(0 at all times except first timestep of year) ' // &
'(per-area-gridcell; only makes sense with dov2xy=.false.)', &
ptr_patch=this%dwt_slash_cflux_patch, default='inactive')

this%dwt_frootc_to_litr_met_c_col(begc:endc,:) = spval
call hist_addfld_decomp (fname='DWT_FROOTC_TO_LITR_MET_C', units='gC/m^2/s', type2d='levdcmp', &
Expand Down Expand Up @@ -3050,10 +3061,19 @@ subroutine InitHistory(this, bounds, carbon_type)
long_name='C13 conversion C flux (immediate loss to atm), dribbled throughout the year', &
ptr_gcell=this%dwt_conv_cflux_dribbled_grc, default='inactive')

this%dwt_slash_cflux_col(begc:endc) = spval
call hist_addfld1d (fname='C13_DWT_SLASH_CFLUX', units='gC/m^2/s', &
avgflag='A', long_name='C13 slash C flux to litter and CWD due to land use', &
ptr_col=this%dwt_slash_cflux_col, default='inactive')
this%dwt_slash_cflux_grc(begg:endg) = spval
call hist_addfld1d (fname='C13_DWT_SLASH_CFLUX', units='gC13/m^2/s', &
avgflag='A', long_name='C13 slash C flux (to litter diagnostic only)' // &
'(0 at all times except first timestep of year)', &
ptr_gcell=this%dwt_slash_cflux_grc, default='inactive')

this%dwt_slash_cflux_patch(begp:endp) = spval
call hist_addfld1d (fname='C13_DWT_SLASH_CFLUX_PATCH', units='gC13/m^2/s', &
avgflag='A', &
long_name='patch-level C13 slash C flux (to litter diagnostic only) ' // &
'(0 at all times except first timestep of year) ' // &
'(per-area-gridcell; only makes sense with dov2xy=.false.)', &
ptr_patch=this%dwt_slash_cflux_patch, default='inactive')

this%dwt_frootc_to_litr_met_c_col(begc:endc,:) = spval
call hist_addfld_decomp (fname='C13_DWT_FROOTC_TO_LITR_MET_C', units='gC13/m^2/s', type2d='levdcmp', &
Expand Down Expand Up @@ -3206,10 +3226,19 @@ subroutine InitHistory(this, bounds, carbon_type)
long_name='C14 conversion C flux (immediate loss to atm), dribbled throughout the year', &
ptr_gcell=this%dwt_conv_cflux_dribbled_grc, default='inactive')

this%dwt_slash_cflux_col(begc:endc) = spval
call hist_addfld1d (fname='C14_DWT_SLASH_CFLUX', units='gC/m^2/s', &
avgflag='A', long_name='C14 slash C flux to litter and CWD due to land use', &
ptr_col=this%dwt_slash_cflux_col, default='inactive')
this%dwt_slash_cflux_grc(begg:endg) = spval
call hist_addfld1d (fname='C14_DWT_SLASH_CFLUX', units='gC14/m^2/s', &
avgflag='A', long_name='C14 slash C flux (to litter diagnostic only)' // &
'(0 at all times except first timestep of year)', &
ptr_gcell=this%dwt_slash_cflux_grc, default='inactive')

this%dwt_slash_cflux_patch(begp:endp) = spval
call hist_addfld1d (fname='C14_DWT_SLASH_CFLUX_PATCH', units='gC14/m^2/s', &
avgflag='A', &
long_name='patch-level C14 slash C flux (to litter diagnostic only)' // &
'(0 at all times except first timestep of year) ' // &
'(per-area-gridcell; only makes sense with dov2xy=.false.)', &
ptr_patch=this%dwt_slash_cflux_patch, default='inactive')

this%dwt_frootc_to_litr_met_c_col(begc:endc,:) = spval
call hist_addfld_decomp (fname='C14_DWT_FROOTC_TO_LITR_MET_C', units='gC14/m^2/s', type2d='levdcmp', &
Expand Down Expand Up @@ -3364,7 +3393,6 @@ subroutine InitCold(this, bounds)
! also initialize dynamic landcover fluxes so that they have
! real values on first timestep, prior to calling pftdyn_cnbal
if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then
this%dwt_slash_cflux_col(c) = 0._r8
do j = 1, nlevdecomp_full
this%dwt_frootc_to_litr_met_c_col(c,j) = 0._r8
this%dwt_frootc_to_litr_cel_c_col(c,j) = 0._r8
Expand Down Expand Up @@ -3965,10 +3993,7 @@ subroutine ZeroDwt( this, bounds )
this%dwt_seedc_to_leaf_grc(g) = 0._r8
this%dwt_seedc_to_deadstem_grc(g) = 0._r8
this%dwt_conv_cflux_grc(g) = 0._r8
end do

do c = bounds%begc,bounds%endc
this%dwt_slash_cflux_col(c) = 0._r8
this%dwt_slash_cflux_grc(g) = 0._r8
end do

do j = 1, nlevdecomp_full
Expand Down
69 changes: 39 additions & 30 deletions src/biogeochem/dynConsBiogeochemMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -587,36 +587,6 @@ subroutine dyn_cnbal_patch(bounds, &
end do


! calculate patch-to-column slash fluxes into litter and CWD pools
do p = bounds%begp, bounds%endp
c = patch%column(p)

! fine and coarse root to litter and CWD slash carbon fluxes
cnveg_carbonflux_inst%dwt_slash_cflux_col(c) = &
cnveg_carbonflux_inst%dwt_slash_cflux_col(c) + &
dwt_frootc_to_litter(p)/dt + &
dwt_livecrootc_to_litter(p)/dt + &
dwt_deadcrootc_to_litter(p)/dt

if ( use_c13 ) then
c13_cnveg_carbonflux_inst%dwt_slash_cflux_col(c) = &
c13_cnveg_carbonflux_inst%dwt_slash_cflux_col(c) + &
dwt_frootc13_to_litter(p)/dt + &
dwt_livecrootc13_to_litter(p)/dt + &
dwt_deadcrootc13_to_litter(p)/dt
endif

if ( use_c14 ) then
c14_cnveg_carbonflux_inst%dwt_slash_cflux_col(c) = &
c14_cnveg_carbonflux_inst%dwt_slash_cflux_col(c) + &
dwt_frootc14_to_litter(p)/dt + &
dwt_livecrootc14_to_litter(p)/dt + &
dwt_deadcrootc14_to_litter(p)/dt
endif

end do


! calculate patch-to-column for fluxes into litter and CWD pools
do j = 1, nlevdecomp
do p = bounds%begp, bounds%endp
Expand Down Expand Up @@ -787,6 +757,45 @@ subroutine dyn_cnbal_patch(bounds, &

end do

! calculate patch-to-gridcell slash fluxes into litter and CWD pools
! Note that patch-level fluxes are stored per unit GRIDCELL area - thus, we don't
! need to multiply by the patch's gridcell weight when translating patch-level
! fluxes into gridcell-level fluxes.

do p = bounds%begp, bounds%endp
g = patch%gridcell(p)

! fine and coarse root to litter and CWD slash carbon fluxes
cnveg_carbonflux_inst%dwt_slash_cflux_patch(p) = &
dwt_frootc_to_litter(p)/dt + &
dwt_livecrootc_to_litter(p)/dt + &
dwt_deadcrootc_to_litter(p)/dt
cnveg_carbonflux_inst%dwt_slash_cflux_grc(g) = &
cnveg_carbonflux_inst%dwt_slash_cflux_grc(g) + &
cnveg_carbonflux_inst%dwt_slash_cflux_patch(p)

if ( use_c13 ) then
c13_cnveg_carbonflux_inst%dwt_slash_cflux_patch(p) = &
dwt_frootc13_to_litter(p)/dt + &
dwt_livecrootc13_to_litter(p)/dt + &
dwt_deadcrootc13_to_litter(p)/dt
c13_cnveg_carbonflux_inst%dwt_slash_cflux_grc(g) = &
c13_cnveg_carbonflux_inst%dwt_slash_cflux_grc(g) + &
c13_cnveg_carbonflux_inst%dwt_slash_cflux_patch(p)
endif

if ( use_c14 ) then
c14_cnveg_carbonflux_inst%dwt_slash_cflux_patch(p) = &
dwt_frootc14_to_litter(p)/dt + &
dwt_livecrootc14_to_litter(p)/dt + &
dwt_deadcrootc14_to_litter(p)/dt
c14_cnveg_carbonflux_inst%dwt_slash_cflux_grc(g) = &
c14_cnveg_carbonflux_inst%dwt_slash_cflux_grc(g) + &
c14_cnveg_carbonflux_inst%dwt_slash_cflux_patch(p)
endif

end do

! Deallocate patch-level flux arrays
deallocate(dwt)
deallocate(dwt_leafc_seed)
Expand Down
Loading

0 comments on commit 986cf49

Please sign in to comment.