Skip to content

Commit

Permalink
Update mosart to mosart1_0_10
Browse files Browse the repository at this point in the history
new input file
new direct terms
new areatot
update history files

[Non-BFB]

LG-20
  • Loading branch information
apcraig committed Dec 3, 2015
1 parent 5f404ff commit b25233e
Show file tree
Hide file tree
Showing 6 changed files with 295 additions and 121 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ for the CLM data in the CESM distribution

<!-- River Transport Model river routing file (relative to {csmdata}) -->

<frivinp_rtm rof_grid="r05" >rof/mosart/MOSART_Global_half_20151015a.nc</frivinp_rtm>
<frivinp_rtm rof_grid="r05" >rof/mosart/MOSART_Global_half_20151130a.nc</frivinp_rtm>
<frivinp_rtm rof_grid="NLDAS" >rof/mosart/MOSART_NLDAS_8th.nc</frivinp_rtm>

</namelist_defaults>
44 changes: 26 additions & 18 deletions models/rof/mosart/src/riverroute/MOSART_physics_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,20 @@ subroutine Euler
! hillslope
!------------------

call t_startf('mosart_hillslope')
call t_startf('mosartr_hillslope')
do nt=1,nt_rtm
if (TUnit%euler_calc(nt)) then
do iunit=rtmCTL%begr,rtmCTL%endr
if(TUnit%mask(iunit) > 0 .and. TUnit%areaTotal(iunit) > 0._r8) then
if(TUnit%mask(iunit) > 0) then
call hillslopeRouting(iunit,nt,Tctl%DeltaT)
TRunoff%wh(iunit,nt) = TRunoff%wh(iunit,nt) + TRunoff%dwh(iunit,nt) * Tctl%DeltaT
call UpdateState_hillslope(iunit,nt)
TRunoff%etin(iunit,nt) = (-TRunoff%ehout(iunit,nt) + TRunoff%qsub(iunit,nt)) * TUnit%area(iunit) * TUnit%frac(iunit)
endif
end do
endif
end do
call t_stopf('mosart_hillslope')
call t_stopf('mosartr_hillslope')

TRunoff%flow = 0._r8
TRunoff%erout_prev = 0._r8
Expand All @@ -76,20 +78,23 @@ subroutine Euler

!--- accumulate/average erout at prior timestep (used in eroutUp calc) for budget analysis
do nt=1,nt_rtm
if (TUnit%euler_calc(nt)) then
do iunit=rtmCTL%begr,rtmCTL%endr
TRunoff%erout_prev(iunit,nt) = TRunoff%erout_prev(iunit,nt) + TRunoff%erout(iunit,nt)
enddo
enddo
end do
endif
end do

!------------------
! subnetwork
!------------------

call t_startf('mosart_subnetwork')
call t_startf('mosartr_subnetwork')
TRunoff%erlateral(:,:) = 0._r8
do nt=1,nt_rtm
if (TUnit%euler_calc(nt)) then
do iunit=rtmCTL%begr,rtmCTL%endr
if(TUnit%mask(iunit) > 0 .and. TUnit%areaTotal(iunit) > 0._r8) then
if(TUnit%mask(iunit) > 0) then
localDeltaT = Tctl%DeltaT/Tctl%DLevelH2R/TUnit%numDT_t(iunit)
do k=1,TUnit%numDT_t(iunit)
call subnetworkRouting(iunit,nt,localDeltaT)
Expand All @@ -100,20 +105,21 @@ subroutine Euler
TRunoff%erlateral(iunit,nt) = TRunoff%erlateral(iunit,nt) / TUnit%numDT_t(iunit)
endif
end do ! iunit
endif ! euler_calc
end do ! nt
call t_stopf('mosart_subnetwork')
call t_stopf('mosartr_subnetwork')

!------------------
! upstream interactions
!------------------

if (barrier_timers) then
call t_startf('mosart_SMeroutUp_barrier')
call t_startf('mosartr_SMeroutUp_barrier')
call mpi_barrier(mpicom_rof,ier)
call t_stopf('mosart_SMeroutUp_barrier')
call t_stopf('mosartr_SMeroutUp_barrier')
endif

call t_startf('mosart_SMeroutUp')
call t_startf('mosartr_SMeroutUp')
TRunoff%eroutUp = 0._r8
#ifdef NO_MCT
do iunit=rtmCTL%begr,rtmCTL%endr
Expand Down Expand Up @@ -147,7 +153,7 @@ subroutine Euler
enddo
enddo
#endif
call t_stopf('mosart_SMeroutUp')
call t_stopf('mosartr_SMeroutUp')

TRunoff%eroutup_avg = TRunoff%eroutup_avg + TRunoff%eroutUp
TRunoff%erlat_avg = TRunoff%erlat_avg + TRunoff%erlateral
Expand All @@ -156,10 +162,11 @@ subroutine Euler
! channel routing
!------------------

