Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some fixes so can run on izumi #391

Merged
merged 63 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
b19219a
Changes to get to compile with nag compiler on izumi
ekluzek May 28, 2023
a66d4be
More system calls for nag compiler
ekluzek May 28, 2023
c102d44
Nag compiler on izumi has trouble with associated statement on list t…
ekluzek May 28, 2023
50ea376
Merge remote-tracking branch 'escomp/cesm-coupling' into fixfornagoni…
ekluzek May 29, 2023
566bcfb
Update buildnml for later cime, and have the buildnml test use cime f…
ekluzek Jun 3, 2023
9f3e9d6
Update dataset to one that's actually CDF5 so can save it to it can b…
ekluzek Jun 3, 2023
c063cd8
Remove nvhpc on izumi because not available in older ccs_config versi…
ekluzek Jun 3, 2023
bdf4d46
Correct names of namelists, make sure order is correct
ekluzek Jun 3, 2023
4addd32
Do not do the swap if the index is the same -- fixing #397
ekluzek Jun 4, 2023
a4f8bad
Comment out freeDecomp calls when files are closed this allows the co…
ekluzek Jun 5, 2023
90b6c13
Remove the freeDecomp calls for restart, this allows it to run, but i…
ekluzek Jun 6, 2023
e73a99d
Turn mpi-serial on for 1 MPI task tests
ekluzek Jun 6, 2023
f032e37
Fix typo
ekluzek Jun 21, 2023
ae9af5a
Do cleanup after closing the file
ekluzek Jun 21, 2023
08a2fd3
Merge remote-tracking branch 'escomp/cesm-coupling' into fixfornagoni…
ekluzek Jun 21, 2023
1dbfed8
Merge remote-tracking branch 'escomp/cesm-coupling' into fixfornagoni…
ekluzek Jun 22, 2023
7cb9f31
Merge branch 'fixfornagonizumi' of github.com:ekluzek/mizuRoute into …
ekluzek Jun 22, 2023
011a646
Merge remote-tracking branch 'escomp/cesm-coupling' into fixfornagoni…
ekluzek Jun 22, 2023
cf0473c
Merge branch 'fixfornagonizumi' of github.com:ekluzek/mizuRoute into …
ekluzek Jun 22, 2023
a0c5e24
Change MODEL to COMP_NAME fixing #259
ekluzek Jun 22, 2023
6633269
Fix #404, receive buffer needs to be different from send buffer
ekluzek Jun 26, 2023
657221a
Add debug log output level to default coupled-control file
ekluzek Jun 26, 2023
79638d6
Replace shr_sys_flush statements with FORTRAN-2003 flush keyword
ekluzek Jun 26, 2023
1b196e0
Remove the shr_sys_system statement to remove the old file, and make …
ekluzek Jun 26, 2023
4abacaf
GNU compiler requires the IOR intrinsic to be used as a function
ekluzek Jun 26, 2023
713acd6
Comment out the isnan check as not really needed, to get this to work…
ekluzek Jun 26, 2023
3d5c4c7
Fix some spelling errors, and make sure higher resolution tests on iz…
ekluzek Jun 26, 2023
f5d547f
Remove the higher resolution grids from izumi testing
ekluzek Jun 26, 2023
66ae3c5
Add expected fail for the izumi serial ERS test
ekluzek Jun 26, 2023
ccd616d
Merge branch 'fixfornagonizumi' of github.com:ekluzek/mizuRoute into …
ekluzek Jun 26, 2023
cd0d1ff
Merge remote-tracking branch 'escomp/cesm-coupling' into fixfornagoni…
ekluzek Jun 26, 2023
17e8a7e
The ERI test is working now
ekluzek Jun 27, 2023
84fe6a1
Add h_gauge files to history archive
ekluzek Jul 5, 2023
dc4e282
Add ERS test for 5x5_amazon_r05 test case so it's similar to the ERP …
ekluzek Jul 5, 2023
a1345d1
Add history filenames variable name to add to restart file
ekluzek Jul 5, 2023
351fecd
Start adding writing of history files to restart file, something stil…
ekluzek Jul 6, 2023
947cfc2
Update name of the history filenames on the restart file
ekluzek Jul 6, 2023
52f235f
Get writing of history filenames to restart file working correctly
ekluzek Jul 8, 2023
8949241
Change size of history filenames from 300 to 199 as that is what is b…
ekluzek Jul 8, 2023
e20dc41
change name of restart history filename variable so it's not the same…
ekluzek Jul 8, 2023
2f9c126
Comment out lins where rpointer file is overwritten. This doesn't
ekluzek Jul 10, 2023
c9ddf13
Add an explicit log of the file that is being opened and explicitly c…
ekluzek Jul 10, 2023
7fc6cda
Add expected fail, clarify comment
ekluzek Jul 10, 2023
46cab0b
Flush and write to iulog rather than 6 or *
ekluzek Jul 10, 2023
680273b
Remove some variables not being used
ekluzek Jul 10, 2023
28d3d68
Remove commented out line
ekluzek Jul 10, 2023
60be9ae
Merge remote-tracking branch 'escomp/cesm-coupling' into fixfornagoni…
ekluzek Jul 11, 2023
c2f38af
Reverse order of type definitions so one used first is defined first,…
ekluzek Jul 12, 2023
ecfc3e4
Have PIO free decomp use the PIO System rather than the PIO file desc…
ekluzek Jul 13, 2023
e01af9f
Move file close for restart to before free PIO decomp calls, and unco…
ekluzek Jul 13, 2023
b5c3623
Increase filename size from 199 to 300
ekluzek Jul 13, 2023
3181ea9
Fix expected fail
ekluzek Jul 13, 2023
5a16e21
Merge branch 'fixfornagonizumi' of github.com:ekluzek/mizuRoute into …
ekluzek Jul 13, 2023
ef39001
Merge branch 'fixfornagonizumi' of github.com:ekluzek/mizuRoute into …
ekluzek Jul 13, 2023
8e175b5
Change file string length to a parameter
ekluzek Jul 13, 2023
507aace
Remove some of the character options known to NOT work
ekluzek Jul 13, 2023
dd6bfb3
Fully remove the bit about updating the restart pointer file when the…
ekluzek Jul 13, 2023
c5780d3
Always start simulations at current time, this fixes #391, for startu…
ekluzek Jul 18, 2023
befdfa6
Add some more ERI tests
ekluzek Jul 18, 2023
b671342
Add to expected fails
ekluzek Jul 19, 2023
18ea762
Add expected fail
ekluzek Jul 19, 2023
a582644
Change ERI test on izumi to gnu compiler since nag without DEBUG does…
ekluzek Jul 19, 2023
030479e
Add an expected fail for izumi_gnu for ERI
ekluzek Jul 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion route/build/cpl/RtmMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ SUBROUTINE get_hru_area(NETOPO_in, RPARAM_in, offset, verbose)
do iHru = 1, nCatch
ix = NETOPO_in(iRch)%HRUIX(iHru)
if (present(offset)) ix = ix+offset
write(iulog, '(a,x,5(g20.12))') &
write(iulog, '(a,1x,5(g20.12))') &
'reachID, hruID, basinArea [m2], weight[-], hruArea [m2]=', &
NETOPO_in(iRch)%REACHID, NETOPO_in(iRch)%HRUID(iHru), RPARAM_in(iRch)%BASAREA, &
NETOPO_in(iRch)%HRUWGT(iHru), rtmCTL%area(ix)
Expand Down
27 changes: 17 additions & 10 deletions route/build/cpl/RtmTimeManager.F90
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
MODULE RtmTimeManager

