Skip to content

Commit 75b7e3a

Browse files
authored
Merge pull request #596 from nmizukami/cpl_fixes
Corrections related to CESM/CTSM coupling
2 parents c0b1de1 + eb2efed commit 75b7e3a

3 files changed

Lines changed: 14 additions & 17 deletions

File tree

route/build/cpl/RtmMod.F90

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ MODULE RtmMod
1212
ice_runoff, do_rof, do_flood, &
1313
river_depth_minimum, &
1414
nsrContinue, nsrBranch, nsrStartup, nsrest, &
15-
cfile_name, coupling_period, delt_coupling, nsub, &
15+
cfile_name, coupling_period, nsub, &
1616
caseid, brnch_retain_casename, inst_name, &
1717
barrier_timers
1818
USE RunoffMod, ONLY: rtmCTL, RunoffInit ! rof related data objects
@@ -121,18 +121,16 @@ SUBROUTINE route_ini(rof_active,flood_active)
121121
!-------------------------------------------------------
122122
! 1. Get ROF subcycling
123123
!-------------------------------------------------------
124-
delt_coupling = coupling_period*secprday ! day -> sec
125-
126-
if (abs(mod(delt_coupling, dt)-0._r8)>0._r8) then
124+
if (abs(mod(coupling_period, dt)-0._r8)>0._r8) then
127125
if (masterproc) then
128-
write(iulog,'(2a,g20.12,a)') trim(subname),' mizuRoute coupling period ', delt_coupling, '[sec]'
126+
write(iulog,'(2a,g20.12,a)') trim(subname),' mizuRoute coupling period ', coupling_period, '[sec]'
129127
write(iulog,'(2a,g20.12,a)') trim(subname),' mizuRoute simulation step <dt_qstim> ', dt, '[sec]'
130-
write(iulog, '(2A)') trim(subname),'WARNING: multiple of <dt_qsim> [sec] better to be delt_coupling [sec]'
128+
write(iulog, '(2A)') trim(subname),'WARNING: multiple of <dt_qsim> [sec] better to be coupling_period [sec]'
131129
end if
132130
end if
133131

134-
nsub = delt_coupling/dt
135-
if (nsub*dt < delt_coupling) then
132+
nsub = coupling_period/dt
133+
if (nsub*dt < coupling_period) then
136134
nsub = nsub + 1
137135
end if
138136

@@ -442,19 +440,19 @@ SUBROUTINE route_run(rstwr)
442440
rtmCTL%qirrig_actual = -1._r8* rtmCTL%qirrig ! actual water take [mm/s] - positive (take) or negative (inject)
443441
do nr = rtmCTL%begr,rtmCTL%endr
444442
! calculate depth of irrigation [mm] during timestep
445-
irrig_depth = rtmCTL%qirrig_actual(nr)* delt_coupling
443+
irrig_depth = rtmCTL%qirrig_actual(nr)* coupling_period
446444
river_depth = rtmCTL%volr(nr)* 1000._r8 ! m to mm
447445

448446
! compare irrig_depth [mm] to previous channel storage [mm];
449447
! add overage to subsurface runoff
450448
! later check negative qsub is handle the same as qgwl
451449
if(irrig_depth > river_depth) then
452-
rtmCTL%qsub(nr,1) = rtmCTL%qsub(nr,1) + (river_depth-irrig_depth)/delt_coupling
450+
rtmCTL%qsub(nr,1) = rtmCTL%qsub(nr,1) + (river_depth-irrig_depth)/coupling_period
453451
irrig_depth = river_depth
454452

455453
! actual irrigation rate [mm/s]
456454
! i.e. the rate actually removed from the river channel
457-
rtmCTL%qirrig_actual(nr) = irrig_depth/delt_coupling
455+
rtmCTL%qirrig_actual(nr) = irrig_depth/coupling_period
458456
endif
459457
end do
460458

@@ -485,7 +483,7 @@ SUBROUTINE route_run(rstwr)
485483
! send qgwl directly to ocean
486484

487485
! --- calculate depth of qgwl flux [mm] during timestep
488-
qgwl_depth = rtmCTL%qgwl(nr,1)* delt_coupling
486+
qgwl_depth = rtmCTL%qgwl(nr,1)* coupling_period
489487
river_depth = rtmCTL%volr(nr)* 1000._r8 ! convert m to mm
490488

491489
if ((qgwl_depth + river_depth < river_depth_minimum) &
@@ -740,7 +738,7 @@ SUBROUTINE get_river_export_data(NETOPO_in, RCHFLX_in, &
740738
rtmCTL%volr(ix) = RCHFLX_in(iRch)%ROUTE(iRoute)%REACH_VOL(1)*NETOPO_in(iRch)%HRUWGT(iHru)/rtmCTL%area(ix)
741739
end if
742740
if (update_q) then
743-
if (NETOPO_in(ix)%DREACHI==-1 .and. NETOPO_in(ix)%DREACHK<=0) then ! if reach is the outlet
741+
if (NETOPO_in(iRch)%DREACHI==-1 .and. NETOPO_in(iRch)%DREACHK<=0) then ! if reach is the outlet
744742
rtmCTL%discharge(ix,1) = RCHFLX_in(iRch)%ROUTE(iRoute)%REACH_Q* NETOPO_in(iRch)%HRUWGT(iHru)/rtmCTL%area(ix)/0.001_r8
745743
end if
746744
end if

route/build/cpl/RtmVar.F90

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@ MODULE RtmVar
5151
logical, public :: do_flood = .false. !
5252
character(len=CL), public :: nrevsn_rtm = ' ' ! restart data file name for branch run
5353
real(r8), public :: river_depth_minimum = 1.e-1 ! minimum river depth for water take [mm]
54-
real(r8), public :: delt_coupling ! coupling period [sec]
5554
integer, public :: nsub ! number of subcyling for rof simulation per coupling
56-
integer, public :: coupling_period ! coupling period [day]
55+
real(r8), public :: coupling_period ! coupling period [sec]
5756
integer, public :: rtmhist_ndens = 1 ! namelist: output density of netcdf history files
5857
integer, public :: rtmhist_mfilt = 30 ! namelist: number of time samples per tape
5958
integer, public :: rtmhist_nhtfrq = 0 ! namelist: history write freq(0=monthly)

route/build/cpl/nuopc/rof_comp_nuopc.F90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ module rof_comp_nuopc
3535
USE RtmVar , ONLY : cfile_name
3636
use RtmVar , only : inst_index, inst_suffix, inst_name, rofVarSet
3737
use RtmVar , only : nsrStartup, nsrContinue, nsrBranch
38-
use RtmVar , only : coupling_period !day
38+
use RtmVar , only : coupling_period !sec
3939

4040
use perf_mod , only : t_startf, t_stopf, t_barrierf
4141
use rof_import_export , only : advertise_fields, realize_fields
@@ -451,7 +451,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
451451
if (ChkErr(rc,__LINE__,u_FILE_u)) return
452452

453453
! Get coupling interval in day
454-
call ESMF_TimeIntervalGet( timeStep, d=coupling_period, rc=rc)
454+
call ESMF_TimeIntervalGet( timeStep, s_r8=coupling_period, rc=rc)
455455
if (ChkErr(rc,__LINE__,u_FILE_u)) return
456456

457457
! get ymd integer and string for start time, end time and reference time

0 commit comments

Comments
 (0)