Skip to content

Commit

Permalink
Merge pull request #4 from ESCOMP/inline_updates
Browse files Browse the repository at this point in the history
Addition of new data model testlists
Adds new aux_cdeps tests lists to every CDEPS component
Fixes issues related to the creation of regional meshes and single column configurations
Fixes the inline interface to be used by prognostic components
  • Loading branch information
mvertens authored Jul 11, 2020
2 parents dd64686 + f0a47e4 commit e8148f9
Show file tree
Hide file tree
Showing 43 changed files with 1,346 additions and 1,106 deletions.
8 changes: 6 additions & 2 deletions cime_config/buildlib
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,14 @@ def buildlib(bldroot, libroot, case, compname=None):


if compname:
run_cmd("make d{}".format(compname), from_dir=bldroot, verbose=True)
s, o, e = run_cmd("make d{}".format(compname), from_dir=bldroot, verbose=True)
libname = "lib{}.a".format(compname)
dlibname = "libd{}.a".format(compname)
symlink_force(os.path.join(bldroot,dlibname), os.path.join(libroot,libname))
dlibpath = os.path.join(bldroot, dlibname)
if os.path.exists(dlibpath):
symlink_force(os.path.join(bldroot,dlibname), os.path.join(libroot,libname))
else:
expect(False, "ERROR in {} build {} {}".format(compname,o,e))
else:
logger.info("Running cmake for CDEPS")
srcpath = os.path.join(case.get_value("CIMEROOT"),"src","components","cdeps")
Expand Down
150 changes: 150 additions & 0 deletions cime_config/testdefs/testlist_cdeps.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
<?xml version="1.0"?>
<testlist version="2.0">

