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

Bug fix for bypass_routing_option = 'direct_to_outlet' method #57

Merged
merged 8 commits into from
Nov 12, 2022
2 changes: 1 addition & 1 deletion cime_config/buildlib
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import os, sys
CIMEROOT = os.environ.get("CIMEROOT")
if CIMEROOT is None:
raise SystemExit("ERROR: must set CIMEROOT environment variable")
sys.path.append(os.path.join(CIMEROOT, "scripts", "Tools"))
sys.path.append(os.path.join(CIMEROOT, "scripts", "CIME", "Tools"))

from standard_script_setup import *
from CIME.case import Case
Expand Down
10 changes: 9 additions & 1 deletion cime_config/buildnml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import os, shutil, sys
CIMEROOT = os.environ.get("CIMEROOT")
if CIMEROOT is None:
raise SystemExit("ERROR: must set CIMEROOT environment variable")
sys.path.append(os.path.join(CIMEROOT, "scripts", "Tools"))
sys.path.append(os.path.join(CIMEROOT, "scripts", "CIME", "Tools"))

from standard_script_setup import *
from CIME.case import Case
Expand Down Expand Up @@ -134,6 +134,14 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path
if ( nmlgen.get_value("frivinp_rtm") == "UNSET" and config["mosart_mode"] != "NULL" ):
raise SystemExit("ERROR: Direction file is NOT set and is required when MOSART is active: frivinp_rtm")

bypass_routing_option = nmlgen.get_value("bypass_routing_option")
qgwl_runoff_option = nmlgen.get_value("qgwl_runoff_option")
if bypass_routing_option == "none" and qgwl_runoff_option != "all":
raise SystemExit("ERROR: When bypass_routing_option is none, qgwl_runoff_option can only be all")

if bypass_routing_option == "direct_to_outlet" and qgwl_runoff_option == "threshold":
raise SystemExit("ERROR: When bypass_routing_option is direct_to_outlet, qgwl_runoff_option can not be threshold")

#----------------------------------------------------
# Write output file
#----------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions cime_config/namelist_definition_mosart.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
</values>
<desc>
Method for handling of qgwl runoff inputs.
(threshold is only valid for bypass_routing_option=direct_in_place)
</desc>
</entry>

Expand Down
11 changes: 10 additions & 1 deletion cime_config/testdefs/testlist_mosart.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
</machines>
<options>
<option name="wallclock">00:20:00</option>
<option name="comment" >Pass channel depths needed for hillslope model (will fail until you use a version of CMEPS with this)</option>
<option name="comment" >Pass channel depths needed for hillslope model</option>
</options>
</test>
<test name="ERP_D" grid="f10_f10_mg37" compset="I1850Clm50Bgc" testmods="mosart/qgrwlOpts">
Expand All @@ -111,4 +111,13 @@
<option name="wallclock">00:20:00</option>
</options>
</test>
<test name="PEM_D" grid="f10_f10_mg37" compset="I1850Clm50Sp" testmods="mosart/negtooutlet">
<machines>
<machine name="cheyenne" compiler="intel" category="mosart"></machine>
</machines>
<options>
<option name="wallclock">00:20:00</option>
<option name="comment" >Set direct_to_outlet for negative flow</option>
</options>
</test>
</testlist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
qgwl_runoff_option = 'negative'
bypass_routing_option = 'direct_to_outlet'
21 changes: 21 additions & 0 deletions docs/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
===============================================================
Tag name: mosart1_0_47
Originator(s): erik
Date: Nov 12, 2022
One-line Summary: Some fixes for the direct_to_outlet option

This fixes the balance errors evident in the mosart log file when
the bypass_routing_option='direct_to_outlet' method is used.
Note that these balance errors are warnings and do not stop the model.

Code from @swensosc, PR by @olyson

Fixes #54 -- update cime directory in buildlib/buildnml
Fixes #56 -- Some issues with the direct_to_outlet option

Also don't allow the threshold option to be set with
direct_to_outlet is choosen, as well as any option other
than "all" for "none".

Answers change when direct_to_outlet option is used

===============================================================
Tag name: mosart1_0_46
Originator(s): jedwards
Expand Down
14 changes: 12 additions & 2 deletions src/riverroute/RtmMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,16 @@ subroutine Rtminit_namelist(flood_active)
endif
end if

if (trim(bypass_routing_option) == 'direct_to_outlet') then
if (trim(qgwl_runoff_option) == 'threshold') then
call shr_sys_abort( subname//' ERROR: qgwl_runoff_option can NOT be threshold if bypass_routing_option==direct_to_outlet' )
end if
else if (trim(bypass_routing_option) == 'none') then
if (trim(qgwl_runoff_option) /= 'all') then
call shr_sys_abort( subname//' ERROR: qgwl_runoff_option can only be all if bypass_routing_option==none' )
end if
end if

if (coupling_period <= 0) then
write(iulog,*) subname,' ERROR MOSART coupling_period invalid',coupling_period
call shr_sys_abort( subname//' ERROR: coupling_period invalid' )
Expand Down Expand Up @@ -1634,7 +1644,7 @@ subroutine Rtmrun(rstwr,nlend,rdate)
cnt = 0
do nr = rtmCTL%begr,rtmCTL%endr
cnt = cnt + 1
rtmCTL%direct(nr,nt) = avdst_direct%rAttr(nt,cnt)
rtmCTL%direct(nr,nt) = rtmCTL%direct(nr,nt) + avdst_direct%rAttr(nt,cnt)
enddo
endif

Expand Down Expand Up @@ -1748,7 +1758,7 @@ subroutine Rtmrun(rstwr,nlend,rdate)
do nr = rtmCTL%begr,rtmCTL%endr
cnt = cnt + 1
do nt = 1,nt_rtm
rtmCTL%direct(nr,nt) = avdst_direct%rAttr(nt,cnt)
rtmCTL%direct(nr,nt) = rtmCTL%direct(nr,nt) + avdst_direct%rAttr(nt,cnt)
enddo
enddo
endif
Expand Down