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

Mosart sector water for pull request #63

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
21 changes: 21 additions & 0 deletions src/cpl/mct/mosart_cpl_indices.F90
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ module mosart_cpl_indices
integer, public :: index_x2r_Flrl_rofdto = 0 ! lnd->rof liquid direct to ocean runoff
integer, public :: index_x2r_Flrl_rofi = 0 ! lnd->rof ice runoff forcing from land
integer, public :: index_x2r_Flrl_irrig = 0 ! lnd->rof fraction of volr to be removed for irrigation
integer, public :: index_x2r_Flrl_dom_withd = 0 ! lnd->rof fraction of volr to be removed for domestic usage
integer, public :: index_x2r_Flrl_dom_rf = 0 ! lnd->rof fraction of volr to be returned after domestic usage
integer, public :: index_x2r_Flrl_liv_withd = 0 ! lnd->rof fraction of volr to be removed for livestock usage
integer, public :: index_x2r_Flrl_liv_rf = 0 ! lnd->rof fraction of volr to be returned after livestock usage
integer, public :: index_x2r_Flrl_elec_withd = 0 ! lnd->rof fraction of volr to be removed for thermoelectric usage
integer, public :: index_x2r_Flrl_elec_rf = 0 ! lnd->rof fraction of volr to be returned after thermoelectric usage
integer, public :: index_x2r_Flrl_mfc_withd = 0 ! lnd->rof fraction of volr to be removed for manufacturing usage
integer, public :: index_x2r_Flrl_mfc_rf = 0 ! lnd->rof fraction of volr to be returned after manufacturing usage
integer, public :: index_x2r_Flrl_min_withd = 0 ! lnd->rof fraction of volr to be removed for mining usage
integer, public :: index_x2r_Flrl_min_rf = 0 ! lnd->rof fraction of volr to be returned after mining usage

integer, public :: nflds_x2r = 0

! roff to driver (part of land for now) (optional if ROF is off)
Expand Down Expand Up @@ -65,6 +76,16 @@ subroutine mosart_cpl_indices_set(flds_x2r, flds_r2x )
index_x2r_Flrl_rofdto = mct_avect_indexra(avtmp,'Flrl_rofdto')
index_x2r_Flrl_rofi = mct_avect_indexra(avtmp,'Flrl_rofi')
index_x2r_Flrl_irrig = mct_avect_indexra(avtmp,'Flrl_irrig')
index_x2r_Flrl_dom_withd = mct_avect_indexra(avtmp,'Flrl_dom_withd')
index_x2r_Flrl_dom_rf = mct_avect_indexra(avtmp,'Flrl_dom_rf')
index_x2r_Flrl_liv_withd = mct_avect_indexra(avtmp,'Flrl_liv_withd')
index_x2r_Flrl_liv_rf = mct_avect_indexra(avtmp,'Flrl_liv_rf')
index_x2r_Flrl_elec_withd = mct_avect_indexra(avtmp,'Flrl_elec_withd')
index_x2r_Flrl_elec_rf = mct_avect_indexra(avtmp,'Flrl_elec_rf')
index_x2r_Flrl_mfc_withd = mct_avect_indexra(avtmp,'Flrl_mfc_withd')
index_x2r_Flrl_mfc_rf = mct_avect_indexra(avtmp,'Flrl_mfc_rf')
index_x2r_Flrl_min_withd = mct_avect_indexra(avtmp,'Flrl_min_withd')
index_x2r_Flrl_min_rf = mct_avect_indexra(avtmp,'Flrl_min_rf')

nflds_x2r = mct_avect_nRattr(avtmp)