USE ESMF
USE shr_kind_mod, ONLY: r8 => shr_kind_r8
USE shr_sys_mod , ONLY: shr_sys_abort, shr_sys_flush
USE public_var , ONLY: iulog
Expand All @@ -21,14 +20,14 @@ MODULE RtmTimeManager
logical, parameter :: debug_write = .true.

! Input from CESM driver
integer, save :: nelapse = integerMissing, & ! number of timesteps (or days if negative) to extend a run
integer :: nelapse = integerMissing, & ! number of timesteps (or days if negative) to extend a run
ekluzek marked this conversation as resolved.
Show resolved Hide resolved
start_ymd = integerMissing, & ! starting date for run in yearmmdd format
start_tod = 0, & ! starting time of day for run in seconds
stop_ymd = integerMissing, & ! stopping date for run in yearmmdd format
stop_tod = 0, & ! stopping time of day for run in seconds
ref_ymd = integerMissing, & ! reference date for time coordinate in yearmmdd format
ref_tod = 0 ! reference time of day for time coordinate in seconds
logical, save :: tm_first_restart_step = .false. ! true for first step of a restart or branch run
logical :: tm_first_restart_step = .false. ! true for first step of a restart or branch run

CONTAINS

Expand Down Expand Up @@ -60,7 +59,6 @@ SUBROUTINE init_time(ierr, message)
character(*), intent(out) :: message ! error message
! local variable
integer :: nTime
integer :: ix
real(r8) :: dt_day ! simulation time step in day
real(r8) :: timePerDay ! number of time-unit per a day. time-unit is from t_unit
real(r8) :: secPerTime ! number of sec per time-unit. time-unit is from t_unit
Expand All @@ -82,7 +80,10 @@ SUBROUTINE init_time(ierr, message)
case('hours','hour','hr','h'); secPerTime=3600._r8; timePerDay=24._r8
case('days','day','d'); secPerTime=86400._r8; timePerDay=1._r8
case default
ierr=20; message=trim(message)//'<time_units>= '//trim(time_units)//': <time_units> must be seconds, minutes, hours or days.'; return
ierr=20
message=trim(message)//'<time_units>= '//trim(time_units)// &
': <time_units> must be seconds, minutes, hours or days.'
return
end select