call t_startf('mosart_chanroute')
call t_startf('mosartr_chanroute')
do nt=1,nt_rtm
if (TUnit%euler_calc(nt)) then
do iunit=rtmCTL%begr,rtmCTL%endr
if(TUnit%mask(iunit) > 0 .and. TUnit%areaTotal(iunit) > TINYVALUE) then
if(TUnit%mask(iunit) > 0) then
localDeltaT = Tctl%DeltaT/Tctl%DLevelH2R/TUnit%numDT_r(iunit)
temp_erout = 0._r8
do k=1,TUnit%numDT_r(iunit)
Expand All @@ -177,11 +184,12 @@ subroutine Euler
TRunoff%erout(iunit,nt) = temp_erout
TRunoff%flow(iunit,nt) = TRunoff%flow(iunit,nt) - TRunoff%erout(iunit,nt)
endif
end do
end do
end do ! iunit
endif ! euler_calc
end do ! nt
negchan = min(negchan, minval(TRunoff%wr(:,:)))

call t_stopf('mosart_chanroute')
call t_stopf('mosartr_chanroute')
end do

! check for negative channel storage
Expand Down Expand Up @@ -294,7 +302,7 @@ subroutine Routing_KW(iunit, nt, theDeltaT)
TRunoff%vr(iunit,nt) = 0._r8
TRunoff%erout(iunit,nt) = -TRunoff%erin(iunit,nt)-TRunoff%erlateral(iunit,nt)
else
if(TUnit%areaTotal(iunit)/TUnit%rwidth(iunit)/TUnit%rlen(iunit) > 1e6_r8) then
if(TUnit%areaTotal2(iunit)/TUnit%rwidth(iunit)/TUnit%rlen(iunit) > 1e6_r8) then
TRunoff%erout(iunit,nt) = -TRunoff%erin(iunit,nt)-TRunoff%erlateral(iunit,nt)
else
! !TRunoff%vr(iunit,nt) = CRVRMAN(TUnit%rslp(iunit), TUnit%nr(iunit), TRunoff%rr(iunit,nt))
Expand Down
21 changes: 17 additions & 4 deletions models/rof/mosart/src/riverroute/RtmHistFile.F90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module RtmHistFile
! !USES:
use shr_kind_mod , only : r8 => shr_kind_r8
use shr_sys_mod , only : shr_sys_flush, shr_sys_abort
use RunoffMod , only : rtmCTL
use RunoffMod , only : rtmCTL, Tunit
use RtmVar , only : rtmlon, rtmlat, spval, ispval, secspday, frivinp_rtm, &
iulog, nsrest, caseid, inst_suffix, nsrStartup, nsrBranch, &
ctitle, version, hostname, username, conventions, source
Expand Down Expand Up @@ -809,8 +809,14 @@ subroutine htape_timeconst(t, mode)
long_name='runoff coordinate longitude', units='degrees_east', ncid=nfid(t))
call ncd_defvar(varname='lat', xtype=tape(t)%ncprec, dim1name='lat', &
long_name='runoff coordinate latitude', units='degrees_north', ncid=nfid(t))
! call ncd_defvar(varname='mask', xtype=ncd_int, dim1name='lon', dim2name='lat', &
! long_name='runoff mask', units='unitless', ncid=nfid(t))
call ncd_defvar(varname='mask', xtype=ncd_int, dim1name='lon', dim2name='lat', &
long_name='runoff mask', units='unitless', ncid=nfid(t))
call ncd_defvar(varname='area', xtype=tape(t)%ncprec, dim1name='lon', dim2name='lat', &
long_name='runoff grid area', units='m2', ncid=nfid(t))
call ncd_defvar(varname='areatotal', xtype=tape(t)%ncprec, dim1name='lon', dim2name='lat', &
long_name='basin upstream areatotal', units='m2', ncid=nfid(t))
call ncd_defvar(varname='areatotal2', xtype=tape(t)%ncprec, dim1name='lon', dim2name='lat', &
long_name='computed basin upstream areatotal', units='m2', ncid=nfid(t))

else if (mode == 'write') then

Expand Down Expand Up @@ -839,7 +845,14 @@ subroutine htape_timeconst(t, mode)

call ncd_io(varname='lon', data=rtmCTL%rlon, ncid=nfid(t), flag='write')
call ncd_io(varname='lat', data=rtmCTL%rlat, ncid=nfid(t), flag='write')
! call ncd_io(varname='mask', data=rtmCTL%mask, ncid=nfid(t), flag='write')
call ncd_io(flag='write', varname='mask', dim1name='allrof', &
data=rtmCTL%mask, ncid=nfid(t))
call ncd_io(flag='write', varname='area', dim1name='allrof', &
data=rtmCTL%area, ncid=nfid(t))
call ncd_io(flag='write', varname='areatotal', dim1name='allrof', &
data=Tunit%areatotal, ncid=nfid(t))
call ncd_io(flag='write', varname='areatotal2', dim1name='allrof', &
data=Tunit%areatotal2, ncid=nfid(t))

endif

Expand Down
38 changes: 30 additions & 8 deletions models/rof/mosart/src/riverroute/RtmHistFlds.F90
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,43 @@ subroutine RtmHistFldsInit()
implicit none
!-------------------------------------------------------

