Skip to content

Commit e165e13

Browse files
authored
Merge pull request #408 from nmizukami/cesm-coupling_lake_vol_initialization
lake initial volume is set to maximum storage. use correct VOL index
2 parents 55da196 + 36478e3 commit e165e13

File tree

1 file changed

+18
-21
lines changed

1 file changed

+18
-21
lines changed

route/build/src/lake_route.f90

+18-21
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
MODULE lake_route_module
22

33
USE nrtype
4-
! data type
5-
USE dataTypes, ONLY: STRFLX ! fluxes in each reach
6-
USE dataTypes, ONLY: RCHTOPO ! Network topology
7-
USE dataTypes, ONLY: RCHPRP ! Network parameter
8-
! global parameters
9-
USE public_var, ONLY: iulog ! i/o logical unit number
10-
USE public_var, ONLY: realMissing ! missing value for real number
11-
USE public_var, ONLY: integerMissing ! missing value for integer number
12-
USE public_var, ONLY: pi ! pi value of 3.14159265359_dp
13-
USE public_var, ONLY: charMissing ! missing character
14-
USE globalData, ONLY: idxIRF ! index of IRF method
15-
USE globalData, ONLY: isColdStart ! restart flag
16-
! external routines
17-
USE water_balance, ONLY: comp_reach_wb ! compute water balance error
18-
USE ascii_utils, ONLY: lower ! convert string to lower case
4+
USE dataTypes, ONLY: STRFLX ! data struct: fluxes in each reach
5+
USE dataTypes, ONLY: RCHTOPO ! data struct: Network topology
6+
USE dataTypes, ONLY: RCHPRP ! data struct: Network parameter
7+
USE public_var, ONLY: iulog ! parameter: i/o logical unit number
8+
USE public_var, ONLY: realMissing ! parameter: missing value for real number
9+
USE public_var, ONLY: integerMissing ! parameter: missing value for integer number
10+
USE public_var, ONLY: charMissing ! parameter: missing character
11+
USE public_var, ONLY: pi ! parameter: pi value of 3.14159265359_dp
12+
USE globalData, ONLY: idxIRF ! parameter: index of IRF method
13+
USE globalData, ONLY: isColdStart ! parameter: restart flag
14+
USE water_balance, ONLY: comp_reach_wb ! routine: compute water balance error
15+
USE ascii_utils, ONLY: lower ! routine: convert string to lower case
1916

2017
implicit none
2118
integer(i4b),parameter :: endorheic=0
@@ -128,26 +125,26 @@ SUBROUTINE lake_route(iEns, & ! input: index of runoff ensemble to be p
128125
! jump start the lake volume to the target volume if provided for the first time step
129126
if (iTime==1) then
130127
if ((is_vol_wm_jumpstart).and.(NETOPO_in(segIndex)%LakeTargVol)) then
131-
RCHFLX_out(iens,segIndex)%ROUTE(idxIRF)%REACH_VOL(0) = RCHFLX_out(iens,segIndex)%REACH_WM_VOL ! update the initial condition with first target volume value
128+
RCHFLX_out(iens,segIndex)%ROUTE(idxIRF)%REACH_VOL(1) = RCHFLX_out(iens,segIndex)%REACH_WM_VOL ! update the initial condition with first target volume value
132129
else ! the lake volume is not jump started based on lake target volume
133130
if (isColdStart) then ! Cold start ....... initialize flux structures
134131
select case(NETOPO_in(segIndex)%LakeModelType)
135132
case(endorheic)
136-
RCHFLX_out(iens,segIndex)%ROUTE(idxIRF)%REACH_VOL(0) = RPARAM_in(segIndex)%D03_S0 ! currently assumes all endorheic max storage are provided under doll formulation
133+
RCHFLX_out(iens,segIndex)%ROUTE(idxIRF)%REACH_VOL(1) = RPARAM_in(segIndex)%D03_S0 ! currently assumes all endorheic max storage are provided under doll formulation
137134
case(doll03)
138-
RCHFLX_out(iens,segIndex)%ROUTE(idxIRF)%REACH_VOL(0) = RPARAM_in(segIndex)%D03_MaxStorage
135+
RCHFLX_out(iens,segIndex)%ROUTE(idxIRF)%REACH_VOL(1) = RPARAM_in(segIndex)%D03_MaxStorage
139136
case(hanasaki06)
140-
RCHFLX_out(iens,segIndex)%ROUTE(idxIRF)%REACH_VOL(0) = RPARAM_in(segIndex)%H06_Smax
137+
RCHFLX_out(iens,segIndex)%ROUTE(idxIRF)%REACH_VOL(1) = RPARAM_in(segIndex)%H06_Smax
141138
case(hype)
142-
RCHFLX_out(iens,segIndex)%ROUTE(idxIRF)%REACH_VOL(0) = (RPARAM_in(segIndex)%HYP_E_min - RPARAM_in(segIndex)%HYP_E_zero) * RPARAM_in(segIndex)%HYP_A_avg
139+
RCHFLX_out(iens,segIndex)%ROUTE(idxIRF)%REACH_VOL(1) = (RPARAM_in(segIndex)%HYP_E_min - RPARAM_in(segIndex)%HYP_E_zero) * RPARAM_in(segIndex)%HYP_A_avg
143140
case default; ierr=20; message=trim(message)//'unable to identify the parametric lake model type'; return
144141
end select
145142
endif
146143
endif
147144
endif
148145

149146
! add upstream, precipitation and subtract evaporation from the lake volume
150-
RCHFLX_out(iens,segIndex)%ROUTE(idxIRF)%REACH_VOL(0) = RCHFLX_out(iens,segIndex)%ROUTE(idxIRF)%REACH_VOL(1) ! updating storage for current time
147+
RCHFLX_out(iens,segIndex)%ROUTE(idxIRF)%REACH_VOL(0) = RCHFLX_out(iens,segIndex)%ROUTE(idxIRF)%REACH_VOL(1) ! updating storage at previous time step
151148
RCHFLX_out(iens,segIndex)%ROUTE(idxIRF)%REACH_VOL(1) = RCHFLX_out(iens,segIndex)%ROUTE(idxIRF)%REACH_VOL(1) + q_upstream * dt ! input upstream discharge from m3/s to m3
152149
RCHFLX_out(iens,segIndex)%ROUTE(idxIRF)%REACH_VOL(1) = RCHFLX_out(iens,segIndex)%ROUTE(idxIRF)%REACH_VOL(1) + RCHFLX_out(iens,segIndex)%BASIN_QR(1) * dt ! add lateral flow
153150
RCHFLX_out(iens,segIndex)%ROUTE(idxIRF)%REACH_VOL(1) = RCHFLX_out(iens,segIndex)%ROUTE(idxIRF)%REACH_VOL(1) + RCHFLX_out(iens,segIndex)%basinprecip * dt ! input lake precipitation

0 commit comments

Comments
 (0)