Skip to content

Commit ea41b37

Browse files
authored
Merge branch 'main' into ssp-fix
2 parents 5475066 + 483a45a commit ea41b37

28 files changed

+1988
-218
lines changed

CMakeLists.txt

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -71,23 +71,6 @@ add_subdirectory(streams)
7171
add_subdirectory(dshr)
7272

7373
if(NOT DISABLE_FoX)
74-
if(IS_DIRECTORY "${FOX_ROOT}")
75-
message(STATUS "FoX library is already checked out!")
76-
message(STATUS "FoX source dir: ${FOX_ROOT}")
77-
else()
78-
FetchContent_Declare(fox
79-
GIT_REPOSITORY https://github.com/ESMCI/fox.git
80-
GIT_TAG 4.1.2.1
81-
SOURCE_DIR ${FOX_ROOT}
82-
BINARY_DIR ${FOX_ROOT}/..
83-
)
84-
FetchContent_GetProperties(fox)
85-
if(NOT fox_POPULATED)
86-
FetchContent_Populate(fox)
87-
message(STATUS "FoX source dir: ${fox_SOURCE_DIR}")
88-
message(STATUS "FoX binary dir: ${fox_BINARY_DIR}")
89-
endif()
90-
endif()
9174
add_subdirectory(fox)
9275