Expand Down
26 changes: 26 additions & 0 deletions src/cpl/mct/mosart_import_export.F90
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ module mosart_import_export
use mosart_cpl_indices , only : index_x2r_Flrl_rofsur, index_x2r_Flrl_rofi
use mosart_cpl_indices , only : index_x2r_Flrl_rofgwl, index_x2r_Flrl_rofsub
use mosart_cpl_indices , only : index_x2r_Flrl_irrig
use mosart_cpl_indices , only : index_x2r_Flrl_dom_withd, index_x2r_Flrl_dom_rf
use mosart_cpl_indices , only : index_x2r_Flrl_liv_withd, index_x2r_Flrl_liv_rf
use mosart_cpl_indices , only : index_x2r_Flrl_elec_withd, index_x2r_Flrl_elec_rf
use mosart_cpl_indices , only : index_x2r_Flrl_mfc_withd, index_x2r_Flrl_mfc_rf
use mosart_cpl_indices , only : index_x2r_Flrl_min_withd, index_x2r_Flrl_min_rf
use mosart_cpl_indices , only : index_r2x_Forr_rofl, index_r2x_Forr_rofi
use mosart_cpl_indices , only : index_r2x_Flrr_flood
use mosart_cpl_indices , only : index_r2x_Flrr_volr, index_r2x_Flrr_volrmch
Expand Down Expand Up @@ -69,6 +74,17 @@ subroutine mosart_import( x2r )

rtmCTL%qsur(n,nfrz) = x2r(index_x2r_Flrl_rofi ,n2) * (rtmCTL%area(n)*0.001_r8)
rtmCTL%qirrig(n) = x2r(index_x2r_Flrl_irrig,n2) * (rtmCTL%area(n)*0.001_r8)
rtmCTL%qdom_withd(n) = x2r(index_x2r_Flrl_dom_withd,n2) * (rtmCTL%area(n)*0.001_r8)
rtmCTL%qdom_rf(n) = x2r(index_x2r_Flrl_dom_rf,n2) * (rtmCTL%area(n)*0.001_r8)
rtmCTL%qliv_withd(n) = x2r(index_x2r_Flrl_liv_withd,n2) * (rtmCTL%area(n)*0.001_r8)
rtmCTL%qliv_rf(n) = x2r(index_x2r_Flrl_liv_rf,n2) * (rtmCTL%area(n)*0.001_r8)
rtmCTL%qelec_withd(n) = x2r(index_x2r_Flrl_elec_withd,n2) * (rtmCTL%area(n)*0.001_r8)
rtmCTL%qelec_rf(n) = x2r(index_x2r_Flrl_elec_rf,n2) * (rtmCTL%area(n)*0.001_r8)
rtmCTL%qmfc_withd(n) = x2r(index_x2r_Flrl_mfc_withd,n2) * (rtmCTL%area(n)*0.001_r8)
rtmCTL%qmfc_rf(n) = x2r(index_x2r_Flrl_mfc_rf,n2) * (rtmCTL%area(n)*0.001_r8)
rtmCTL%qmin_withd(n) = x2r(index_x2r_Flrl_min_withd,n2) * (rtmCTL%area(n)*0.001_r8)
rtmCTL%qmin_rf(n) = x2r(index_x2r_Flrl_min_rf,n2) * (rtmCTL%area(n)*0.001_r8)


