Skip to content

Commit

Permalink
Merge branch 'hongyili/mosart/mosart_heat_v3' into next (PR #5343)
Browse files Browse the repository at this point in the history
The use of uninitialized variables (i.e., `Qsur` and `Qsub`) in the computation of the change of energy
due to heat exchange with the environment and advection is fixed. Currently, it is assumed that those
changes in energy are zero.

Fixes #5332
[BFB]
  • Loading branch information
bishtgautam committed Dec 13, 2022
2 parents d35619a + 95a4541 commit 0acd39d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
1 change: 1 addition & 0 deletions cime_config/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"ERS.r05_r05.RMOSGPCC.mosart-gpcc_1972",
"ERS.MOS_USRDAT.RMOSGPCC.mosart-mos_usrdat",
"SMS.MOS_USRDAT.RMOSGPCC.mosart-unstructure",
"ERS.r05_r05.RMOSGPCC.mosart-heat",
)
},

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./xmlchange DATM_CLMNCEP_YR_END=1972
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
frivinp_rtm = '$DIN_LOC_ROOT/rof/mosart/MOSART_global_half_20180721a.nc'
heatflag = .true.
26 changes: 12 additions & 14 deletions components/mosart/src/riverroute/MOSART_heat_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,19 @@ subroutine subnetworkHeat_simple(iunit, theDeltaT)
integer, intent(in) :: iunit
real(r8), intent(in) :: theDeltaT

real(r8) :: Qsur, Qsub ! flow rate of surface and subsurface runoff separately
!if(TUnit%fdir(iunit) >= 0 .and. TUnit%areaTotal(iunit) > TINYVALUE1) then
THeat%Hs_t(iunit) = 0._r8
THeat%Hl_t(iunit) = 0._r8
THeat%He_t(iunit) = 0._r8
THeat%Hh_t(iunit) = 0._r8
THeat%Hc_t(iunit) = 0._r8
THeat%Hs_t(iunit) = 0._r8
THeat%Hl_t(iunit) = 0._r8
THeat%He_t(iunit) = 0._r8
THeat%Hh_t(iunit) = 0._r8
THeat%Hc_t(iunit) = 0._r8

THeat%Ha_h2t(iunit) = 0._r8
THeat%Ha_t2r(iunit) = -cr_advectheat(abs(TRunoff%etout(iunit,nt_nliq)+TRunoff%etout(iunit,nt_nice)), THeat%Tt(iunit))
! change of energy due to heat exchange with the environment
THeat%deltaH_t(iunit) = 0._r8
! change of energy due to advective heat flux
THeat%deltaM_t(iunit) = 0._r8

THeat%Ha_h2t(iunit) = 0._r8
THeat%Ha_t2r(iunit) = -cr_advectheat(abs(TRunoff%etout(iunit,nt_nliq)+TRunoff%etout(iunit,nt_nice)), THeat%Tt(iunit))
! change of energy due to heat exchange with the environment
THeat%deltaH_t(iunit) = theDeltaT * (THeat%Hs_t(iunit) + THeat%Hl_t(iunit) + THeat%He_t(iunit) + THeat%Hc_t(iunit) + THeat%Hh_t(iunit))
! change of energy due to advective heat flux
THeat%deltaM_t(iunit) = theDeltaT * (THeat%Ha_h2t(iunit)-cr_advectheat(Qsur + Qsub, THeat%Tt(iunit)))
!end if
end subroutine subnetworkHeat_simple


Expand Down

0 comments on commit 0acd39d

Please sign in to comment.