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 all 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 cime_config/buildlib
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def _main_func():
complib = os.path.join(libroot,"librof.a")
makefile = os.path.join(casetools, "Makefile")

cmd = "{} complib -j {} MODEL=mizuRoute COMPLIB={} -f {} {}" \
cmd = "{} complib -j {} COMP_NAME=mizuRoute COMPLIB={} -f {} {}" \
.format(gmake, gmake_j, complib, makefile, get_standard_makefile_args(case))

rc, out, err = run_cmd(cmd)
Expand Down
38 changes: 20 additions & 18 deletions cime_config/buildnml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ 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"))
_LIBDIR = os.path.join(CIMEROOT, "CIME", "Tools")
sys.path.append(_LIBDIR)
# Path for mizuRoute/route/settings for both a mizuRoute standalone checkout as well as a CESM checkout
sys.path.append(os.path.join(CIMEROOT, "..", "route", "settings"))
sys.path.append(os.path.join(CIMEROOT, "..", "components", "mizuRoute", "route", "settings"))

from standard_script_setup import *
from CIME.case import Case
from CIME.nmlgen import NamelistGenerator
from CIME.XML.files import Files
from CIME.utils import expect, safe_copy
from CIME.buildnml import create_namelist_infile, parse_input
from mizuRoute_control import mizuRoute_control
Expand All @@ -30,7 +32,7 @@ logger = logging.getLogger(__name__)

# pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements
####################################################################################
def _create_control_files(case, caseroot, srcroot, confdir, inst_string, infile, nmlgen, ctl, data_list_path):
def _create_control_files(case, caseroot, srcroot, confdir, inst_string, infile, nmlgen, ctl):
####################################################################################
"""Write out the input configuration file for mizuRoute

Expand Down Expand Up @@ -124,7 +126,7 @@ def _create_control_files(case, caseroot, srcroot, confdir, inst_string, infile,
varname_downSegId = "Tosegment"
varname_pfafCode = "pfaf"
elif ( config['rof_grid'] == "USGS_GFmz" ):
fname_ntopOld = "ntopo_USGS-GFmz_Conus_cdf5_c20201008.nc"
fname_ntopOld = "ntopo_USGS-GFmz_Conus_cdf5_c20230602.nc"
varname_area = "Basin_Area"
varname_length = "Length"
varname_slope = "Slope"
Expand Down Expand Up @@ -180,7 +182,7 @@ def _create_control_files(case, caseroot, srcroot, confdir, inst_string, infile,
#----------------------------------------------------
# Initialize namelist defaults
#----------------------------------------------------
nmlgen.init_defaults(infile, config)
nmlgen.init_defaults(infile, config, skip_default_for_groups="data_files",)

#----------------------------------------------------
# Check for incompatible options.
Expand All @@ -202,6 +204,7 @@ def _create_control_files(case, caseroot, srcroot, confdir, inst_string, infile,
ctl.set( "input_dir", rundir+"/" )
ctl.set( "ancil_dir", ancil_dir )
ctl.set( "fname_ntopOld", fname_ntopOld )
nmlgen.set_value( "fname_ntopold", value=os.path.join( ancil_dir, fname_ntopOld ) )
ctl.set( "dt_qsim", str(dt_qsim) )
ctl.set( "dname_sseg", dname_sseg )
ctl.set( "dname_nhru", dname_nhru )
Expand Down Expand Up @@ -239,6 +242,8 @@ def _create_control_files(case, caseroot, srcroot, confdir, inst_string, infile,
fname_state_in = "empty"

ctl.set( "fname_state_in", fname_state_in )
if fname_state_in is not "empty":
nmlgen.set_value( "fname_state_in", value=os.path.join( ancil_dir, fname_ntopOld ) )

# Read in the user control file for the case and change settings to it
file_src = "user_nl_mizuroute_control"
Expand All @@ -257,17 +262,18 @@ def _create_control_files(case, caseroot, srcroot, confdir, inst_string, infile,
#----------------------------------------------------
control_file = os.path.join(confdir, "mizuRoute.control")
nml_file = os.path.join(confdir, "mizuRoute_in")
write_nml_in_file(case, nmlgen, confdir, nml_file)
write_nml_in_file(case, nmlgen, confdir, nml_file )
ctl.write( control_file )

###############################################################################
def write_nml_in_file(case, nmlgen, confdir, nml_file):
###############################################################################
data_list_path = os.path.join(case.get_case_root(), "Buildconf", "rof.input_data_list")
data_list_path = os.path.join(case.get_case_root(), "Buildconf", "mizuroute.input_data_list")
if os.path.exists(data_list_path):
os.remove(data_list_path)

namelist_file = os.path.join(confdir, nml_file)
nmlgen.write_output_file(namelist_file, data_list_path )
nmlgen.write_output_file(namelist_file, data_list_path=data_list_path, groups=["HSLOPE", "IRF_UH", "KWT"])

###############################################################################
def buildnml(case, caseroot, compname):
Expand All @@ -294,13 +300,6 @@ def buildnml(case, caseroot, compname):
ctl = mizuRoute_control()
ctl.read( sampleFile )

#----------------------------------------------------
# Clear out old data.
#----------------------------------------------------
data_list_path = os.path.join(case.get_case_root(), "Buildconf", "mizuRoute.input_data_list")
if os.path.exists(data_list_path):
os.remove(data_list_path)

#----------------------------------------------------
# Do some checking
#----------------------------------------------------
Expand All @@ -322,12 +321,15 @@ def buildnml(case, caseroot, compname):
create_namelist_infile(case, user_nl_file, infile)
control_infile = [infile]

# NOTE: User definition *replaces* existing definition.
files = Files(comp_interface="nuopc")

# Create the namelist generator object - independent of instance
definition_files = [srcroot + "/cime_config/namelist_definition_mizuRoute.xml"]
nmlgen = NamelistGenerator(case, definition_files)
definition_files = [os.path.join( srcroot, "cime_config/namelist_definition_mizuRoute.xml") ]
nmizukami marked this conversation as resolved.
Show resolved Hide resolved
nmlgen = NamelistGenerator(case, definition_files, files=files)

# create control files
_create_control_files(case, caseroot, srcroot, confdir, inst_string, control_infile, nmlgen, ctl, data_list_path)
_create_control_files(case, caseroot, srcroot, confdir, inst_string, control_infile, nmlgen, ctl)

# copy control files to rundir
if os.path.isdir(rundir):
Expand All @@ -343,7 +345,7 @@ def buildnml(case, caseroot, compname):
def _main_func():

caseroot = parse_input(sys.argv)
with Case(caseroot) as case:
with Case(case_root=caseroot) as case:
buildnml(case, caseroot, "mizuRoute")

if __name__ == "__main__":
Expand Down
3 changes: 2 additions & 1 deletion cime_config/config_archive.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<comp_archive_spec compname="mizuroute" compclass="rof">
<rest_file_extension>r</rest_file_extension>
<hist_file_extension>h.*\.nc$</hist_file_extension>
<rest_history_varname>unset</rest_history_varname>
<hist_file_extension>h_gauge.*\.nc$</hist_file_extension>
<rest_history_varname>history_file</rest_history_varname>
<rpointer>
<rpointer_file>rpointer.rof</rpointer_file>
<rpointer_content>./$CASE.mizuroute.r.$DATENAME.nc</rpointer_content>
Expand Down
23 changes: 23 additions & 0 deletions cime_config/namelist_definition_mizuRoute.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,27 @@
</entry>


<!-- =========================== -->
<!-- group DATA -->
<!-- =========================== -->
<entry id="fname_ntopold">
<type>char</type>
<category>datasets</category>
<input_pathname>abs</input_pathname>
<group>data_files</group>
<desc>
River network description file
</desc>
</entry>

<entry id="fname_state_in">
<type>char</type>
<category>datasets</category>
<input_pathname>abs</input_pathname>
<group>data_files</group>
<desc>
Initial conditions file
</desc>
</entry>

</entry_id>
19 changes: 14 additions & 5 deletions cime_config/test/env_case.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
<entry id="CONFIG_ROF_FILE" value="$COMP_ROOT_DIR_ROF/cime_config/config_component.xml">
<type>char</type>
<desc>file containing specification of component specific definitions and values(for documentation only - DO NOT EDIT)</desc>
<schema version="2.0">$CIMEROOT/config/xml_schemas/entry_id.xsd</schema>
<schema version="3.0">$CIMEROOT/config/xml_schemas/entry_id_version3.xsd</schema>
<schema version="2.0">$CIMEROOT/CIME/data/config/xml_schemas/entry_id.xsd</schema>
<schema version="3.0">$CIMEROOT/CIME/data/config/xml_schemas/entry_id_version3.xsd</schema>
</entry>

<entry id="COMPSET" value="1850_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MIZUROUTE_CISM2%NOEVOLVE_SWAV_SIAC_SESP">
<type>char</type>
<desc>Component set long name (for documentation only - DO NOT EDIT)</desc>
</entry>

<entry id="COMP_ROOT_DIR_ROF" value="$SRCROOT">
<entry id="COMP_ROOT_DIR_ROF" value="$SRCROOT/components/mizuRoute/">
<type>char</type>
<desc>Root directory of the case river runoff model component </desc>
<schema>$CIMEROOT/config/xml_schemas/config_compsets.xsd</schema>
<schema>$CIMEROOT/CIME/data/config/xml_schemas/config_compsets.xsd</schema>
</entry>

<entry id="COMP_ROF" value="mizuRoute">
Expand All @@ -34,11 +34,20 @@
<desc>Name of river component</desc>
</entry>

<entry id="SRCROOT" value="$ENV{PWD}/../..">
<entry id="SRCROOT" value="$ENV{PWD}/../../../..">
<type>char</type>
<desc>full pathname of source root directory</desc>
</entry>

<entry id="MACH" value="cheyenne">
<type>char</type>
<desc>Machine name</desc>
</entry>
<entry id="MACHDIR" value="$SRCROOT/ccs_config/machines">
<type>char</type>
<desc>Machines directory location</desc>
</entry>

<entry id="CASE" value="CASENAME">
<type>char</type>
<desc>case name</desc>
Expand Down
2 changes: 1 addition & 1 deletion cime_config/test/env_run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Sample env_run.xml file that allows buildnml to be run for testing in this direc

-->
<group>
<entry id="DIN_LOC_ROOT" value="MYDINLOCROOT" />
<entry id="DIN_LOC_ROOT" value="/MYDINLOCROOT" />

<entry id="CASESTR" value="test">
</entry>
Expand Down
9 changes: 7 additions & 2 deletions cime_config/test/runbuildnml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#!/bin/bash
cd ../../cime >& /dev/null
# Run the buildnmal for mizuRoute, assing it's under a CTSM or CESM checkout
cd ../../../../cime >& /dev/null
if [ $? != 0 ]; then
cd ../../../../cime
echo "cime directory does not exist where expected"
exit -1
fi
export CIMEROOT=`pwd`
echo "CIMEROOT = $CIMEROOT"

cd -
cp ../user_nl_* .
Expand All @@ -22,6 +25,8 @@ if [ $? != 0 ] ; then
else
echo "Cat the results...."
cat Buildconf/mizurouteconf/mizuRoute*
echo "input_data_list..."
cat Buildconf/mizuroute.input_data_list
fi
rm -rf user_* run/* Buildconf/mizurouteconf/* Buildconf/* CaseDocs
echo "Successfully ran test"
34 changes: 31 additions & 3 deletions cime_config/testdefs/ExpectedTestFails.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,42 @@
<issue>#390</issue>
</phase>
</test>
<test name="ERI.nldas2_nldas2_rHDMA_mnldas2.I2000Clm50SpMizGs.cheyenne_intel.mizuroute-default">
<test name="ERS_D_Mmpi-serial.5x5_amazon_r05.I2000Clm50SpMizGs.izumi_nag.mizuroute-default"
<phase name="COMPARE_base_rest">
<status>FAIL</status>
<issue>#390</issue>
</phase>
</test>
<test name="ERI_Mmpi-serial.5x5_amazon_r05.I2000Clm50SpMizGs.cheyenne_intel.mizuroute-default">
<phase name="COMPARE_base_rest">
<status>FAIL</status>
<issue>#390</issue>
</phase>
<phase name="COMPARE_base_hybrid">
<status>FAIL</status>
<issue>#390</issue>
</phase>
</test>
<test name="ERI_Mmpi-serial.5x5_amazon_r05.I2000Clm50SpMizGs.izumi_gnu.mizuroute-default">
<phase name="COMPARE_base_rest">
<status>FAIL</status>
<issue>#390</issue>
</phase>
<phase name="COMPARE_base_hybrid">
<status>FAIL</status>
<issue>#388</issue>
<issue>#390</issue>
</phase>
</test>
<test name="ERS_D_Mmpi-serial_P1x25.5x5_amazon_r05.I2000Clm50SpMizGs.cheyenne_intel.mizuroute-default">
<phase name="COMPARE_base_rest">
<status>FAIL</status>
<issue>#388</issue>
<issue>#390</issue>
</phase>
</test>
<test name="ERP_D_Mmpi-serial_P1x25.5x5_amazon_r05.I2000Clm50SpMizGs.cheyenne_intel.mizuroute-default">
<phase name="COMPARE_base_rest">
<status>FAIL</status>
<issue>#390</issue>
</phase>
</test>

Expand Down
Loading