Skip to content

Commit

Permalink
Merge pull request #3126 from jedwards4b/nuopc-cmeps
Browse files Browse the repository at this point in the history
Nuopc cmeps removed.
Remove the nuopc driver and mediator to a separate repository https://github.com/ESCOMP/CMEPS.git

Test suite: scripts_regression_tests.py
Test baseline:
Test namelist changes:
Test status: bit for bit
Fixes

User interface changes?:

Update gh-pages html (Y/N)?:

Code review:
  • Loading branch information
jedwards4b authored May 31, 2019
2 parents 4f20a4b + 9a2b690 commit 6493b34
Show file tree
Hide file tree
Showing 78 changed files with 101 additions and 31,525 deletions.
2 changes: 2 additions & 0 deletions config/cesm/config_grids.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1412,6 +1412,7 @@
<file grid="ocnice" mask="tx0.1v2">$DIN_LOC_ROOT/share/domains/domain.ocn.tx0.1v2.161014.nc</file>
<file grid="atm|lnd" mask="tx0.1v3">$DIN_LOC_ROOT/share/domains/domain.lnd.TL319_tx0.1v3.170730.nc</file>
<file grid="ocnice" mask="tx0.1v3">$DIN_LOC_ROOT/share/domains/domain.ocn.tx0.1v3.170730.nc</file>
<mesh driver="nuopc">$DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc</mesh>
<desc>TL319 grid for JRA55</desc>
</domain>

Expand Down Expand Up @@ -1528,6 +1529,7 @@

<domain name="JRA025">
<nx>1440</nx> <ny>720</ny>
<mesh driver="nuopc">$DIN_LOC_ROOT/share/meshes/JRA025m.170209_ESMFmesh.nc</mesh>
<!-- TODO (mvertens, 2018-12-02): create a domain file for this -->
<desc>JRA is 0.25 degree runoff grid for use with JRA-55 runoff data</desc>
</domain>
Expand Down
8 changes: 4 additions & 4 deletions config/cesm/machines/config_machines.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2276,13 +2276,13 @@ This allows using a different mpirun command to launch unit tests
</modules>
<modules mpilib="mvapich2">
<command name="load">mvapich2/2.3b</command>
<command name="load">pnetcdf/1.8.1</command>
<command name="load">pnetcdf/1.11.0</command>
<command name="load">parallel-netcdf/4.3.3.1</command>
</modules>
<modules mpilib="impi">
<command name="rm">mvapich2</command>
<command name="load">impi/18.0.2</command>
<command name="load">pnetcdf/1.8.1</command>
<command name="load">pnetcdf/1.11.0</command>
<command name="load">parallel-netcdf/4.3.3.1</command>
</modules>
<modules mpilib="mpi-serial">
Expand Down Expand Up @@ -2350,13 +2350,13 @@ This allows using a different mpirun command to launch unit tests
</modules>
<modules mpilib="mvapich2">
<command name="load">mvapich2/2.3b</command>
<command name="load">pnetcdf/1.8.1</command>
<command name="load">pnetcdf/1.11.0</command>
<command name="load">parallel-netcdf/4.3.3.1</command>
</modules>
<modules mpilib="impi">
<command name="rm">mvapich2</command>
<command name="load">impi/17.0.3</command>
<command name="load">pnetcdf/1.8.1</command>
<command name="load">pnetcdf/1.11.0</command>
<command name="load">parallel-netcdf/4.3.3.1</command>
</modules>
<modules mpilib="mpi-serial">
Expand Down
7 changes: 5 additions & 2 deletions config/cesm/machines/config_pio.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@
</values>
</entry>

<!--
<entry id="PIO_VERSION">
<values>
<value mach="stampede2-skx">1</value>
</values>
</entry>

-->

<!--- uncomment and fill in relevant sections
<entry id="PIO_ROOT">
Expand All @@ -57,7 +58,9 @@

<entry id="PIO_REARRANGER">
<values>
<value>$PIO_VERSION</value>
<!-- Note: problem not using box rearranger with nuopc caps -->
<!-- <value>$PIO_VERSION</value> -->
<value>1</value>
</values>
</entry>

Expand Down
9 changes: 6 additions & 3 deletions scripts/create_test
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ def parse_command_line(args, description):
parser.add_argument("--xml-testlist",
help="Use this testlist to lookup tests.The default is specified in config_files.xml")