call RtmHistAddfld (fname='QCHANR'//'_'//trim(rtm_tracers(1)), units='m3/s', &
avgflag='A', long_name='MOSART river flow: '//trim(rtm_tracers(1)), &
call RtmHistAddfld (fname='RIVER_DISCHARGE_OVER_LAND'//'_'//trim(rtm_tracers(1)), units='m3/s', &
avgflag='A', long_name='MOSART river basin flow: '//trim(rtm_tracers(1)), &
ptr_rof=rtmCTL%runofflnd_nt1, default='active')

call RtmHistAddfld (fname='QCHANR'//'_'//trim(rtm_tracers(2)), units='m3/s', &
avgflag='A', long_name='MOSART river flow: '//trim(rtm_tracers(2)), &
call RtmHistAddfld (fname='RIVER_DISCHARGE_OVER_LAND'//'_'//trim(rtm_tracers(2)), units='m3/s', &
avgflag='A', long_name='MOSART river basin flow: '//trim(rtm_tracers(2)), &
ptr_rof=rtmCTL%runofflnd_nt2, default='active')

call RtmHistAddfld (fname='QCHOCNR'//'_'//trim(rtm_tracers(1)), units='m3/s', &
call RtmHistAddfld (fname='RIVER_DISCHARGE_TO_OCEAN'//'_'//trim(rtm_tracers(1)), units='m3/s', &
avgflag='A', long_name='MOSART river discharge into ocean: '//trim(rtm_tracers(1)), &
ptr_rof=rtmCTL%runoffocn_nt1, default='active')

call RtmHistAddfld (fname='QCHOCNR'//'_'//trim(rtm_tracers(2)), units='m3/s', &
call RtmHistAddfld (fname='RIVER_DISCHARGE_TO_OCEAN'//'_'//trim(rtm_tracers(2)), units='m3/s', &
avgflag='A', long_name='MOSART river discharge into ocean: '//trim(rtm_tracers(2)), &
ptr_rof=rtmCTL%runoffocn_nt2, default='active')

call RtmHistAddfld (fname='VOLR'//'_'//trim(rtm_tracers(1)), units='m3', &
call RtmHistAddfld (fname='TOTAL_DISCHARGE_TO_OCEAN'//'_'//trim(rtm_tracers(1)), units='m3/s', &
avgflag='A', long_name='MOSART total discharge into ocean: '//trim(rtm_tracers(1)), &
ptr_rof=rtmCTL%runofftot_nt1, default='active')

call RtmHistAddfld (fname='TOTAL_DISCHARGE_TO_OCEAN'//'_'//trim(rtm_tracers(2)), units='m3/s', &
avgflag='A', long_name='MOSART total discharge into ocean: '//trim(rtm_tracers(2)), &
ptr_rof=rtmCTL%runofftot_nt2, default='active')

call RtmHistAddfld (fname='DIRECT_DISCHARGE_TO_OCEAN'//'_'//trim(rtm_tracers(1)), units='m3/s', &
avgflag='A', long_name='MOSART direct discharge into ocean: '//trim(rtm_tracers(1)), &
ptr_rof=rtmCTL%runoffdir_nt1, default='active')

call RtmHistAddfld (fname='DIRECT_DISCHARGE_TO_OCEAN'//'_'//trim(rtm_tracers(2)), units='m3/s', &
avgflag='A', long_name='MOSART direct discharge into ocean: '//trim(rtm_tracers(2)), &
ptr_rof=rtmCTL%runoffdir_nt2, default='active')

call RtmHistAddfld (fname='STORAGE'//'_'//trim(rtm_tracers(1)), units='m3', &
avgflag='A', long_name='MOSART storage: '//trim(rtm_tracers(1)), &
ptr_rof=rtmCTL%volr_nt1, default='active')

call RtmHistAddfld (fname='VOLR'//'_'//trim(rtm_tracers(2)), units='m3', &
call RtmHistAddfld (fname='STORAGE'//'_'//trim(rtm_tracers(2)), units='m3', &
avgflag='A', long_name='MOSART storage: '//trim(rtm_tracers(2)), &
ptr_rof=rtmCTL%volr_nt2, default='active')

Expand Down Expand Up @@ -135,6 +151,12 @@ subroutine RtmHistFldsSet()
rtmCTL%runoffocn_nt1(:) = rtmCTL%runoffocn(:,1)
rtmCTL%runoffocn_nt2(:) = rtmCTL%runoffocn(:,2)

rtmCTL%runofftot_nt1(:) = rtmCTL%runofftot(:,1)
rtmCTL%runofftot_nt2(:) = rtmCTL%runofftot(:,2)

rtmCTL%runoffdir_nt1(:) = rtmCTL%direct(:,1)
rtmCTL%runoffdir_nt2(:) = rtmCTL%direct(:,2)

rtmCTL%dvolrdtlnd_nt1(:) = rtmCTL%dvolrdtlnd(:,1)
rtmCTL%dvolrdtlnd_nt2(:) = rtmCTL%dvolrdtlnd(:,2)

Expand Down
Loading

0 comments on commit b25233e

Please sign in to comment.