9376
target_include_directories(streams PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/fox/include>

cime_config/buildlib

Lines changed: 42 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,10 @@ def buildlib(bldroot, libroot, case):
7373
strthread = "nothreads"
7474
mpilib = case.get_value("MPILIB")
7575
compiler = case.get_value("COMPILER")
76-
sharedpath = os.path.join(compiler, mpilib, strdebug, strthread, "nuopc")
77-
76+
sharedpath = os.path.join(compiler, mpilib, strdebug, strthread)
77+
sharedroot = case.get_value("SHAREDLIBROOT")
78+
cdepsblddir = os.path.join(sharedroot, sharedpath, "CDEPS")
79+
7880
logger.info("Running cmake for CDEPS")
7981
srcpath = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
8082
cmake_flags = get_standard_cmake_args(case, os.path.join(sharedpath, "cdeps"))
@@ -147,31 +149,47 @@ def buildlib(bldroot, libroot, case):
147149
else:
148150
bld_time = src_time - 1
149151

150-
# if any file in src is newer than CmakeFiles in the build directory, rerun cmake
152+
# Make sure that no other process is currently trying to build this library, done with a simple lockfile
153+
if os.path.exists(cdepsblddir):
154+
logger.info("{} already exists, checking for lockfile".format(cdepsblddir))
155+
while os.path.exists(os.path.join(cdepsblddir,"lockfile")):
156+
logger.info("Waiting for lockfile in {}".format(cdepsblddir))
157+
time.sleep(10)
158+
else:
159+
logger.info("{} does not exist, creating lockfile".format(cdepsblddir))
160+
os.makedirs(cdepsblddir)
161+
with open(os.path.join(cdepsblddir,"lockfile"),"w") as fd:
162+
fd.write(str(os.getpid()))
163+
164+
try:
165+
# if any file in src is newer than CmakeFiles in the build directory, rerun cmake
166+
if src_time > bld_time:
167+
logger.info("cmake_flags {}".format(cmake_flags))
168+
s, o, e = run_cmd(
169+
"cmake {} ".format(cmake_flags), from_dir=bldroot, verbose=True
170+
)
171+
expect(not s, "ERROR from cmake output={}, error={}".format(o, e))
172+
else:
173+
# The dwav_lib is the last file built in cdeps, wait for it to be built
174+
dwav_lib = os.path.join(bldroot, "dwav", "libdwav.a")
175+
time_to_wait = 600
176+
time_counter = 0
177+
while not os.path.exists(dwav_lib):
178+
time.sleep(1)
179+
time_counter += 1
180+
if time_counter > time_to_wait:
181+
break
182+
expect(time_counter <= time_to_wait, " Timeout waiting for {}".format(dwav_lib))
151183

152-
if src_time > bld_time:
153-
logger.info("cmake_flags {}".format(cmake_flags))
154184
s, o, e = run_cmd(
155-
"cmake {} ".format(cmake_flags), from_dir=bldroot, verbose=True
185+
"make install VERBOSE=1 DESTDIR={}".format(libroot),
186+
from_dir=bldroot,
187+
verbose=True,
156188
)
157-
expect(not s, "ERROR from cmake output={}, error={}".format(o, e))
158-
else:
159-
# The dwav_lib is the last file built in cdeps, wait for it to be built
160-
dwav_lib = os.path.join(bldroot, "dwav", "libdwav.a")
161-
time_to_wait = 300
162-
time_counter = 0
163-
while not os.path.exists(dwav_lib):
164-
time.sleep(1)
165-
time_counter += 1
166-
if time_counter > time_to_wait:
167-
break
168-
expect(time_counter <= time_to_wait, " Timeout waiting for {}".format(dwav_lib))
169-
170-
s, o, e = run_cmd(
171-
"make install VERBOSE=1 DESTDIR={}".format(libroot),
172-
from_dir=bldroot,
173-
verbose=True,
174-
)
189+
finally:
190+
if os.path.exists(os.path.join(cdepsblddir,"lockfile")):
191+
os.remove(os.path.join(cdepsblddir,"lockfile"))
192+
175193
expect(not s, "ERROR from make output={}, error={}".format(o, e))
176194
logger.info("make output={}\nerror={}".format(o, e))
177195
if compiler == "gnu" and case.get_value("DEBUG"):

cime_config/stream_cdeps.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ def create_stream_xml(
7676
data_list_file,
7777
user_mods_file,
7878
available_neon_data=None,
79+
available_plumber_data=None
7980
):
8081
"""
8182
Create the stream xml file and append the required stream input data to the input data list file
@@ -187,7 +188,17 @@ def create_stream_xml(
187188
{"name": "NEON.NEON_PRECIP.$NEONSITE"},
188189
err_msg="No stream_entry {} found".format(stream_name),
189190
)
191+
elif stream_name.startswith("PLUMBER2"):
192+
self.stream_nodes = super(StreamCDEPS, self).get_child(
193+
"stream_entry",
194+
{"name": "PLUMBER2.$PLUMBER2SITE"},
195+
err_msg="No stream_entry {} found".format(stream_name),
196+
)
190197
elif stream_name.startswith("CLM_USRDAT."):
198+
if 'PLUMBER2' in stream_name:
199+
# if PLUMBER2 is in the stream name
200+
# we want to use PLUMBER2.PLUMBER2SITE instead of CLM_USRDAT.PLUMBER2
201+
continue
191202
self.stream_nodes = super(StreamCDEPS, self).get_child(
192203
"stream_entry",
193204
{"name": "CLM_USRDAT.$CLM_USRDAT_NAME"},
@@ -244,6 +255,13 @@ def create_stream_xml(
244255
os.path.join(rundir, "inputdata", "atm", neon)
245256
+ "\n"
246257
)
258+
elif available_plumber_data and stream_name.startswith("PLUMBER2"):
259+
rundir = case.get_value("RUNDIR")
260+
for plumber in available_plumber_data:
261+
stream_datafiles += (
262+
os.path.join(rundir, "inputdata", "atm", plumber)
263+
+ "\n"
264+
)
247265
else:
248266
stream_datafiles = child.xml_element.text
249267
stream_datafiles = self._resolve_values(

cime_config/stream_definition_v2.0.xsd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@
9393
<xs:simpleContent>
9494
<xs:extension base="xs:string">
9595
<xs:attribute name="model_grid" type="xs:string" />
96-
<xs:attribute name="compset" type="xs:string" />
96+
<xs:attribute name="compset" type="xs:string" />
97+
<xs:attribute name="CLM_USRDAT_NAME" type="xs:string" />
9798
</xs:extension>
9899
</xs:simpleContent>
99100
</xs:complexType>

datm/cime_config/buildnml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,16 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path
141141
available_neon_data = None
142142
if 'CLM_USRDAT' in model_grid:
143143
config['model_grid'] = 'CLM_USRDAT'
144-
neonsite = case.get_value("NEONSITE")
145-
if neonsite:
146-
config['neon'] = "True"
147-
# download and use the listing.csv file to determine data availablity
148-
available_neon_data = _get_neon_data_availability(case, neonsite)
144+
if 'NEON' in clm_usrdat_name:
145+
neonsite = case.get_value("NEONSITE")
146+
if neonsite:
147+
config['neon'] = "True"
148+
# download and use the listing.csv file to determine data availablity
149+
available_neon_data = _get_neon_data_availability(case, neonsite)
150+
if 'PLUMBER2' in clm_usrdat_name:
151+
plumber2site = case.get_value('PLUMBER2SITE')
152+
if plumber2site:
153+
config['plumber'] = "True"
149154
else:
150155
config['model_grid'] = model_grid
151156

@@ -194,6 +199,8 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path
194199
streamlist.append(clm_usrdat_name+"_PRECIP."+neonsite)
195200
if clm_usrdat_name == 'NEON':
196201
streamlist.append(clm_usrdat_name+".NEON_PRECIP."+neonsite)
202+
if clm_usrdat_name == 'PLUMBER2':
203+
streamlist.append(clm_usrdat_name+"."+plumber2site)
197204

198205
bias_correct = nmlgen.get_value("bias_correct")
199206
if bias_correct is not None:

datm/cime_config/config_component.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,15 @@
296296
<desc>starting year to loop data over</desc>
297297
</entry>
298298

299+
<entry id="DATM_YR_START_FILENAME">
300+
<type>integer</type>
301+
<valid_values></valid_values>
302+
<default_value>9999</default_value>
303+
<group>run_component_datm</group>
304+
<file>env_run.xml</file>
305+
<desc>Start year listed in PLUMBER2 filenames for certain datm_modes. Currently only used in PLUMBER2; leave as the default value (9999) for other cases.</desc>
306+
</entry>
307+
299308
<entry id="DATM_YR_END">
300309
<type>integer</type>
301310
<valid_values></valid_values>

datm/cime_config/namelist_definition_datm.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
<value datm_mode="1PT" model_grid="CLM_USRDAT" neon="True">
4141
NEON.$NEONSITE
4242
</value>
43+
<value datm_mode="1PT" model_grid="CLM_USRDAT" neon="True">
44+
PLUMBER2.$PLUMBER2SITE
45+
</value>
4346
<value datm_mode="1PT" model_grid="CLM_USRDAT">
4447
CLM_USRDAT.$CLM_USRDAT_NAME
4548
</value>

datm/cime_config/stream_definition_datm.xml

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
CORE_RYF9091_JRA = JRA55 repeat year forcing, v1.3, 1990-1991 (for forcing POP and CICE)
4242
CORE_RYF0304_JRA = JRA55 repeat year forcing, v1.3, 2003-2004 (for forcing POP and CICE)
4343
ERA5 = ERA5 intra-annual year forcing
44+
NEON = Run with forcing from NEON tower data
45+
PLUMBER2 = Run with forcing from PLUMBER2 tower data
4446
SIMPLE = Namelist-configurable, constant datm forcing for simple experiments
4547
CPLHIST = Streams for lnd or ocn/ice forcing used for spinup
4648
@@ -341,6 +343,50 @@
341343
<stream_readmode>single</stream_readmode>
342344
</stream_entry>
343345

346+
347+
<!-- =================================== -->
348+
<!-- datm_mode PLUMBER2.$PLUMBER2SITE -->
349+
<!-- =================================== -->
350+
351+
<stream_entry name="PLUMBER2.$PLUMBER2SITE">
352+
<stream_meshfile>
353+
<meshfile>none</meshfile>
354+
</stream_meshfile>
355+
<stream_datafiles>
356+
<file first_year="$DATM_YR_START" last_year="$DATM_YR_END">$DIN_LOC_ROOT/atm/datm7/CLM1PT_data/PLUMBER2/${PLUMBER2SITE}/CLM1PT_data/CTSM_DATM_${PLUMBER2SITE}_${DATM_YR_START_FILENAME}-${DATM_YR_END}.nc</file>
357+
</stream_datafiles>
358+
<stream_datavars>
359+
<var>ZBOT Sa_z</var>
360+
<var>TBOT Sa_tbot</var>
361+
<var>QBOT Sa_shum</var>
362+
<var>WIND Sa_wind</var>
363+
<var>PRECTmms Faxa_precn</var>
364+
<var>FSDS Faxa_swdn</var>
365+
<var>PSRF Sa_pbot</var>
366+
<var>FLDS Faxa_lwdn</var>
367+
</stream_datavars>
368+
<stream_lev_dimname>null</stream_lev_dimname>
369+
<stream_mapalgo>
370+
<mapalgo>none</mapalgo>
371+
</stream_mapalgo>
372+
<stream_vectors>null</stream_vectors>
373+
<stream_year_align>$DATM_YR_ALIGN</stream_year_align>
374+
<stream_year_first>$DATM_YR_START</stream_year_first>
375+
<stream_year_last>$DATM_YR_END</stream_year_last>
376+
<stream_offset>0</stream_offset>
377+
<stream_tintalgo>
378+
<tintalgo>linear</tintalgo>
379+
</stream_tintalgo>
380+
<stream_taxmode>
381+
<taxmode >cycle</taxmode>
382+
<taxmode compset="HIST">limit</taxmode>
383+
</stream_taxmode>
384+
<stream_dtlimit>
385+
<dtlimit>1.5</dtlimit>
386+
</stream_dtlimit>
387+
<stream_readmode>single</stream_readmode>
388+
</stream_entry>
389+
344390
<!-- =================================== -->
345391
<!-- datm_mode CLMGSWP3v1 -->
346392
<!-- =================================== -->
@@ -3768,7 +3814,7 @@
37683814
<meshfile>none</meshfile>
37693815
</stream_meshfile>
37703816
<stream_datafiles>
3771-
<file>$DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP3-7.0__simyr_2014-2501_CMIP6_c190506.nc</file>
3817+
<file>$DIN_LOC_ROOT/atm/datm7/CO2/fco2_datm_globalSSP3-7.0_simyr_1750-2501_CMIP6_c201101.nc</file>
37723818
</stream_datafiles>
37733819
<stream_datavars>
37743820
<var>CO2 Sa_co2diag</var>
@@ -4191,7 +4237,7 @@
41914237
<meshfile>$DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc</meshfile>
41924238
</stream_meshfile>
41934239
<stream_datafiles>
4194-
<file>$DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerodep_clm_SSP370_b.e21.BWSSP370cmip6.f09_g17.CMIP6-SSP3-7.0-WACCM.001_2014-2101_monthly_0.9x1.25_c190402.nc</file>
4240+
<file>$DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerodep_clm_SSP370_b.e21.BWSSP370cmip6.f09_g17.CMIP6-SSP3-7.0-WACCM.001_1849-2101_monthly_0.9x1.25_c201103.nc</file>
41954241
</stream_datafiles>
41964242
<stream_datavars>
41974243
<var>BCDEPWET Faxa_bcphiwet</var>
@@ -4226,6 +4272,7 @@
42264272
</stream_taxmode>
42274273
<stream_dtlimit>
42284274
<dtlimit>1.5</dtlimit>
4275+
<dtlimit CLM_USRDAT_NAME="PLUMBER2">30</dtlimit>
42294276
</stream_dtlimit>
42304277
<stream_readmode>single</stream_readmode>
42314278
</stream_entry>
@@ -4765,6 +4812,7 @@
47654812
</stream_taxmode>
47664813
<stream_dtlimit>
47674814
<dtlimit>1.5</dtlimit>
4815+
<dtlimit CLM_USRDAT_NAME="PLUMBER2">30</dtlimit>
47684816
</stream_dtlimit>
47694817
<stream_readmode>single</stream_readmode>
47704818
</stream_entry>

dglc/cime_config/config_component.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
</desc>
4444
</entry>
4545

46-
<entry id="DGLC_USE_GREENLAND">
46+
<entry id="GLC_USE_GREENLAND">
4747
<type>logical</type>
4848
<default_value>FALSE</default_value>
4949
<group>run_component_dglc</group>
@@ -58,7 +58,7 @@
5858
</desc>
5959
</entry>
6060

61-
<entry id="DGLC_USE_ANTARCTICA">
61+
<entry id="GLC_USE_ANTARCTICA">
6262
<type>logical</type>
6363
<default_value>FALSE</default_value>
6464
<group>run_component_dglc</group>

dglc/cime_config/testdefs/testlist_dglc.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0"?>
22
<testlist version="2.0">
33

4-
<test compset="2000_SATM_SLND_SICE_SGLC_SROF_DGLC%NOEVOLVE_SWAV" grid="f10_f10_ais8gris4_mg37" name="SMS_Ln5">
4+
<test compset="2000_SATM_SLND_SICE_SGLC_SROF_DGLC%NOEVOLVE_SWAV" grid="f10_f10_ais8gris4_mg37" name="SMS_Ly3">
55
<machines>
66
<machine name="derecho" compiler="intel" category="aux_cdeps"/>
77
<machine name="betzy" compiler="intel" category="aux_cdeps_noresm"/>
@@ -10,7 +10,7 @@
1010
<option name="wallclock"> 00:10:00 </option>
1111
</options>
1212
</test>
13-
<test compset="2000_SATM_SLND_SICE_SGLC_SROF_DGLC%NOEVOLVE_SWAV" grid="f10_f10_ais8_mg37" name="SMS_Ln5">
13+
<test compset="2000_SATM_SLND_SICE_SGLC_SROF_DGLC%NOEVOLVE_SWAV" grid="f10_f10_ais8_mg37" name="SMS_Ly3">
1414
<machines>
1515
<machine name="derecho" compiler="intel" category="aux_cdeps"/>
1616
<machine name="betzy" compiler="intel" category="aux_cdeps_noresm"/>
@@ -19,7 +19,7 @@
1919
<option name="wallclock"> 00:10:00 </option>
2020
</options>
2121
</test>
22-
<test compset="2000_SATM_SLND_SICE_SGLC_SROF_DGLC%NOEVOLVE_SWAV" grid="f19_g17_gris4" name="SMS_Ln5">
22+
<test compset="2000_SATM_SLND_SICE_SGLC_SROF_DGLC%NOEVOLVE_SWAV" grid="f19_g17_gris4" name="SMS_Ly3">
2323
<machines>
2424
<machine name="derecho" compiler="intel" category="aux_cdeps"/>
2525
<machine name="betzy" compiler="intel" category="aux_cdeps_noresm"/>

0 commit comments

Comments
 (0)