parser.add_argument("--xml-driver", choices=('mct', 'nuopc', 'moab'),
help="Override driver specified in tests and use this one.")

parser.add_argument("testargs", nargs="*",
help="Tests to run. Testname form is TEST.GRID.COMPSET[.MACHINE_COMPILER]")

Expand Down Expand Up @@ -388,9 +391,9 @@ def parse_command_line(args, description):
"At least one of --xml-machine, --xml-testlist, "
"--xml-compiler, --xml-category or a valid test name must be provided.")

test_data = get_tests_from_xml(args.xml_machine, args.xml_category,
args.xml_compiler, args.xml_testlist,
machine_name, args.compiler)
test_data = get_tests_from_xml(xml_machine=args.xml_machine, xml_category=args.xml_category,
xml_compiler=args.xml_compiler, xml_testlist=args.xml_testlist,
machine=machine_name, compiler=args.compiler, driver=args.xml_driver)
test_names = [item["name"] for item in test_data]
for test_datum in test_data:
test_extra_data[test_datum["name"]] = test_datum
Expand Down
5 changes: 3 additions & 2 deletions scripts/lib/CIME/code_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ def _run_pylint(on_file, interactive):
cmd_options +=",relative-import"

# add init-hook option
cmd_options += " --init-hook='sys.path.extend((\"%s\",\"%s\",\"%s\"))'"%\
cmd_options += " --init-hook='sys.path.extend((\"%s\",\"%s\",\"%s\",\"%s\"))'"%\
(os.path.join(cimeroot,"scripts","lib"),
os.path.join(cimeroot,"scripts","Tools"),
os.path.join(cimeroot,"scripts","fortran_unit_testing","python"))
os.path.join(cimeroot,"scripts","fortran_unit_testing","python"),
os.path.join(cimeroot,"src","drivers","nuopc","cime_config","runseq"))

cmd = "%s %s %s" % (pylint, cmd_options, on_file)
logger.debug("pylint command is %s"%cmd)
Expand Down
56 changes: 29 additions & 27 deletions scripts/lib/CIME/namelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -1178,32 +1178,34 @@ def _write(self, out_file, groups, format_, sorted_groups):
for group_name in group_names:
if format_ == 'nml':
out_file.write("&{}\n".format(group_name))
group = self._groups[group_name]
for name in sorted(group.keys()):
values = group[name]

# @ is used in a namelist to put the same namelist variable in multiple groups
# in the write phase, all characters in the namelist variable name after
# the @ and including the @ should be removed
if "@" in name:
name = re.sub('@.+$', "", name)

# To prettify things for long lists of values, build strings
# line-by-line.
if values[0] == "True" or values[0] == "False":
values[0] = values[0].replace("True",".true.").replace("False",".false.")
lines = [" {}{} {}".format(name, equals, values[0])]
for value in values[1:]:
if value == "True" or value == "False":
value = value.replace("True",".true.").replace("False",".false.")
if len(lines[-1]) + len(value) <= 77:
lines[-1] += ", " + value
else:
lines[-1] += ",\n"
lines.append(" " + value)
lines[-1] += "\n"
for line in lines:
out_file.write(line)
# allow empty group
if group_name in self._groups:
group = self._groups[group_name]
for name in sorted(group.keys()):
values = group[name]

# @ is used in a namelist to put the same namelist variable in multiple groups
# in the write phase, all characters in the namelist variable name after
# the @ and including the @ should be removed
if "@" in name:
name = re.sub('@.+$', "", name)

# To prettify things for long lists of values, build strings
# line-by-line.
if values[0] == "True" or values[0] == "False":
values[0] = values[0].replace("True",".true.").replace("False",".false.")
lines = [" {}{} {}".format(name, equals, values[0])]
for value in values[1:]:
if value == "True" or value == "False":
value = value.replace("True",".true.").replace("False",".false.")
if len(lines[-1]) + len(value) <= 77:
lines[-1] += ", " + value
else:
lines[-1] += ",\n"
lines.append(" " + value)
lines[-1] += "\n"
for line in lines:
out_file.write(line)
if format_ == 'nml':
out_file.write("/\n")
if format_ == 'nmlcontents':
Expand All @@ -1220,7 +1222,7 @@ def _write_nuopc(self, out_file, groups, sorted_groups, skip_comps):
group_names = groups

