Skip to content

Commit

Permalink
Merge branch 'peterdschwartz/lnd/fix-vertp-precision' into next(PR #6649
Browse files Browse the repository at this point in the history
)

Variables that are r8 were initialized as single-precision, potentially causing inconsistent failures with the sums not adding to 1.0_r8.

Also, fixed a syntax error in CH4Mod for spval.

Fixes #6650
[BFB]
  • Loading branch information
peterdschwartz committed Sep 30, 2024
2 parents 74d9018 + dd108ac commit 9b5e2c6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion components/elm/src/biogeochem/CH4Mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ subroutine InitAllocate(this, bounds)
! Allocate module variables and data structures
!
! !USES:
use shr_infnan_mod, only: spval => shr_infnan_nan, assignment(=)
use shr_infnan_mod, only: nan => shr_infnan_nan, assignment(=)
use elm_varpar , only: nlevgrnd
!
! !ARGUMENTS:
Expand Down
20 changes: 10 additions & 10 deletions components/elm/src/biogeochem/VerticalProfileMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ module VerticalProfileMod
logical , public :: exponential_rooting_profile = .true.
logical , public :: pftspecific_rootingprofile = .true.
! how steep profile is for root C inputs (1/ e-folding depth) (1/m)
real(r8), public :: rootprof_exp = 3.
real(r8), public :: rootprof_exp = 3._r8
! how steep profile is for surface components (1/ e_folding depth) (1/m)
real(r8), public :: surfprof_exp = 10.
real(r8), public :: surfprof_exp = 10._r8
!-----------------------------------------------------------------------

contains
Expand Down Expand Up @@ -83,7 +83,7 @@ subroutine decomp_vertprofiles(bounds, &
real(r8) :: ndep_prof_sum
real(r8) :: nfixation_prof_sum
real(r8) :: pdep_prof_sum
real(r8) :: delta = 1.e-10
real(r8) :: delta = 1.e-10_r8
character(len=32) :: subname = 'decomp_vertprofiles'
!-----------------------------------------------------------------------

Expand Down Expand Up @@ -294,9 +294,9 @@ subroutine decomp_vertprofiles(bounds, &
! check to make sure integral of all profiles = 1.
do fc = 1,num_soilc
c = filter_soilc(fc)
ndep_prof_sum = 0.
nfixation_prof_sum = 0.
pdep_prof_sum = 0.
ndep_prof_sum = 0._r8
nfixation_prof_sum = 0._r8
pdep_prof_sum = 0._r8
do j = 1, nlevdecomp
ndep_prof_sum = ndep_prof_sum + ndep_prof(c,j) * dzsoi_decomp(j)
nfixation_prof_sum = nfixation_prof_sum + nfixation_prof(c,j) * dzsoi_decomp(j)
Expand Down Expand Up @@ -324,10 +324,10 @@ subroutine decomp_vertprofiles(bounds, &

do fp = 1,num_soilp
p = filter_soilp(fp)
froot_prof_sum = 0.
croot_prof_sum = 0.
leaf_prof_sum = 0.
stem_prof_sum = 0.
froot_prof_sum = 0._r8
croot_prof_sum = 0._r8
leaf_prof_sum = 0._r8
stem_prof_sum = 0._r8
do j = 1, nlevdecomp
froot_prof_sum = froot_prof_sum + froot_prof(p,j) * dzsoi_decomp(j)
croot_prof_sum = croot_prof_sum + croot_prof(p,j) * dzsoi_decomp(j)
Expand Down

0 comments on commit 9b5e2c6

Please sign in to comment.