rtmCTL%qsub(n,nfrz) = 0.0_r8
rtmCTL%qgwl(n,nfrz) = 0.0_r8
Expand All @@ -81,6 +97,16 @@ subroutine mosart_import( x2r )
write(iulog,F01)'import: nstep, n, Flrl_rofgwl = ',get_nstep(),n,rtmCTL%qgwl(n,nliq)
write(iulog,F01)'import: nstep, n, Flrl_rofi = ',get_nstep(),n,rtmCTL%qsur(n,nfrz)
write(iulog,F01)'import: nstep, n, Flrl_irrig = ',get_nstep(),n,rtmCTL%qirrig(n)
write(iulog,F01)'import: nstep, n, Flrl_dom_withd = ',get_nstep(),n,rtmCTL%qdom_withd(n)
write(iulog,F01)'import: nstep, n, Flrl_dom_rf = ',get_nstep(),n,rtmCTL%qdom_rf(n)
write(iulog,F01)'import: nstep, n, Flrl_liv_withd = ',get_nstep(),n,rtmCTL%qliv_withd(n)
write(iulog,F01)'import: nstep, n, Flrl_liv_rf = ',get_nstep(),n,rtmCTL%qliv_rf(n)
write(iulog,F01)'import: nstep, n, Flrl_elec_withd = ',get_nstep(),n,rtmCTL%qelec_withd(n)
write(iulog,F01)'import: nstep, n, Flrl_elec_rf = ',get_nstep(),n,rtmCTL%qelec_rf(n)
write(iulog,F01)'import: nstep, n, Flrl_mfc_withd = ',get_nstep(),n,rtmCTL%qmfc_withd(n)
write(iulog,F01)'import: nstep, n, Flrl_mfc_rf = ',get_nstep(),n,rtmCTL%qmfc_rf(n)
write(iulog,F01)'import: nstep, n, Flrl_min_withd = ',get_nstep(),n,rtmCTL%qmin_withd(n)
write(iulog,F01)'import: nstep, n, Flrl_min_rf = ',get_nstep(),n,rtmCTL%qmin_rf(n)
end do
end if

Expand Down
5 changes: 5 additions & 0 deletions src/cpl/mct/rof_comp_mct.F90
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ module rof_comp_mct
use mosart_cpl_indices , only : index_x2r_Flrl_rofsur, index_x2r_Flrl_rofi
use mosart_cpl_indices , only : index_x2r_Flrl_rofgwl, index_x2r_Flrl_rofsub
use mosart_cpl_indices , only : index_x2r_Flrl_irrig
use mosart_cpl_indices , only : index_x2r_Flrl_dom_withd, index_x2r_Flrl_dom_rf
use mosart_cpl_indices , only : index_x2r_Flrl_liv_withd, index_x2r_Flrl_liv_rf
use mosart_cpl_indices , only : index_x2r_Flrl_elec_withd, index_x2r_Flrl_elec_rf
use mosart_cpl_indices , only : index_x2r_Flrl_mfc_withd, index_x2r_Flrl_mfc_rf
use mosart_cpl_indices , only : index_x2r_Flrl_min_withd, index_x2r_Flrl_min_rf
use mosart_cpl_indices , only : index_r2x_Forr_rofl, index_r2x_Forr_rofi, index_r2x_Flrr_flood
use mosart_cpl_indices , only : index_r2x_Flrr_volr, index_r2x_Flrr_volrmch

Expand Down
52 changes: 51 additions & 1 deletion src/cpl/nuopc/rof_import_export.F90
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,17 @@ subroutine advertise_fields(gcomp, flds_scalar_name, do_rtmflood, rc)
call fldlist_add(fldsToRof_num, fldsToRof, 'Flrl_rofsub')
call fldlist_add(fldsToRof_num, fldsToRof, 'Flrl_rofi')
call fldlist_add(fldsToRof_num, fldsToRof, 'Flrl_irrig')

call fldlist_add(fldsToRof_num, fldsToRof, 'Flrl_dom_withd')
call fldlist_add(fldsToRof_num, fldsToRof, 'Flrl_dom_rf')
call fldlist_add(fldsToRof_num, fldsToRof, 'Flrl_liv_withd')
call fldlist_add(fldsToRof_num, fldsToRof, 'Flrl_liv_rf')
call fldlist_add(fldsToRof_num, fldsToRof, 'Flrl_elec_withd')
call fldlist_add(fldsToRof_num, fldsToRof, 'Flrl_elec_rf')
call fldlist_add(fldsToRof_num, fldsToRof, 'Flrl_mfc_withd')
call fldlist_add(fldsToRof_num, fldsToRof, 'Flrl_mfc_rf')
call fldlist_add(fldsToRof_num, fldsToRof, 'Flrl_min_withd')
call fldlist_add(fldsToRof_num, fldsToRof, 'Flrl_min_rf')