for group_name in group_names:
if "_attributes" not in group_name and "nuopc_" not in group_name:
if "_attributes" not in group_name and "nuopc_" not in group_name and "_no_group" not in group_name:
continue
if "_attributes" in group_name:
out_file.write("{}::\n".format(group_name))
Expand Down
15 changes: 14 additions & 1 deletion scripts/lib/CIME/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
logger = logging.getLogger(__name__)

def get_tests_from_xml(xml_machine=None,xml_category=None,xml_compiler=None, xml_testlist=None,
machine=None, compiler=None):
machine=None, compiler=None, driver=None):
"""
Parse testlists for a list of tests
"""
Expand Down Expand Up @@ -46,6 +46,19 @@ def get_tests_from_xml(xml_machine=None,xml_category=None,xml_compiler=None, xml
test["name"] = CIME.utils.get_full_test_name(test["testname"], grid=test["grid"], compset=test["compset"],
machine=thismach, compiler=thiscompiler,
testmod=None if "testmods" not in test else test["testmods"])
if driver:
# override default or specified driver
founddriver = False
for specdriver in ("Vnuopc","Vmct","Vmoab"):
if specdriver in test["name"]:
test["name"] = test["name"].replace(specdriver,"V{}".format(driver))
founddriver = True
if not founddriver:
name = test["name"]
index = name.find('.')
test["name"] = name[:index] + "_V{}".format(driver) + name[index:]


logger.debug("Adding test {} with compiler {}".format(test["name"], test["compiler"]))
listoftests += newtests
logger.debug("Found {:d} tests".format(len(listoftests)))
Expand Down
2 changes: 2 additions & 0 deletions scripts/tests/scripts_regression_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,8 @@ def test_m_createnewcase_alternate_drivers(self):
cls = self.__class__
model = CIME.utils.get_model()
for driver in ("nuopc", "moab"):
if not os.path.exists(os.path.join(get_cime_root(),"src","drivers",driver)):
self.skipTest("Skipping driver test for {}, driver not found".format(driver))
if ((model == 'cesm' and driver == 'moab') or
(model == 'e3sm' and driver == 'nuopc')):
continue
Expand Down
25 changes: 22 additions & 3 deletions src/components/data_comps/dice/nuopc/dice_comp_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,16 @@ module dice_comp_mod
!===============================================================================

subroutine dice_comp_advertise(importState, exportState, flds_scalar_name, &
ice_present, ice_prognostic, fldsFrIce_num, fldsFrIce, fldsToIce_num, fldsToIce, rc)
ice_present, ice_prognostic, flds_i2o_per_cat, &
fldsFrIce_num, fldsFrIce, fldsToIce_num, fldsToIce, rc)