<test compset="2000_DATM%QIA_SLND_SICE_SOCN_SROF_SGLC_SWAV_SESP" grid="f10_f10_musgs" name="SMS_Vnuopc_Ld5">
<machines>
<machine name="cheyenne" compiler="intel" category="aux_cdeps"/>
</machines>
<options>
<option name="wallclock"> 00:10:00 </option>
</options>
</test>
<test compset="2000_DATM%CRUv7_SLND_SICE_SOCN_SROF_SGLC_SWAV_SESP" grid="f10_f10_musgs" name="SMS_Vnuopc_Ld5">
<machines>
<machine name="cheyenne" compiler="intel" category="aux_cdeps"/>
</machines>
<options>
<option name="wallclock"> 00:10:00 </option>
</options>
</test>
<test compset="HIST_DATM%GSWP3v1_SLND_SICE_SOCN_SROF_SGLC_SWAV_SESP" grid="f10_f10_musgs" name="SMS_Vnuopc_Ld5">
<machines>
<machine name="cheyenne" compiler="intel" category="aux_cdeps"/>
</machines>
<options>
<option name="wallclock"> 00:10:00 </option>
</options>
</test>
<test compset="1850_DATM%GSWP3v1_SLND_SICE_SOCN_SROF_SGLC_SWAV_SESP" grid="f10_f10_musgs" name="SMS_Vnuopc_Ld5">
<machines>
<machine name="cheyenne" compiler="intel" category="aux_cdeps"/>
</machines>
<options>
<option name="wallclock"> 00:10:00 </option>
</options>
</test>
<test compset="2010_DATM%GSWP3v1_SLND_SICE_SOCN_SROF_SGLC_SWAV_SESP" grid="f10_f10_musgs" name="SMS_Vnuopc_Ld5">
<machines>
<machine name="cheyenne" compiler="intel" category="aux_cdeps"/>
</machines>
<options>
<option name="wallclock"> 00:10:00 </option>
</options>
</test>
<test compset="SSP585_DATM%GSWP3v1_SLND_SICE_SOCN_SROF_SGLC_SWAV_SESP" grid="f10_f10_musgs" name="SMS_Vnuopc_Ld5">
<machines>
<machine name="cheyenne" compiler="intel" category="aux_cdeps"/>
</machines>
<options>
<option name="wallclock"> 00:10:00 </option>
</options>
</test>
<test compset="2000_DATM%NLDAS2_SLND_SICE_SOCN_SROF_SGLC_SWAV_SESP" grid="f10_f10_musgs" name="SMS_Vnuopc_Ld5">
<machines>
<machine name="cheyenne" compiler="intel" category="aux_cdeps"/>
</machines>
<options>
<option name="wallclock"> 00:10:00 </option>
</options>
</test>
<test compset="2000_DATM%NYF_SLND_SICE_SOCN_SROF_SGLC_SWAV_SESP" grid="T62_g17" name="SMS_Vnuopc_Ld5">
<machines>
<machine name="cheyenne" compiler="intel" category="aux_cdeps"/>
</machines>
<options>
<option name="wallclock"> 00:10:00 </option>
</options>
</test>
<test compset="2000_DATM%IAF_SLND_SICE_SOCN_SROF_SGLC_SWAV_SESP" grid="T62_g17" name="SMS_Vnuopc_Ld5">
<machines>
<machine name="cheyenne" compiler="intel" category="aux_cdeps"/>
</machines>
<options>
<option name="wallclock"> 00:10:00 </option>
</options>
</test>
<test compset="2000_DATM%JRA_SLND_SICE_SOCN_SROF_SGLC_SWAV_SESP" grid="TL319_t061" name="SMS_Vnuopc_Ld5">
<machines>
<machine name="cheyenne" compiler="intel" category="aux_cdeps"/>
</machines>
<options>
<option name="wallclock"> 00:10:00 </option>
</options>
</test>
<test compset="2000_DATM%JRA-1p4-2018_SLND_SICE_SOCN_SROF_SGLC_SWAV_SESP" grid="TL319_t061" name="SMS_Vnuopc_Ld5">
<machines>
<machine name="cheyenne" compiler="intel" category="aux_cdeps"/>
</machines>
<options>
<option name="wallclock"> 00:10:00 </option>
</options>
</test>
<test compset="2000_DATM%1PT_SLND_SICE_SOCN_SROF_SGLC_SWAV_SESP" grid="1x1_mexicocityMEX" name="SMS_Vnuopc_Ld5_P1">
<machines>
<machine name="cheyenne" compiler="intel" category="aux_cdeps"/>
</machines>
<options>
<option name="wallclock"> 00:10:00 </option>
</options>
</test>
<!-- ================================= -->
<!-- DOCN testing -->
<!-- ================================= -->
<test compset="2000_SATM_SLND_SICE_DOCN%DOM_SROF_SGLC_SWAV" grid="f09_f09_mg17" name="SMS_Vnuopc_Ln5">
<machines>
<machine name="cheyenne" compiler="intel" category="aux_cdeps"/>
</machines>
<options>
<option name="wallclock"> 00:10:00 </option>
</options>
</test>
<test compset="HIST_SATM_SLND_SICE_DOCN%DOM_SROF_SGLC_SWAV" grid="f09_f09_mg17" name="SMS_Vnuopc_Ln5">
<machines>
<machine name="cheyenne" compiler="intel" category="aux_cdeps"/>
</machines>
<options>
<option name="wallclock"> 00:10:00 </option>
</options>
</test>
<test compset="2000_DATM%QIA_SLND_SICE_DOCN%SOMAQP_SROF_SGLC_SWAV" grid="f19_f19_mg17" name="SMS_Vnuopc_Ln5">
<machines>
<machine name="cheyenne" compiler="intel" category="aux_cdeps"/>
</machines>
<options>
<option name="wallclock"> 00:10:00 </option>
</options>
</test>
<!-- ================================= -->
<!-- DLND testing -->
<!-- ================================= -->
<test compset="1850_SATM_DLND%SCPL_SICE_SOCN_SROF_SGLC_SWAV" grid="f09_f09_mg17" name="SMS_Vnuopc_Ld3">
<machines>
<machine name="cheyenne" compiler="intel" category="aux_cdeps"/>
</machines>
<options>
<option name="wallclock"> 00:10:00 </option>
</options>
</test>
<!-- ================================= -->
<!-- DWAV testing -->
<!-- ================================= -->
<test compset="2000_SATM_SLND_SICE_SOCN_SROF_SGLC_DWAV%CLIMO" grid="ww3a" name="SMS_Vnuopc_Ld2">
<machines>
<machine name="cheyenne" compiler="intel" category="aux_cdeps"/>
</machines>
<options>
<option name="wallclock"> 00:10:00 </option>
</options>
</test>

</testlist>
25 changes: 15 additions & 10 deletions datm/atm_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,19 @@ module atm_comp_nuopc
integer :: flds_scalar_index_nx = 0
integer :: flds_scalar_index_ny = 0
integer :: flds_scalar_index_nextsw_cday = 0
integer :: compid ! component id (needed by pio)
integer :: mpicom ! mpi communicator
integer :: my_task ! my task in mpi communicator mpicom
logical :: masterproc ! true of my_task == master_task
integer :: inst_index ! number of current instance (ie. 1)
character(len=16) :: inst_suffix = "" ! char string associated with instance (ie. "_0001" or "")
integer :: logunit ! logging unit number
logical :: restart_read ! start from restart
character(CL) :: case_name ! case name
character(len=*) , parameter :: nullstr = 'undefined'
character(CL) :: case_name ! case name
character(len=*) , parameter :: nullstr = 'null'

