Skip to content

Commit

Permalink
Merge tag 'rtm1_0_67' into buildlib_update
Browse files Browse the repository at this point in the history
basetype wasn't declared and needed to be. Also add more "implicit none"
statements in. Remove the deletion of "rtm.input_data_list" file, as cime
now does this. Remove the option of setting single-precision
history output, as it sometimes has numerical conversion issues. The
real solution for it should be to keep a single-precision history
buffer that then outputs at the same precision as stored, rather than
converting just before. This would trigger issues with the conversion
earlier.

Changes ported from mosart/ESCOMP#15 to rtm. Run pylint through buildlib/buildnml,
changes for fill value needed for pio2. Also use the floor operator
for a specific integer divide as python3 turns it into reals.

Add CODE_OF_CONDUCT.md
  • Loading branch information
ekluzek committed May 16, 2019
2 parents 69710c2 + 3ac4042 commit 0ee4b12
Show file tree
Hide file tree
Showing 9 changed files with 280 additions and 147 deletions.
24 changes: 14 additions & 10 deletions cime_config/buildlib
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!/usr/bin/env python

import os, shutil, sys, glob
"""
Build the mosart component library
"""
#pylint: disable=unused-wildcard-import, wildcard-import, multiple-imports
#pylint: disable=wrong-import-position, invalid-name, too-many-locals
import os, sys

CIMEROOT = os.environ.get("CIMEROOT")
if CIMEROOT is None:
Expand All @@ -23,25 +27,25 @@ def _build_rtm():

with Case(caseroot) as case:
casetools = case.get_value("CASETOOLS")
gmake_j = case.get_value("GMAKE_J")
gmake = case.get_value("GMAKE")
gmake_j = case.get_value("GMAKE_J")
gmake = case.get_value("GMAKE")

# create Filepath file
objroot = case.get_value("OBJROOT")
filepath_file = os.path.join(objroot,"rof","obj","Filepath")
filepath_file = os.path.join(objroot, "rof", "obj", "Filepath")
if not os.path.isfile(filepath_file):
srcroot = case.get_value("SRCROOT")
caseroot = case.get_value("CASEROOT")
paths = [ os.path.join(caseroot,"SourceMods","src.rtm"),
os.path.join(srcroot,"components","rtm","src","riverroute"),
os.path.join(srcroot,"components","rtm","src","cpl")]
paths = [os.path.join(caseroot, "SourceMods", "src.rtm"),
os.path.join(srcroot, "components", "rtm", "src", "riverroute"),
os.path.join(srcroot, "components", "rtm", "src", "cpl")]

with open(filepath_file, "w") as filepath:
filepath.write("\n".join(paths))
filepath.write("\n")

# build the library
complib = os.path.join(libroot,"librof.a")
complib = os.path.join(libroot, "librof.a")
makefile = os.path.join(casetools, "Makefile")

cmd = "{} complib -j {} MODEL=rtm COMPLIB={} -f {} {}" \
Expand All @@ -50,7 +54,7 @@ def _build_rtm():
rc, out, err = run_cmd(cmd, from_dir=bldroot)
expect(rc == 0, "Command %s failed rc=%d\nout=%s\nerr=%s" % (cmd, rc, out, err))

logger.info("Command %s completed with output %s\nerr %s" ,cmd, out, err)
logger.info("Command %s completed with output %s\nerr %s", cmd, out, err)

###############################################################################

Expand Down
63 changes: 31 additions & 32 deletions cime_config/buildnml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

# Disable these because this is our standard setup
# pylint: disable=wildcard-import,unused-wildcard-import,wrong-import-position

import os, shutil, sys, glob
# pylint: disable=multiple-imports
import os, shutil, sys

CIMEROOT = os.environ.get("CIMEROOT")
if CIMEROOT is None:
Expand All @@ -20,13 +20,13 @@ from standard_script_setup import *
from CIME.case import Case
from CIME.nmlgen import NamelistGenerator
from CIME.utils import expect
from CIME.buildnml import create_namelist_infile
from CIME.buildnml import create_namelist_infile, parse_input

logger = logging.getLogger(__name__)

# pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements
####################################################################################
def _create_namelist(case, confdir, inst_string, infile, nmlgen):
def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path):
####################################################################################
"""Write out the namelist for this component.
Expand All @@ -40,7 +40,7 @@ def _create_namelist(case, confdir, inst_string, infile, nmlgen):
#----------------------------------------------------
config = {}
config['rtm_mode'] = case.get_value("RTM_MODE")
config['rtm_flood_mode'] = case.get_value("RTM_FLOOD_MODE")
config['rtm_flood_mode'] = case.get_value("RTM_FLOOD_MODE")
config['clm_accelerated_spinup'] = case.get_value("CLM_ACCELERATED_SPINUP")
config['rof_grid'] = case.get_value("ROF_GRID")
config['lnd_grid'] = case.get_value("LND_GRID")
Expand All @@ -52,14 +52,7 @@ def _create_namelist(case, confdir, inst_string, infile, nmlgen):
# Check for incompatible options.
#----------------------------------------------------
if config["rof_grid"] == "null" and config["rtm_mode"] != "NULL":
expect (False, "ROF_GRID is null RTM_MODE not NULL")

#----------------------------------------------------
# Clear out old data.
#----------------------------------------------------
data_list_path = os.path.join(case.get_case_root(), "Buildconf", "rtm.input_data_list")
if os.path.exists(data_list_path):
os.remove(data_list_path)
expect(False, "ROF_GRID is null RTM_MODE not NULL")

#----------------------------------------------------
# Initialize namelist defaults
Expand All @@ -74,10 +67,10 @@ def _create_namelist(case, confdir, inst_string, infile, nmlgen):
if run_type == 'branch' or run_type == 'hybrid':
run_refcase = case.get_value("RUN_REFCASE")
run_refdate = case.get_value("RUN_REFDATE")
run_tod = case.get_value("RUN_REFTOD")
run_tod = case.get_value("RUN_REFTOD")
filename = "%s.rtm%s.r.%s-%s.nc" %(run_refcase, inst_string, run_refdate, run_tod)
rundir = case.get_value("RUNDIR")
if not os.path.exists(os.path.join(rundir, filename ) ):
if not os.path.exists(os.path.join(rundir, filename)):
filename = "%s.rtm.r.%s-%s.nc" %(run_refcase, run_refdate, run_tod)

if run_type == "hybrid":
Expand All @@ -90,7 +83,7 @@ def _create_namelist(case, confdir, inst_string, infile, nmlgen):
else:
nmlgen.add_default("finidat_rtm")

ncpl_base_period = case.get_value('NCPL_BASE_PERIOD')
ncpl_base_period = case.get_value('NCPL_BASE_PERIOD')
if ncpl_base_period == 'hour':
basedt = 3600
elif ncpl_base_period == 'day':
Expand All @@ -113,10 +106,10 @@ def _create_namelist(case, confdir, inst_string, infile, nmlgen):

rof_ncpl = case.get_value("ROF_NCPL")
if basedt % rof_ncpl != 0:
expect(False, "rof_ncpl %s doesn't divide evenly into basedt \n"
expect(False, "rof_ncpl %s doesn't divide evenly into basedt %s\n"
%(rof_ncpl, basedt))
else:
rtm_tstep = basedt / rof_ncpl
rtm_tstep = basedt // rof_ncpl
nmlgen.set_value("rtm_tstep", value=rtm_tstep)

#----------------------------------------------------
Expand All @@ -130,26 +123,26 @@ def buildnml(case, caseroot, compname):
###############################################################################
"""Build the namelist """

# Build the component namelist
# Build the component namelist
if compname != "rtm":
raise AttributeError

srcroot = case.get_value("SRCROOT")
srcroot = case.get_value("SRCROOT")
rundir = case.get_value("RUNDIR")
ninst = case.get_value("NINST_ROF")

# Determine configuration directory
confdir = os.path.join(caseroot,"Buildconf","rtmconf")
confdir = os.path.join(caseroot, "Buildconf", "rtmconf")
if not os.path.isdir(confdir):
os.makedirs(confdir)

#----------------------------------------------------
# Construct the namelist generator
# Construct the namelist generator
#----------------------------------------------------
# determine directory for user modified namelist_definitions.xml and namelist_defaults.xml
user_xml_dir = os.path.join(caseroot, "SourceMods", "src.rtm")
expect (os.path.isdir(user_xml_dir),
"user_xml_dir %s does not exist " %user_xml_dir)
expect(os.path.isdir(user_xml_dir),
"user_xml_dir %s does not exist "%user_xml_dir)

# NOTE: User definition *replaces* existing definition.
namelist_xml_dir = os.path.join(srcroot, "components", "rtm", "cime_config")
Expand All @@ -163,6 +156,12 @@ def buildnml(case, caseroot, compname):
# Create the namelist generator object - independent of instance
nmlgen = NamelistGenerator(case, definition_file)

#----------------------------------------------------
# Clear out old data.
#----------------------------------------------------
data_list_path = os.path.join(case.get_case_root(), "Buildconf", "mosart.input_data_list")
if os.path.exists(data_list_path):
os.remove(data_list_path)
#----------------------------------------------------
# Loop over instances
#----------------------------------------------------
Expand All @@ -175,9 +174,9 @@ def buildnml(case, caseroot, compname):

# If multi-instance case does not have restart file, use
# single-case restart for each instance
rpointer = "rpointer.rof"
if (os.path.isfile(os.path.join(rundir,rpointer)) and
(not os.path.isfile(os.path.join(rundir,rpointer + inst_string)))):
rpointer = "rpointer.rof"
if (os.path.isfile(os.path.join(rundir, rpointer)) and
(not os.path.isfile(os.path.join(rundir, rpointer + inst_string)))):
shutil.copy(os.path.join(rundir, rpointer),
os.path.join(rundir, rpointer + inst_string))

Expand All @@ -193,20 +192,20 @@ def buildnml(case, caseroot, compname):
create_namelist_infile(case, user_nl_file, infile)
namelist_infile = [infile]

# create namelist
_create_namelist(case, confdir, inst_string, namelist_infile, nmlgen)
# create namelist
_create_namelists(case, confdir, inst_string, namelist_infile, nmlgen, data_list_path)

# copy namelist files and stream text files, to rundir
if os.path.isdir(rundir):
file_src = os.path.join(confdir, 'rof_in')
file_src = os.path.join(confdir, 'rof_in')
file_dest = os.path.join(rundir, 'rof_in')
if inst_string:
file_dest += inst_string
shutil.copy(file_src, file_dest)

for txtfile in glob.glob(os.path.join(confdir, "*txt*")):
shutil.copy(txtfile, rundir)

###############################################################################
def _main_func():

Expand Down
6 changes: 3 additions & 3 deletions cime_config/namelist_definition_rtm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,13 @@
<type>integer(6)</type>
<category>history</category>
<group>rtm_inparm</group>
<valid_values>1,2</valid_values>
<valid_values>1</valid_values>
<desc>
Per tape series history file density (i.e. output precision)
1=double precision, 2=single precision
1=double precision, 2=single precision (NOT functional)
</desc>
<values>
<value>2</value>
<value>1</value>
</values>
</entry>

Expand Down
24 changes: 24 additions & 0 deletions docs/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
===============================================================
Tag name: rtm1_0_67
Originator(s): erik
Date: May 07, 2019
One-line Summary: Move release-cesm2.0.02 to master

basetype wasn't declared and needed to be. Also add more "implicit none"
statements in. Remove the deletion of "rtm.input_data_list" file, as cime
now does this. Remove the option of setting single-precision
history output, as it sometimes has numerical conversion issues. The
real solution for it should be to keep a single-precision history
buffer that then outputs at the same precision as stored, rather than
converting just before. This would trigger issues with the conversion
earlier.

Changes ported from mosart/#15 to rtm. Run pylint through buildlib/buildnml,
changes for fill value needed for pio2. Also use the floor operator
for a specific integer divide as python3 turns it into reals.

Add CODE_OF_CONDUCT.md

Testing:
rtm testlist on hobart and cheyenne (PASS)

===============================================================
Tag name: rtm1_0_66
Originator(s): erik
Expand Down
9 changes: 0 additions & 9 deletions docs/index.html

This file was deleted.

111 changes: 111 additions & 0 deletions docs/release-cesm2.0.ChangeLog
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
===============================================================
Tag name: release-cesm2.0.02
Originator(s): erik
Date: Oct 19, 2018
One-line Summary: Fix some issues with nag compiler, remove rtmhist_ndens==2 option

basetype wasn't declared and needed to be. Also add more "implicit none"
statements in. Remove the deletion of "rtm.input_data_list" file, as cime
now does this. Remove the option of setting single-precision
history output, as it sometimes has numerical conversion issues. The
real solution for it should be to keep a single-precision history
buffer that then outputs at the same precision as stored, rather than
converting just before. This would trigger issues with the conversion
earlier.

RTM Master Tag This Corresponds To: rtm1_0_66 (with changes)

Software Changes since last release: release-cesm2.0.01
* Fix issues with nag compiler
* Remove single precision output option

Science Changes since last release: release-cesm2.0.00
* None

Changes to User Interface since: release-cesm2.0.00
* rtmhist_ndens can no longer equal 2.

Pull Requests that document the changes (include PR ids):
#10 -- Fix some issues with nag compiler

Testing:
rtm testlist on hobart and cheyenne (PASS)


===============================================================
Tag name: release-cesm2.0.01
Originator(s): erik
Date: Oct 10, 2018
One-line Summary: pylint cleanup, and fill value changes for pio2

Changes ported from mosart/#15 to rtm. Run pylint through buildlib/buildnml,
changes for fill value needed for pio2. Also use the floor operator
for a specific integer divide as python3 turns it into reals.

RTM Master Tag This Corresponds To: rtm1_0_66 (with changes)

Purpose:

Software Changes since last release: release-cesm2.0.00
* pylint on buildlib/buildnml
* fill value changes needed for pio2 from the mosart changes
* Use floor operator in buildnml for an integer division

Science Changes since last release: release-cesm2.0.00
* None

Changes to User Interface since: release-cesm2.0.00
* None

Pull Requests that document the changes (include PR ids):
#9 -- Same changes on mosart fill-value and pylint cleanup on rtm enhancement

Testing:
rtm testlist on hobart and cheyenne (PASS)

===============================================================
Tag name: release-cesm2.0.00
Originator(s): erik
Date: May 21, 2018
One-line Summary: First CESM2.0 release version, identical to rtm1_0_66

Purpose:

First RTM version for the CESM2.0 release. This tag is identical to rtm1_0_66

RTM Master Tag This Corresponds To: rtm1_0_66

Software Changes since last release: rtm1_0_30

* Add in model_doi_url read in from infodata from coupler.
* RTM own's version of config_archive.xml
* Remove old rof_comp_esmf
* Remove revision_id from output files
* Convert testlist format to version 2, and use new Clm5 compset names.
* Remove yellowstone tests.
* Update config_component.xml to version 3 format.
* if NINST_RTM > 1, will check if REFCASE has instance name and use it, otherwise without it.
* I/O fixes from Jim Edwards
* Update buildnamelist to cime5 python namelist infrastructure
* Add time period frequency to output history file
* Remove ESMF top level coupler interface and tests
* Have RTM react to CLM_ACCELERATED_SPINUP setting from CLM and turn itself off
* Update to newer cime versions
* Move tests from goldbach to hobart
* Don't assume that direction files are global
* NAG6.0 requires additional pointers to be nullified
* readnamelist on mastertask only
* PIO2 Compatibility changes
* address valgrind errors
* add SHR_ASSERT macros
* migration of cpl_share/, cpl_esmf/ and cpl_mct code into new cpl/ and introduction of rof_import_export.F90

Science Changes since last release: rtm1_0_30

* Treat irrigation as a seperate flux
* Remove directo to ocean runnoff
* fix fthresh bug and refactor RtmFloodInit
* convert volr coupling field from state to flux
* RTM Master Tag this corresponds to: rtm1_0_66

===============================================================
Loading

0 comments on commit 0ee4b12

Please sign in to comment.