do n = 1,fldsToRof_num
call NUOPC_Advertise(importState, standardName=fldsToRof(n)%stdname, &
TransferOfferGeomObject='will provide', rc=rc)
Expand Down Expand Up @@ -293,6 +303,46 @@ subroutine import_fields( gcomp, rc )
do_area_correction=.true., rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

call state_getimport(importState, 'Flrl_dom_withd', begr, endr, rtmCTL%area, output=rtmCTL%qdom_withd(:), &
do_area_correction=.true., rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

call state_getimport(importState, 'Flrl_dom_rf', begr, endr, rtmCTL%area, output=rtmCTL%qdom_rf(:), &
do_area_correction=.true., rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

call state_getimport(importState, 'Flrl_liv_withd', begr, endr, rtmCTL%area, output=rtmCTL%qliv_withd(:), &
do_area_correction=.true., rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

call state_getimport(importState, 'Flrl_liv_rf', begr, endr, rtmCTL%area, output=rtmCTL%qliv_rf(:), &
do_area_correction=.true., rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

call state_getimport(importState, 'Flrl_elec_withd', begr, endr, rtmCTL%area, output=rtmCTL%qelec_withd(:), &
do_area_correction=.true., rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

call state_getimport(importState, 'Flrl_elec_rf', begr, endr, rtmCTL%area, output=rtmCTL%qelec_rf(:), &
do_area_correction=.true., rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

call state_getimport(importState, 'Flrl_mfc_withd', begr, endr, rtmCTL%area, output=rtmCTL%qmfc_withd(:), &
do_area_correction=.true., rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

call state_getimport(importState, 'Flrl_mfc_rf', begr, endr, rtmCTL%area, output=rtmCTL%qmfc_rf(:), &
do_area_correction=.true., rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

call state_getimport(importState, 'Flrl_min_withd', begr, endr, rtmCTL%area, output=rtmCTL%qmin_withd(:), &
do_area_correction=.true., rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

call state_getimport(importState, 'Flrl_min_rf', begr, endr, rtmCTL%area, output=rtmCTL%qmin_rf(:), &
do_area_correction=.true., rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

rtmCTL%qsub(begr:endr, nfrz) = 0.0_r8
rtmCTL%qgwl(begr:endr, nfrz) = 0.0_r8

Expand Down
80 changes: 80 additions & 0 deletions src/riverroute/RtmHistFlds.F90
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,90 @@ subroutine RtmHistFldsInit()
avgflag='A', long_name='Amount of water used for irrigation (total flux received from coupler)', &
ptr_rof=rtmCTL%qirrig, default='inactive')

call RtmHistAddfld (fname='QDOM_WITHD_FROM_COUPLER', units='m3/s', &
avgflag='A', long_name='Amount of water withdrew for domestic usage', &
ptr_rof=rtmCTL%qdom_withd, default='inactive')

call RtmHistAddfld (fname='QDOM_RF_FROM_COUPLER', units='m3/s', &
avgflag='A', long_name='Amount of water returned from domestic usage', &
ptr_rof=rtmCTL%qdom_rf, default='inactive')

call RtmHistAddfld (fname='QLIV_WITHD_FROM_COUPLER', units='m3/s', &
avgflag='A', long_name='Amount of water withdrew for livestock usage', &
ptr_rof=rtmCTL%qliv_withd, default='inactive')

call RtmHistAddfld (fname='QLIV_RF_FROM_COUPLER', units='m3/s', &
avgflag='A', long_name='Amount of water returned from livestock usage', &
ptr_rof=rtmCTL%qliv_rf, default='inactive')

call RtmHistAddfld (fname='QELEC_WITHD_FROM_COUPLER', units='m3/s', &
avgflag='A', long_name='Amount of water withdrew for thermoelectric usage', &
ptr_rof=rtmCTL%qelec_withd, default='inactive')

call RtmHistAddfld (fname='QELEC_RF_FROM_COUPLER', units='m3/s', &
avgflag='A', long_name='Amount of water returned from thermoelectric usage', &
ptr_rof=rtmCTL%qelec_rf, default='inactive')

call RtmHistAddfld (fname='QMFC_WITHD_FROM_COUPLER', units='m3/s', &
avgflag='A', long_name='Amount of water withdrew for manufacturing usage', &
ptr_rof=rtmCTL%qmfc_withd, default='inactive')

call RtmHistAddfld (fname='QMFC_RF_FROM_COUPLER', units='m3/s', &
avgflag='A', long_name='Amount of water returned from manufacturing usage', &
ptr_rof=rtmCTL%qmfc_rf, default='inactive')

call RtmHistAddfld (fname='QMIN_WITHD_FROM_COUPLER', units='m3/s', &
avgflag='A', long_name='Amount of water withdrew for mining usage', &
ptr_rof=rtmCTL%qmin_withd, default='inactive')

call RtmHistAddfld (fname='QMIN_RF_FROM_COUPLER', units='m3/s', &
avgflag='A', long_name='Amount of water returned from mining usage', &
ptr_rof=rtmCTL%qmin_rf, default='inactive')

call RtmHistAddfld (fname='QIRRIG_ACTUAL', units='m3/s', &
avgflag='A', long_name='Actual irrigation (if limited by river storage)', &
ptr_rof=rtmCTL%qirrig_actual, default='inactive')

call RtmHistAddfld (fname='QDOM_ACTUAL_WITHD', units='m3/s', &
avgflag='A', long_name='Actual domestic withdrawal (if limited by river storage)', &
ptr_rof=rtmCTL%qdom_actual_withd, default='inactive')

call RtmHistAddfld (fname='QELEC_ACTUAL_WITHD', units='m3/s', &
avgflag='A', long_name='Actual thermoelectric withdrawal (if limited by river storage)', &
ptr_rof=rtmCTL%qelec_actual_withd, default='inactive')

call RtmHistAddfld (fname='QLIV_ACTUAL_WITHD', units='m3/s', &
avgflag='A', long_name='Actual livestock withdrawal (if limited by river storage)', &
ptr_rof=rtmCTL%qliv_actual_withd, default='inactive')

call RtmHistAddfld (fname='QMFC_ACTUAL_WITHD', units='m3/s', &
avgflag='A', long_name='Actual manufacturing withdrawal (if limited by river storage)', &
ptr_rof=rtmCTL%qmfc_actual_withd, default='inactive')

call RtmHistAddfld (fname='QMIN_ACTUAL_WITHD', units='m3/s', &
avgflag='A', long_name='Actual mining withdrawal (if limited by river storage)', &
ptr_rof=rtmCTL%qmin_actual_withd, default='inactive')

call RtmHistAddfld (fname='QDOM_ACTUAL_RF', units='m3/s', &
avgflag='A', long_name='Actual domestic return flow (if limited by river storage)', &
ptr_rof=rtmCTL%qdom_actual_rf, default='inactive')

call RtmHistAddfld (fname='QELEC_ACTUAL_RF', units='m3/s', &
avgflag='A', long_name='Actual thermoelectric return flow (if limited by river storage)', &
ptr_rof=rtmCTL%qelec_actual_rf, default='inactive')

call RtmHistAddfld (fname='QLIV_ACTUAL_RF', units='m3/s', &
avgflag='A', long_name='Actual livestock return flow (if limited by river storage)', &
ptr_rof=rtmCTL%qliv_actual_rf, default='inactive')

call RtmHistAddfld (fname='QMFC_ACTUAL_RF', units='m3/s', &
avgflag='A', long_name='Actual manufacturing return flow (if limited by river storage)', &
ptr_rof=rtmCTL%qmfc_actual_rf, default='inactive')

call RtmHistAddfld (fname='QMIN_ACTUAL_RF', units='m3/s', &
avgflag='A', long_name='Actual mining return flow (if limited by river storage)', &
ptr_rof=rtmCTL%qmin_actual_rf, default='inactive')

! Print masterlist of history fields

call RtmHistPrintflds()
Expand Down
Loading