! datm_in namelist input
character(CL) :: nlfilename = nullstr ! filename to obtain namelist info from
character(CL) :: xmlfilename = nullstr ! filename to obtain namelist info from
character(CL) :: xmlfilename = nullstr ! filename to obtain namelist info from
character(CL) :: dataMode = nullstr ! flags physics options wrt input data
character(CL) :: model_meshfile = nullstr ! full pathname to model meshfile
character(CL) :: model_maskfile = nullstr ! full pathname to obtain mask from
Expand All @@ -106,6 +105,10 @@ module atm_comp_nuopc
type(fldList_type) , pointer :: fldsExport => null()
type(dfield_type) , pointer :: dfields => null()

! model mask and model fraction
real(r8), pointer :: model_frac(:) => null()
integer , pointer :: model_mask(:) => null()

! constants
integer :: idt ! integer model timestep
logical :: diagnose_data = .true.
Expand Down Expand Up @@ -186,7 +189,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
character(*) ,parameter :: F02 = "('(atm_comp_nuopc) ',a,l6)"
!-------------------------------------------------------------------------------

namelist / datm_nml / datamode, model_meshfile, model_maskfile, model_createmesh_fromfile, &
namelist / datm_nml / datamode, &
model_meshfile, model_maskfile, model_createmesh_fromfile, &
nx_global, ny_global, restfilm, iradsw, factorFn_data, factorFn_mesh, &
flds_presaero, flds_co2, flds_wiso, bias_correct, anomaly_forcing

Expand Down Expand Up @@ -233,6 +237,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)