dt_day = dt/secprday ! dt [sec] -> dt_day
Expand Down Expand Up @@ -114,7 +115,11 @@ SUBROUTINE init_time(ierr, message)
timeVar = (begJulday - refJulday)*timePerDay

! check that the dates are aligned
if(endDatetime < begDatetime) then; ierr=20; message=trim(message)//'simulation end is before simulation start'; return; endif
if(endDatetime < begDatetime) then
ierr=20
message=trim(message)//'simulation end is before simulation start'
return
endif

! initialize model time at first time step (1) and previous time step (0)
iTime = 1
Expand All @@ -125,8 +130,10 @@ SUBROUTINE init_time(ierr, message)
if (masterproc .and. debug_write) then
write(iulog,*) 'simStart datetime = ', trim(simStart)
write(iulog,*) 'simEnd datetime = ', trim(simEnd)
write(iulog,*) 'reference datetime = ', refDatetime%year(), refDatetime%month(), refDatetime%day(), refDatetime%hour(), refDatetime%minute(), refDatetime%sec()
write(iulog,*) 'simDatetime = ', simDatetime(1)%year(), simDatetime(1)%month(), simDatetime(1)%day(), simDatetime(1)%hour(), simDatetime(1)%minute(), simDatetime(1)%sec()
write(iulog,*) 'reference datetime = ', refDatetime%year(), refDatetime%month(), refDatetime%day(), &
refDatetime%hour(), refDatetime%minute(), refDatetime%sec()
write(iulog,*) 'simDatetime = ', simDatetime(1)%year(), simDatetime(1)%month(), &
simDatetime(1)%day(), simDatetime(1)%hour(), simDatetime(1)%minute(), simDatetime(1)%sec()
write(iulog,*) 'dt [sec] = ', dt
write(iulog,*) 'nTime = ', nTime
write(iulog,*) 'iTime, timeVar(iTime) = ', iTime, timeVar
Expand All @@ -139,6 +146,7 @@ END SUBROUTINE init_time
! Public subroutine:
SUBROUTINE shr_timeStr(esmfTime, timeStr)

USE ESMF , ONLY: ESMF_Time, ESMF_TimeGet
implicit none

! Arguments
Expand All @@ -151,9 +159,8 @@ SUBROUTINE shr_timeStr(esmfTime, timeStr)

call ESMF_TimeGet(esmfTime , yy=yy, mm=mm, dd=dd, h=hr, m=mn, s=sec, rc=rc )