! input/output arguments
type(ESMF_State) , intent(inout) :: importState
type(ESMF_State) , intent(inout) :: exportState
character(len=*) , intent(in) :: flds_scalar_name
logical , intent(in) :: ice_present
logical , intent(in) :: ice_prognostic
logical , intent(in) :: flds_i2o_per_cat
integer , intent(out) :: fldsToIce_num
integer , intent(out) :: fldsFrIce_num
type (fld_list_type) , intent(out) :: fldsToIce(:)
Expand Down Expand Up @@ -154,6 +156,15 @@ subroutine dice_comp_advertise(importState, exportState, flds_scalar_name, &
call dshr_fld_add(data_fld='ifrac', data_fld_array=avifld, model_fld='Si_ifrac', model_fld_array=avofld, &
model_fld_concat=flds_i2x, model_fld_index=kiFrac, fldlist_num=fldsFrIce_num, fldlist=fldsFrIce)

if (flds_i2o_per_cat) then
call dshr_fld_add(model_fld='Si_ifrac_01' , model_fld_concat=flds_i2x, model_fld_index=kiFrac_01)
call dshr_fld_add(model_fld='Fioi_swpen_ifrac_01', model_fld_concat=flds_i2x, model_fld_index=kswpen_iFrac_01)
call dshr_fld_add(med_fld='Si_ifrac_n', fldlist_num=fldsFrIce_num, fldlist=fldsFrIce, &
ungridded_lbound=1, ungridded_ubound=1)
call dshr_fld_add(med_fld='Fioi_swpen_ifrac_n', fldlist_num=fldsFrIce_num, fldlist=fldsFrIce, &
ungridded_lbound=1, ungridded_ubound=1)
end if

! export fields that have no corresponding stream field (computed internally)

call dshr_fld_add(model_fld='Si_imask', model_fld_concat=flds_i2x, model_fld_index=km, &
Expand Down Expand Up @@ -500,7 +511,7 @@ subroutine dice_comp_init(flds_i2o_per_cat, mpicom, compid, my_task, master_task
! optional per thickness category fields
if (flds_i2o_per_cat) then
kiFrac_01 = mct_aVect_indexRA(i2x,'Si_ifrac_01')
kswpen_iFrac_01 = mct_aVect_indexRA(i2x,'PFioi_swpen_ifrac_01')
kswpen_iFrac_01 = mct_aVect_indexRA(i2x,'Fioi_swpen_ifrac_01')
end if

call mct_aVect_init(x2i, rList=flds_x2i, lsize=lsize)
Expand Down Expand Up @@ -966,10 +977,11 @@ end subroutine dice_comp_import

!===============================================================================

subroutine dice_comp_export(exportState, rc)
subroutine dice_comp_export(exportState, flds_i2o_per_cat, rc)

! input/output variables
type(ESMF_State) :: exportState
logical, intent(in) :: flds_i2o_per_cat
integer, intent(out) :: rc

! local variables
Expand All @@ -981,6 +993,13 @@ subroutine dice_comp_export(exportState, rc)
call dshr_export(i2x%rattr(kiFrac,:) , exportState, 'Si_ifrac', rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

if (flds_i2o_per_cat) then
call dshr_export(i2x%rattr(kiFrac_01,:), exportState, 'Si_ifrac_n', ungridded_index=1, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call dshr_export(i2x%rattr(kswpen_iFrac_01,:), exportState, 'Fioi_swpen_ifrac_n', ungridded_index=1, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
end if

call dshr_export(i2x%rattr(km,:) , exportState, 'Si_imask', rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

Expand Down
16 changes: 12 additions & 4 deletions src/components/data_comps/dice/nuopc/ice_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,13 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
endif

call NUOPC_CompAttributeGet(gcomp, name='flds_i2o_per_cat', value=cvalue, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
read(cvalue,*) flds_i2o_per_cat

call dice_comp_advertise(importstate, exportState, flds_scalar_name, &
ice_present, ice_prognostic, &
fldsFrIce_num, fldsFrIce, fldsToIce_num, fldsToIce, rc)
ice_present, ice_prognostic, flds_i2o_per_cat, &
fldsFrIce_num, fldsFrIce, fldsToIce_num, fldsToIce, rc)

!----------------------------------------------------------------------------
! Reset shr logging to original values
Expand Down Expand Up @@ -347,6 +351,10 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
Emesh = ESMF_MeshCreate(filename=trim(cvalue), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

if (my_task == master_task) then
write(logunit,*) " obtaining dice mesh from " // trim(cvalue)
end if

!--------------------------------
! Initialize model
!--------------------------------
Expand Down Expand Up @@ -406,7 +414,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
calendar, modeldt, current_ymd, current_tod, cosArg)

! Pack export state
call dice_comp_export(exportState, rc=rc)
call dice_comp_export(exportState, flds_i2o_per_cat, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

call State_SetScalar(dble(nxg),flds_scalar_index_nx, exportState, &
Expand Down Expand Up @@ -539,7 +547,7 @@ subroutine ModelAdvance(gcomp, rc)
! Pack export state
!--------------------------------

call dice_comp_export(exportState, rc=rc)
call dice_comp_export(exportState, flds_i2o_per_cat, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

!--------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/components/xcpl_comps/xglc/nuopc/glc_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ subroutine field_setexport(exportState, fldname, lon, lat, nf, ungridded_index,
else
call ESMF_FieldGet(lfield, farrayPtr=data1d, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
if (fldname == 'Sg_icemask' .or. 'fldname == Sg_icemask_coupled_fluxes' .or. fldname == 'Sg_ice_covered') then
if (fldname == 'Sg_icemask' .or. fldname == 'Sg_icemask_coupled_fluxes' .or. fldname == 'Sg_ice_covered') then
data1d(:) = 1._r8
else
do i = 1,size(data1d)
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/mct/cime_config/config_component_cesm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<default_value>0</default_value>
<group>run_flags</group>
<file>env_run.xml</file>
<desc>Sets level of task-to-node mapping output for the whole model
<desc>Sets level of task-to-node mapping output for the whole model
(0: no output; 1: compact; 2: verbose).</desc>
</entry>

Expand Down
Loading

0 comments on commit 6493b34

Please sign in to comment.