! write namelist input to standard out
if (my_task == master_task) then
write(logunit,F00)' case_name = ',trim(case_name)
write(logunit,F00)' datamode = ',trim(datamode)
if (model_createmesh_fromfile /= nullstr) then
write(logunit,F00)' model_create_meshfile_fromfile = ',trim(model_createmesh_fromfile)
Expand Down Expand Up @@ -292,7 +297,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
call datm_datamode_core2_advertise(exportState, fldsExport, flds_scalar_name, &
flds_co2, flds_wiso, flds_presaero, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
case ('CORE2_IAF_JRA')
case ('CORE_IAF_JRA')
call datm_datamode_jra_advertise(exportState, fldsExport, flds_scalar_name, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
case ('CLMNCEP')
Expand Down Expand Up @@ -340,14 +345,14 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)

! Initialize mesh, restart flag, compid, and logunit
call t_startf('datm_strdata_init')

call dshr_mesh_init(gcomp, compid, logunit, 'atm', nx_global, ny_global, &
model_meshfile, model_maskfile, model_createmesh_fromfile, model_mesh, restart_read, rc=rc)
call dshr_mesh_init(gcomp, nullstr, logunit, 'ATM', nx_global, ny_global, &
model_meshfile, model_maskfile, model_createmesh_fromfile, model_mesh, &
model_mask, model_frac, restart_read, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

! Initialize stream data type
xmlfilename = 'datm.streams'//trim(inst_suffix)//'.xml'
call shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, compid, logunit, rc=rc)
call shr_strdata_init_from_xml(sdat, xmlfilename, model_mesh, clock, 'ATM', logunit, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call t_stopf('datm_strdata_init')

Expand Down
34 changes: 8 additions & 26 deletions datm/cime_config/buildnml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path
"""

#----------------------------------------------------
# Get a bunch of information from the case.
# Write out datm_in and datm.streams.xml
#----------------------------------------------------

caseroot = case.get_value("CASEROOT")
datm_mode = case.get_value("DATM_MODE")
datm_topo = case.get_value("DATM_TOPO")
Expand All @@ -47,57 +48,38 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path
grid = case.get_value("GRID")
comp_lnd = case.get_value("COMP_LND")

#----------------------------------------------------
# Check for incompatible options.
#----------------------------------------------------

if "CLM" in datm_mode and comp_lnd == "clm":
expect(datm_presaero != "none",
"A DATM_MODE for CLM is incompatible with DATM_PRESAERO=none.")
expect(datm_topo != "none",
"A DATM_MODE for CLM is incompatible with DATM_TOPO=none.")

#----------------------------------------------------
# Log some settings.
#----------------------------------------------------
logger.debug("DATM mode is {}".format(datm_mode))
logger.debug("DATM grid is {}".format(atm_grid))
logger.debug("DATM presaero mode is {}".format(datm_presaero))
logger.debug("DATM topo mode is {}".format(datm_topo))

#----------------------------------------------------
# Initialize namelist defaults and write out namelist file
#----------------------------------------------------
# Initialize namelist defaults
config = {}
config['grid'] = grid
config['atm_grid'] = atm_grid
config['datm_mode'] = datm_mode
config['datm_co2_tseries'] = datm_co2_tseries
config['datm_presaero'] = datm_presaero
config['cime_model'] = get_model()
config['scol_mode'] = 'true' if case.get_value('PTS_MODE') else 'false'
config['create_mesh'] = 'true' if case.get_value("ATM_DOMAIN_MESH") == 'create_mesh' else 'false'

nmlgen.init_defaults(infile, config)

# Determine if will create mesh by reading in a domain file
model_meshfile = case.get_value("ATM_DOMAIN_MESH")
if model_meshfile == 'create_mesh':
atm_domain_path = case.get_value("ATM_DOMAIN_PATH")
atm_domain_file = case.get_value("ATM_DOMAIN_FILE")
nmlgen.set_value("model_createmesh_fromfile",os.path.join(atm_domain_path,atm_domain_file))
nmlgen.set_value("model_meshfile","undefined")
nmlgen.set_value("model_maskfile","undefined")

# Generate datm_in
namelist_file = os.path.join(confdir, "datm_in")
nmlgen.write_output_file(namelist_file, data_list_path, groups=['datm_nml','shr_strdata_nml'])
nmlgen.write_output_file(namelist_file, data_list_path, groups=['datm_nml'])

#----------------------------------------------------
# Create stream xml files - first construct the list of streams
#----------------------------------------------------
# Generate datm.streams.xml
streams = nmlgen.get_streams()

# This disable is required because nmlgen.get_streams
# may return a string or a list. See issue #877 in ESMCI/cime
#pylint: disable=no-member
if datm_presaero != "none":
streams.append("presaero.{}".format(datm_presaero))
if datm_topo != "none":
Expand Down
6 changes: 3 additions & 3 deletions datm/cime_config/config_component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@

<entry id="DATM_MODE">
<type>char</type>
<valid_values>CORE2_NYF,CORE2_IAF,CLM_QIAN,CLM_QIAN_WISO,CLM1PT,CLMCRUNCEP,CLMCRUNCEPv7,CLMGSWP3v1,CLMNLDAS2,CPLHIST,CORE_IAF_JRA,CORE_IAF_JRA_1p4_2018,ERA5</valid_values>
<valid_values>CORE2_NYF,CORE2_IAF,CLM_QIAN,CLM_QIAN_WISO,1PT,CLMCRUNCEP,CLMCRUNCEPv7,CLMGSWP3v1,CLMNLDAS2,CPLHIST,CORE_IAF_JRA,CORE_IAF_JRA_1p4_2018,ERA5</valid_values>
<default_value>CORE2_NYF</default_value>
<group>run_component_datm</group>
<file>env_run.xml</file>
<desc>Mode for data atmosphere component.
CORE2_NYF (CORE2 normal year forcing) are modes used in forcing prognostic ocean/sea-ice components.
CLMCRUNCEPv7, CLMGSWP3v1, CLMNLDAS2 and CLM1PT are modes using observational data for forcing prognostic land components.
CLMCRUNCEPv7, CLMGSWP3v1, CLMNLDAS2 and 1PT are modes using observational data for forcing prognostic land components.
WARNING for CLMNLDAS2: This is a regional forcing dataset over the U.S. (25-53N, 235-293E). Garbage data will be produced for runs extending beyond this regional domain. </desc>
<values match="last">
<value compset="%NYF">CORE2_NYF</value>
Expand All @@ -55,7 +55,7 @@
<value compset="%CRUv7">CLMCRUNCEPv7</value>
<value compset="%GSWP3v1">CLMGSWP3v1</value>
<value compset="%NLDAS2">CLMNLDAS2</value>
<value compset="%1PT">CLM1PT</value>
<value compset="%1PT">1PT</value>
<value compset="%CPLHIST">CPLHIST</value>
<value compset="%ERA5">ERA5</value>
</values>
Expand Down
Loading

0 comments on commit e8148f9

Please sign in to comment.