write(timeStr,'(i4.4,a,i2.2,a,i2.2,a,i2.2,a,i2.2,a,i2.2)'), yy,'-',mm,'-',dd,' ',hr,':',mn,':',sec
write(timeStr,'(i4.4,a1,i2.2,a1,i2.2,a1,i2.2,a1,i2.2,a1,i2.2)') yy,'-',mm,'-',dd,' ',hr,':',mn,':',sec

END SUBROUTINE shr_timeStr


END MODULE RtmTimeManager
6 changes: 3 additions & 3 deletions route/build/src/accum_runoff.f90
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ SUBROUTINE accum_qupstream(iEns, & ! input: index of runoff ensemble to
! check
if(segIndex == ixDesire)then
write(iulog,'(2a)') new_line('a'),'** Check upstream discharge accumulation **'
write(iulog,'(a,x,I10,x,I10)') ' Reach index & ID =', segIndex, NETOPO_in(segIndex)%REACHID
write(iulog,'(a,1x,I10,1x,I10)') ' Reach index & ID =', segIndex, NETOPO_in(segIndex)%REACHID
if (nUps>0) then
write(fmt1,'(A,I5,A)') '(A,1X',nUps,'(1X,I10))'
write(fmt2,'(A,I5,A)') '(A,1X',nUps,'(1X,F20.7))'
Expand All @@ -172,8 +172,8 @@ SUBROUTINE accum_qupstream(iEns, & ! input: index of runoff ensemble to
write(iulog,fmt2) ' prflux =', (RCHFLX_out(iens,NETOPO_in(segIndex)%UREACHI(iUps))%ROUTE(idxSUM)%REACH_Q, iUps=1,nUps)
end if
write(iulog,'(a)') ' * local area discharge (RCHFLX_out%BASIN_QR(1)) and final discharge (RCHFLX_out%ROUTE(idxSUM)%REACH_Q) [m3/s] :'
write(iulog,'(a,x,G15.4)') ' RCHFLX_out%BASIN_QR(1) =', RCHFLX_out(iEns,segIndex)%BASIN_QR(1)
write(iulog,'(a,x,G15.4)') ' RCHFLX_out%ROUTE(idxSUM)%REACH_Q =', RCHFLX_out(iens,segIndex)%ROUTE(idxSUM)%REACH_Q
write(iulog,'(a,1x,G15.4)') ' RCHFLX_out%BASIN_QR(1) =', RCHFLX_out(iEns,segIndex)%BASIN_QR(1)
write(iulog,'(a,1x,G15.4)') ' RCHFLX_out%ROUTE(idxSUM)%REACH_Q =', RCHFLX_out(iens,segIndex)%ROUTE(idxSUM)%REACH_Q
endif

END SUBROUTINE accum_qupstream
Expand Down
4 changes: 3 additions & 1 deletion route/build/src/ascii_utils.f90
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,10 @@ SUBROUTINE get_vlines(unt,vlines,err,message)
vlines(current%ix) = current%chardat
previous=>current; current=>current%next
deallocate(previous)
nullify(previous)
end do
if(associated(list)) nullify(list)
nullify(list)
!if(associated(list)) nullify(list)
ekluzek marked this conversation as resolved.
Show resolved Hide resolved
END SUBROUTINE get_vlines

! **********************************************************************************************
Expand Down
24 changes: 13 additions & 11 deletions route/build/src/dfw_route.f90
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,11 @@ SUBROUTINE dfw_rch(iEns, segIndex, & ! input: index of runoff ensemble to be pro
if (nUps>0) then
do iUps = 1,nUps
iRch_ups = NETOPO_in(segIndex)%UREACHI(iUps) ! index of upstream of segIndex-th reach
write(iulog,'(A,X,I12,X,G15.4)') ' UREACHK, uprflux=',NETOPO_in(segIndex)%UREACHK(iUps),RCHFLX_out(iens, iRch_ups)%ROUTE(idxDW)%REACH_Q
write(iulog,'(A,1X,I12,1X,G15.4)') ' UREACHK, uprflux=',NETOPO_in(segIndex)%UREACHK(iUps), &
RCHFLX_out(iens, iRch_ups)%ROUTE(idxDW)%REACH_Q
enddo
end if
write(iulog,'(A,X,G15.4)') ' RCHFLX_out(iEns,segIndex)%BASIN_QR(1)=',RCHFLX_out(iEns,segIndex)%BASIN_QR(1)
write(iulog,'(A,1X,G15.4)') ' RCHFLX_out(iEns,segIndex)%BASIN_QR(1)=',RCHFLX_out(iEns,segIndex)%BASIN_QR(1)
endif

! solve diffusive wave equation
Expand All @@ -204,16 +205,17 @@ SUBROUTINE dfw_rch(iEns, segIndex, & ! input: index of runoff ensemble to be pro
verbose, & ! input: reach index to be examined
ierr, cmessage) ! output: error control
if(ierr/=0)then
write(message, '(A,X,I12,X,A)') trim(message)//'/segment=', NETOPO_in(segIndex)%REACHID, '/'//trim(cmessage)
write(message, '(A,1X,I12,1X,A)') trim(message)//'/segment=', NETOPO_in(segIndex)%REACHID, '/'//trim(cmessage)
return
endif

if(verbose)then
write(iulog,'(A,X,G15.4)') ' RCHFLX_out(iens,segIndex)%REACH_Q=', RCHFLX_out(iens,segIndex)%ROUTE(idxDW)%REACH_Q
write(iulog,'(A,1X,G15.4)') ' RCHFLX_out(iens,segIndex)%REACH_Q=', RCHFLX_out(iens,segIndex)%ROUTE(idxDW)%REACH_Q
endif

if (RCHFLX_out(iens,segIndex)%ROUTE(idxDW)%REACH_VOL(1) < 0) then
write(iulog,'(A,X,G12.5,X,A,X,I9)') ' ---- NEGATIVE VOLUME = ', RCHFLX_out(iens,segIndex)%ROUTE(idxDW)%REACH_VOL(1), 'at ', NETOPO_in(segIndex)%REACHID
write(iulog,'(A,1X,G12.5,1X,A,1X,I9)') ' ---- NEGATIVE VOLUME = ', RCHFLX_out(iens,segIndex)%ROUTE(idxDW)%REACH_VOL(1), &
'at ', NETOPO_in(segIndex)%REACHID
end if

call comp_reach_wb(NETOPO_in(segIndex)%REACHID, idxDW, q_upstream, RCHFLX_out(iens,segIndex), verbose, lakeFlag=.false.)
Expand Down Expand Up @@ -348,17 +350,17 @@ SUBROUTINE diffusive_wave(rch_param, & ! input: river parameter data structu
dx = rch_param%RLENGTH/(Nx-1) ! one extra sub-segment beyond outlet

if (verbose) then
write(iulog,'(A,X,G12.5)') ' length [m] =',rch_param%RLENGTH
write(iulog,'(A,X,G12.5)') ' slope [-] =',rch_param%R_SLOPE
write(iulog,'(A,X,G12.5)') ' channel width [m] =',rch_param%R_WIDTH
write(iulog,'(A,X,G12.5)') ' manning coef [-] =',rch_param%R_MAN_N
write(iulog,'(A,1X,G12.5)') ' length [m] =',rch_param%RLENGTH
write(iulog,'(A,1X,G12.5)') ' slope [-] =',rch_param%R_SLOPE
write(iulog,'(A,1X,G12.5)') ' channel width [m] =',rch_param%R_WIDTH
write(iulog,'(A,1X,G12.5)') ' manning coef [-] =',rch_param%R_MAN_N
end if

! time-step adjustment so Courant number is less than 1
dTsub = dt/ntSub

if (verbose) then
write(iulog,'(A,X,I3,A,X,G12.5)') ' No. sub timestep=',nTsub,' sub time-step [sec]=',dTsub
write(iulog,'(A,1X,I3,A,1X,G12.5)') ' No. sub timestep=',nTsub,' sub time-step [sec]=',dTsub
end if

allocate(Qlocal(1:nMolecule%DW_ROUTE, 0:1), stat=ierr, errmsg=cmessage)
Expand Down Expand Up @@ -451,7 +453,7 @@ SUBROUTINE diffusive_wave(rch_param, & ! input: river parameter data structu

if (verbose) then
write(fmt1,'(A,I5,A)') '(A,1X',nMolecule%DW_ROUTE,'(1X,G15.4))'
write(iulog,'(A,X,G12.5)') ' rflux%REACH_Q= ', rflux%ROUTE(idxDW)%REACH_Q
write(iulog,'(A,1X,G12.5)') ' rflux%REACH_Q= ', rflux%ROUTE(idxDW)%REACH_Q
write(iulog,fmt1) ' Qprev(1:nMolecule)= ', Qprev(1:nMolecule%DW_ROUTE)
write(iulog,'(A,5(1X,G12.5))') ' Qbar, Abar, Vbar, ck, dk= ',Qbar, Abar, Vbar, ck, dk
write(iulog,'(A,2(1X,G12.5))') ' Cd, Ca= ', Cd, Ca
Expand Down
4 changes: 2 additions & 2 deletions route/build/src/domain_decomposition.f90
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ SUBROUTINE print_screen()
associate (segIndexSub => domains_mpi(ix)%segIndex, nSubSeg => size(domains_mpi(ix)%segIndex))
do iSeg = 1,size(segIndexSub)
if (downIndex(segIndexSub(iSeg)) > 0) then
write(iulog, "(I9,x,I12,x,I9,x,I12,x,I5,x,I3)") segIndexSub(iSeg),segId(segIndexSub(iSeg)), &
write(iulog, "(I9,1x,I12,1x,I9,1x,I12,1x,I5,1x,I3)") segIndexSub(iSeg),segId(segIndexSub(iSeg)), &
downIndex(segIndexSub(iSeg)),segId(downIndex(segIndexSub(iSeg))), &
ix, domains_mpi(ix)%idNode
else
write(iulog, "(I9,x,I12,x,I9,x,I12,x,I5,x,I3)") segIndexSub(iSeg),segId(segIndexSub(iSeg)), &
write(iulog, "(I9,1x,I12,1x,I9,1x,I12,1x,I5,1x,I3)") segIndexSub(iSeg),segId(segIndexSub(iSeg)), &
downIndex(segIndexSub(iSeg)),-999, &
ix, domains_mpi(ix)%idNode
endif
Expand Down
4 changes: 2 additions & 2 deletions route/build/src/histVars_data.f90
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ SUBROUTINE aggregate(this, & ! inout:
case(muskingumCunge); idxMethod=idxMC
case(diffusiveWave); idxMethod=idxDW
case default
write(message,'(2A,X,G0,X,A)') trim(message), 'routing method index:',routeMethods(iRoute), 'must be 0-5'
write(message,'(2A,1X,G0,1X,A)') trim(message), 'routing method index:',routeMethods(iRoute), 'must be 0-5'
ierr=81; return
end select

Expand Down Expand Up @@ -435,7 +435,7 @@ SUBROUTINE read_restart(this, restart_name, ierr, message)
ixFlow=ixRFLX%DWroutedRunoff
ixVol=ixRFLX%DWvolume
case default
write(message,'(2A,X,G0,X,A)') trim(message), 'routing method index:',routeMethods(ixRoute), 'must be 0-5'
write(message,'(2A,1X,G0,1X,A)') trim(message), 'routing method index:',routeMethods(ixRoute), 'must be 0-5'
ierr=81; return
end select

Expand Down
4 changes: 3 additions & 1 deletion route/build/src/init_model_data.f90
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ SUBROUTINE init_ntopo(nHRU_out, nRch_out,
USE process_ntopo, ONLY: check_river_properties ! check if river network data is physically valid
USE ncio_utils, ONLY: get_var_dims
USE process_ntopo, ONLY: augment_ntopo ! compute all the additional network topology (only compute option = on)
USE shr_sys_mod, ONLY: shr_sys_system

implicit none
! Argument variables
Expand Down Expand Up @@ -587,7 +588,8 @@ SUBROUTINE init_ntopo(nHRU_out, nRch_out,
! --> users can modify the hard-coded parameter "maxUpstreamFile" if desired
if(tot_upstream > maxUpstreamFile) tot_upstream=0

call system('rm -f '//trim(ancil_dir)//trim(fname_ntopNew))
call shr_sys_system('rm -f '//trim(ancil_dir)//trim(fname_ntopNew), ierr)
ekluzek marked this conversation as resolved.
Show resolved Hide resolved
if(ierr/=0)then; message=trim(message)//trim("Error in system call to remove fil"); return; endif

call writeData(&
! input
Expand Down
19 changes: 11 additions & 8 deletions route/build/src/irf_route.f90
Original file line number Diff line number Diff line change
Expand Up @@ -222,20 +222,23 @@ SUBROUTINE irf_rch(iEns, & ! input: index of runoff ensemble to be proce
ntdh = size(NETOPO_in(segIndex)%UH)
write(fmt1,'(A,I5,A)') '(A, 1X',ntdh,'(1X,F20.7))'
write(*,'(2a)') new_line('a'),'** Check Impulse Response Function routing **'
write(*,'(a,x,I10,x,I10)') ' Reach index & ID =', segIndex, NETOPO_in(segIndex)%REACHID
write(*,fmt1) ' Unit-Hydrograph =', (NETOPO_in(segIndex)%UH(itdh), itdh=1,ntdh)
write(*,'(a)') ' * total discharge from upstream(q_upstream) [m3/s], local area discharge [m3/s], and Final discharge [m3/s]:'
write(*,'(a,x,F15.7)') ' q_upstream =', q_upstream
write(*,'(a,x,F15.7)') ' RCHFLX_out%BASIN_QR(1) =', RCHFLX_out(iens,segIndex)%BASIN_QR(1)
write(*,'(a,x,F15.7)') ' RCHFLX_out%REACH_Q =', RCHFLX_out(iens,segIndex)%ROUTE(idxIRF)%REACH_Q
write(*,'(a,1x,I10,1x,I10)')' Reach index & ID =', segIndex, NETOPO_in(segIndex)%REACHID
write(*,fmt1) ' Unit-Hydrograph =', (NETOPO_in(segIndex)%UH(itdh), itdh=1,ntdh)
write(*,'(a)') ' * total discharge from upstream(q_upstream) [m3/s], local area discharge [m3/s]' // &
', and Final discharge [m3/s]:'
write(*,'(a,1x,F15.7)') ' q_upstream =', q_upstream
write(*,'(a,1x,F15.7)') ' RCHFLX_out%BASIN_QR(1) =', RCHFLX_out(iens,segIndex)%BASIN_QR(1)
write(*,'(a,1x,F15.7)') ' RCHFLX_out%REACH_Q =', RCHFLX_out(iens,segIndex)%ROUTE(idxIRF)%REACH_Q
endif

if (RCHFLX_out(iens,segIndex)%ROUTE(idxIRF)%REACH_VOL(1) < 0) then
write(iulog,'(A,X,G12.5,X,A,X,I9)') ' ---- NEGATIVE VOLUME [m3]= ', RCHFLX_out(iens,segIndex)%ROUTE(idxIRF)%REACH_VOL(1), 'at ', NETOPO_in(segIndex)%REACHID
write(iulog,'(A,1X,G12.5,1X,A,1X,I9)') ' ---- NEGATIVE VOLUME [m3]= ', RCHFLX_out(iens,segIndex)%ROUTE(idxIRF)%REACH_VOL(1), &
'at ', NETOPO_in(segIndex)%REACHID
! RCHFLX_out(iens,segIndex)%ROUTE(idxIRF)%REACH_VOL(1) = 0._dp
end if
if (RCHFLX_out(iens,segIndex)%ROUTE(idxIRF)%REACH_Q < 0) then
write(iulog,'(A,X,G12.5,X,A,X,I9)') ' ---- NEGATIVE FLOW [m3/s] = ', RCHFLX_out(iens,segIndex)%ROUTE(idxIRF)%REACH_Q, 'at ', NETOPO_in(segIndex)%REACHID
write(iulog,'(A,1X,G12.5,1X,A,1X,I9)') ' ---- NEGATIVE FLOW [m3/s] = ', RCHFLX_out(iens,segIndex)%ROUTE(idxIRF)%REACH_Q, &
'at ', NETOPO_in(segIndex)%REACHID
! RCHFLX_out(iens,segIndex)%ROUTE(idxIRF)%REACH_Q = 0._dp
end if

Expand Down
Loading