Skip to content

Commit e43e829

Browse files
authored
Merge pull request #364 from ESCOMP/noresm
Bring in recent changes from NorESM Changes here include: `datm:` - correct modes are now used for specific RYF JRA modes like `JRA-RYF9091`, rather than using the generic `CORE_IAF_JRA ` mode `docn:` - introduce a new mode for docn to read in multiple ocean levels to send to CISM - introduce a new mode for docn to have both SST forcing for CAM and multiple ocean level temperature and salinity to send to CISM. `dlnd:` - refactor lnd_comp_nuopc to allow more than one datamode. The original datamode is now a new file dlnd_datamode_glc_forcing_mod.F90. - add capability in CDEPS to have lnd2rof to have ungridded dimensions that are set flexibly. This is needed in NorESM to permit non-water tracers to be advected by MOSART. - introduce a new data mode, dlnd_datamode_rof_forcing_mod.F90, that permits the ingestion of forcing for a prognostic river model. This capability is in NorESMhub/CDEPS now but not in ESCOMP/CDEPS. - For glc forcings, send missing values instead of 0s over ocean Are changes expected to change answers (bfb, different to roundoff, more substantial): YES, including some more substantial changes: - DATM now uses correct modes for specific RYF JRA modes like `JRA-RYF9091`, rather than using the generic `CORE_IAF_JRA ` mode - DLND now sends missing values instead of 0s over ocean (creates FILLDIFFs in coupler history files in T compsets) Testing performed (e.g. aux_cdeps, CESM prealpha, etc): - CESM prealpha
2 parents 7e51a85 + 7b909eb commit e43e829

39 files changed

+1637
-270
lines changed

.github/workflows/extbuild.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ jobs:
1919
CPPFLAGS: "-I/usr/include -I/usr/local/include "
2020
LDFLAGS: "-L/usr/lib/x86_64-linux-gnu "
2121
# Versions of all dependencies can be updated here - these match tag names in the github repo
22-
ESMF_VERSION: v8.6.1
23-
ParallelIO_VERSION: pio2_6_2
22+
ESMF_VERSION: v8.9.0
23+
ParallelIO_VERSION: pio2_6_6
2424
steps:
2525
- id: checkout-CDEPS
2626
uses: actions/checkout@v4
@@ -39,8 +39,8 @@ jobs:
3939
id: cache-PARALLELIO
4040
uses: actions/cache@v4
4141
with:
42-
path: ${GITHUB_WORKSPACE}/pio
43-
key: ${{ runner.os }}-${{ env.ParallelIO_VERSION }}-parallelio2
42+
path: /home/runner/work/CDEPS/CDEPS/pio
43+
key: ${{ runner.os }}-${{ env.ParallelIO_VERSION }}-parallelio
4444
- name: Build ParallelIO
4545
if: steps.cache-PARALLELIO.outputs.cache-hit != 'true'
4646
uses: NCAR/ParallelIO/.github/actions/parallelio_cmake@9390e30e29d4ebbfbef0fc72162cacd9e8f25e4e
@@ -49,7 +49,7 @@ jobs:
4949
enable_fortran: True
5050
install_prefix: ${GITHUB_WORKSPACE}/pio
5151
- name: Install ESMF
52-
uses: esmf-org/install-esmf-action@v1
52+
uses: esmf-org/install-esmf-action@v1.0.2
5353
env:
5454
ESMF_COMPILER: gfortran
5555
ESMF_BOPT: g

cime_config/stream_cdeps.py

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ def create_stream_xml(
7676
data_list_file,
7777
user_mods_file,
7878
available_neon_data=None,
79-
available_plumber_data=None
79+
available_plumber_data=None,
80+
lnd2rof_nonh2o_number=0,
8081
):
8182
"""
8283
Create the stream xml file and append the required stream input data to the input data list file
@@ -230,6 +231,7 @@ def create_stream_xml(
230231
datavars = child.xml_element.text.strip()
231232
datavars = self._resolve_values(case, datavars)
232233
datavars = self._sub_glc_fields(datavars, case)
234+
datavars = self._sub_rof_fields(datavars, case, lnd2rof_nonh2o_number=lnd2rof_nonh2o_number)
233235
datavars = self._add_xml_delimiter(datavars.split("\n"), "var")
234236
if stream_vars[node_name]:
235237
stream_vars[node_name] = (
@@ -520,11 +522,11 @@ def _sub_glc_fields(self, datavars, case):
520522
521523
Returns a string.
522524
523-
Example: If `_sub_fields` is called with an array containing two
525+
Example: If `_sub_glc_fields` is called with an array containing two
524526
elements, each of which contains two strings, and glc_nec=3:
525527
foo bar
526528
s2x_Ss_tsrf%glc tsrf%glc
527-
then the returned array will be:
529+
then the returned array will be:
528530
foo bar
529531
s2x_Ss_tsrf00 tsrf00
530532
s2x_Ss_tsrf01 tsrf01
@@ -547,6 +549,56 @@ def _sub_glc_fields(self, datavars, case):
547549
new_lines.append(line)
548550
return "\n".join(new_lines)
549551

552+
def _sub_rof_fields(self, datavars, case, lnd2rof_nonh2o_number=0):
553+
"""Substitute indicators with given values in a list of fields.
554+
Replace any instance of the following substring indicators with the
555+
appropriate values:
556+
%lnd2rof_nonh2o_number = two-digit number from 0 through the number
557+
of non-h2o tracers sent from the dlnd to mosart.
558+
559+
The difference between this function and `_sub_paths` is that this
560+
function is intended to be used for variable names (especially from the
561+
`strm_datvar` defaults), whereas `_sub_paths` is intended for use on
562+
input data file paths.
563+
564+
Returns a string.
565+
566+
Example: If `_sub_rof_fields` is called with an array containing only one
567+
element, and lnd2rof_nonh2o_number = 2
568+
foo bar
569+
lndImp_Flrl_rofsur_nonh2o%rof Flrl_rofsur_nonh2o%rof
570+
then the returned array will be:
571+
foo bar
572+
lndImp_Flrl_rofsur_nonh2o Flrl_rofsur_nonh2o
573+
574+
Example: If `_sub_rof_fields` is called with an array containing two
575+
elements, each of which contains two strings, and lnd2rof_nonh2o_number = 2
576+
foo bar
577+
lndImp_Flrl_rofsur_nonh2o%rof Flrl_rofsur_nonh2o%rof
578+
then the returned array will be:
579+
foo bar
580+
lndImp_Flrl_rofsur_nonh2o%01 Flrl_rofsur_nonh2o%01
581+
lndImp_Flrl_rofsur_nonh2o%02 Flrl_rofsur_nonh2o%02
582+
"""
583+
lines = datavars.split("\n")
584+
new_lines = []
585+
for line in lines:
586+
if not line:
587+
continue
588+
if "%rof" in line:
589+
if lnd2rof_nonh2o_number == 0:
590+
lnd2rof_indices = []
591+
else:
592+
lnd2rof_indices = range(1,lnd2rof_nonh2o_number + 1)
593+
for i in lnd2rof_indices:
594+
if len(lnd2rof_indices) == 1:
595+
new_lines.append(line.replace("%rof", "".format(i)))
596+
else:
597+
new_lines.append(line.replace("%rof", "{:02d}".format(i)))
598+
else:
599+
new_lines.append(line)
600+
return "\n".join(new_lines)
601+
550602
@staticmethod
551603
def _days_in_month(month, year=1):
552604
"""Number of days in the given month (specified as an int, 1-12).
@@ -664,8 +716,11 @@ def _sub_paths(
664716
date_string = (year_format + "-{:02d}-{:02d}").format(
665717
adjusted_year, adjusted_month, adjusted_day
666718
)
667-
new_line = line.replace(match.group(0), date_string)
668-
new_lines.append(new_line)
719+
new_file = line.replace(match.group(0), date_string)
720+
if os.path.exists(new_file):
721+
new_lines.append(new_file)
722+
else:
723+
print(f" WARNING:not adding missing file {new_file}")
669724
elif match.group("month"):
670725
for month in range(1, 13):
671726
date_string = (year_format + "-{:02d}").format(year, month)

datm/atm_comp_nuopc.F90

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,10 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
356356
if ( trim(datamode) == 'CORE2_NYF' .or. &
357357
trim(datamode) == 'CORE2_IAF' .or. &
358358
trim(datamode) == 'CORE_IAF_JRA' .or. &
359+
trim(datamode) == 'CORE_RYF6162_JRA' .or. &
360+
trim(datamode) == 'CORE_RYF8485_JRA' .or. &
361+
trim(datamode) == 'CORE_RYF9091_JRA' .or. &
362+
trim(datamode) == 'CORE_RYF0304_JRA' .or. &
359363
trim(datamode) == 'CLMNCEP' .or. &
360364
trim(datamode) == 'CPLHIST' .or. &
361365
trim(datamode) == 'GEFS' .or. &
@@ -372,7 +376,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
372376
call datm_datamode_core2_advertise(exportState, fldsExport, flds_scalar_name, &
373377
flds_co2, flds_wiso, flds_presaero, flds_presndep, rc)
374378
if (ChkErr(rc,__LINE__,u_FILE_u)) return
375-
case ('CORE_IAF_JRA')
379+
case ('CORE_IAF_JRA', 'CORE_RYF6162_JRA', 'CORE_RYF8485_JRA', 'CORE_RYF9091_JRA', 'CORE_RYF0304_JRA')
376380
call datm_datamode_jra_advertise(exportState, fldsExport, flds_scalar_name, &
377381
flds_co2, flds_wiso, flds_presaero, flds_presndep, rc)
378382
if (ChkErr(rc,__LINE__,u_FILE_u)) return
@@ -621,7 +625,7 @@ subroutine datm_comp_run(gcomp, importState, exportState, target_ymd, target_tod
621625
case('CORE2_NYF','CORE2_IAF')
622626
call datm_datamode_core2_init_pointers(exportState, sdat, datamode, factorfn_mesh, factorfn_data, rc)
623627
if (ChkErr(rc,__LINE__,u_FILE_u)) return
624-
case('CORE_IAF_JRA')
628+
case ('CORE_IAF_JRA', 'CORE_RYF6162_JRA', 'CORE_RYF8485_JRA', 'CORE_RYF9091_JRA', 'CORE_RYF0304_JRA')
625629
call datm_datamode_jra_init_pointers(exportState, sdat, rc)
626630
if (ChkErr(rc,__LINE__,u_FILE_u)) return
627631
case('CLMNCEP')
@@ -646,7 +650,7 @@ subroutine datm_comp_run(gcomp, importState, exportState, target_ymd, target_tod
646650
call shr_get_rpointer_name(gcomp, 'atm', target_ymd, target_tod, rpfile, 'read', rc)
647651
if (ChkErr(rc,__LINE__,u_FILE_u)) return
648652
select case (trim(datamode))
649-
case('CORE2_NYF','CORE2_IAF','CORE_IAF_JRA','CLMNCEP','CPLHIST','ERA5','GEFS','SIMPLE')
653+
case('CORE2_NYF','CORE2_IAF','CORE_IAF_JRA','CORE_RYF6162_JRA','CORE_RYF8485_JRA','CORE_RYF9091_JRA','CORE_RYF0304_JRA','CLMNCEP','CPLHIST','ERA5','GEFS','SIMPLE')
650654
call dshr_restart_read(restfilm, rpfile, logunit, my_task, mpicom, sdat, rc)
651655
if (ChkErr(rc,__LINE__,u_FILE_u)) return
652656
case default
@@ -686,7 +690,7 @@ subroutine datm_comp_run(gcomp, importState, exportState, target_ymd, target_tod
686690
call datm_datamode_core2_advance(datamode, target_ymd, target_tod, target_mon, &
687691
sdat%model_calendar, factorfn_mesh, rc)
688692
if (ChkErr(rc,__LINE__,u_FILE_u)) return
689-
case('CORE_IAF_JRA')
693+
case('CORE_IAF_JRA','CORE_RYF6162_JRA','CORE_RYF8485_JRA','CORE_RYF9091_JRA','CORE_RYF0304_JRA')
690694
call datm_datamode_jra_advance(exportstate, target_ymd, target_tod, sdat%model_calendar, rc)
691695
if (ChkErr(rc,__LINE__,u_FILE_u)) return
692696
case('CLMNCEP')
@@ -714,7 +718,7 @@ subroutine datm_comp_run(gcomp, importState, exportState, target_ymd, target_tod
714718
call shr_get_rpointer_name(gcomp, 'atm', target_ymd, target_tod, rpfile, 'write', rc)
715719
if (ChkErr(rc,__LINE__,u_FILE_u)) return
716720
select case (trim(datamode))
717-
case('CORE2_NYF','CORE2_IAF','CORE_IAF_JRA','CLMNCEP','CPLHIST','ERA5','GEFS','SIMPLE')
721+
case('CORE2_NYF','CORE2_IAF','CORE_IAF_JRA','CORE_RYF6162_JRA','CORE_RYF8485_JRA','CORE_RYF9091_JRA','CORE_RYF0304_JRA','CLMNCEP','CPLHIST','ERA5','GEFS','SIMPLE')
718722
call dshr_restart_write(rpfile, case_name, 'datm', inst_suffix, target_ymd, target_tod, logunit, &
719723
my_task, sdat, rc)
720724
if (ChkErr(rc,__LINE__,u_FILE_u)) return

datm/cime_config/config_component.xml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
This file may have atm desc entries.
1111
-->
1212
<description modifier_mode="1">
13-
<desc atm="DATM[%QIA][%WISOQIA][%CRUJRA2024][%CRUv7][%GSWP3v1][%MOSARTTEST][%NLDAS2][%CPLHIST][%1PT][%NYF][%IAF][%JRA][%JRA-1p4-2018][%JRA-1p5-2023][%JRA-RYF8485][%JRA-RYF9091][%JRA-RYF0304][%SIMPLE]"> Data driven ATM </desc>
13+
<desc atm="DATM[%QIA][%WISOQIA][%CRUJRA2024][%CRUv7][%GSWP3v1][%MOSARTTEST][%NLDAS2][%CPLHIST][%1PT][%NYF][%IAF][%JRA][%JRA-1p4-2018][%JRA-1p5-2023][%JRA-RYF6162][%JRA-RYF8485][%JRA-RYF9091][%JRA-RYF0304][%SIMPLE]"> Data driven ATM </desc>
1414
<desc option="QIA"> QIAN data set </desc>
1515
<desc option="WISOQIA">QIAN with water isotopes</desc>
1616
<desc option="CRUJRA2024"> CRUJRA 2024 data set </desc>
@@ -24,6 +24,7 @@
2424
<desc option="JRA">interannual JRA55 forcing</desc>
2525
<desc option="JRA-1p4-2018">interannual JRA55 forcing, v1.4, through 2018</desc>
2626
<desc option="JRA-1p5-2023">interannual JRA55 forcing, v1.5, through 2023</desc>
27+
<desc option="JRA-RYF6162"> JRA55 Repeat Year Forcing v1.3 1961-1962</desc>
2728
<desc option="JRA-RYF8485"> JRA55 Repeat Year Forcing v1.3 1984-1985</desc>
2829
<desc option="JRA-RYF9091"> JRA55 Repeat Year Forcing v1.3 1990-1991</desc>
2930
<desc option="JRA-RYF0304"> JRA55 Repeat Year Forcing v1.3 2003-2004</desc>
@@ -42,7 +43,7 @@
4243

4344
<entry id="DATM_MODE">
4445
<type>char</type>
45-
<valid_values>CORE2_NYF,CORE2_IAF,CLM_QIAN,CLM_QIAN_WISO,1PT,CLMCRUJRA2024,CLMCRUNCEPv7,CLMGSWP3v1,CLMNLDAS2,CPLHIST,CORE_IAF_JRA,CORE_IAF_JRA_1p4_2018,CORE_IAF_JRA_1p5_2023,ERA5,SIMPLE</valid_values>
46+
<valid_values>CORE2_NYF,CORE2_IAF,CLM_QIAN,CLM_QIAN_WISO,1PT,CLMCRUJRA2024,CLMCRUNCEPv7,CLMGSWP3v1,CLMNLDAS2,CPLHIST,CORE_IAF_JRA,CORE_IAF_JRA_1p4_2018,CORE_IAF_JRA_1p5_2023,CORE_RYF6162_JRA,CORE_RYF8485_JRA,CORE_RYF9091_JRA,CORE_RYF0304_JRA,ERA5,SIMPLE</valid_values>
4647
<default_value>CORE2_NYF</default_value>
4748
<group>run_component_datm</group>
4849
<file>env_run.xml</file>
@@ -56,6 +57,10 @@
5657
<value compset="DATM%JRA">CORE_IAF_JRA</value>
5758
<value compset="DATM%JRA-1p4-2018">CORE_IAF_JRA_1p4_2018</value>
5859
<value compset="DATM%JRA-1p5-2023">CORE_IAF_JRA_1p5_2023</value>
60+
<value compset="DATM%JRA-RYF6162">CORE_RYF6162_JRA</value>
61+
<value compset="DATM%JRA-RYF8485">CORE_RYF8485_JRA</value>
62+
<value compset="DATM%JRA-RYF9091">CORE_RYF9091_JRA</value>
63+
<value compset="DATM%JRA-RYF0304">CORE_RYF0304_JRA</value>
5964
<value compset="DATM%QIA">CLM_QIAN</value>
6065
<value compset="DATM%WISOQIA">CLM_QIAN_WISO</value>
6166
<value compset="DATM%CRUJRA2024">CLMCRUJRA2024</value>

datm/cime_config/namelist_definition_datm.xml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@
6161
<value datm_mode="CORE_IAF_JRA_1p5_2023" >
6262
CORE_IAF_JRA_1p5_2023.GCGCS.PREC,CORE_IAF_JRA_1p5_2023.GISS.LWDN,CORE_IAF_JRA_1p5_2023.GISS.SWDN,CORE_IAF_JRA_1p5_2023.NCEP.Q_10,CORE_IAF_JRA_1p5_2023.NCEP.SLP_,CORE_IAF_JRA_1p5_2023.NCEP.T_10,CORE_IAF_JRA_1p5_2023.NCEP.U_10,CORE_IAF_JRA_1p5_2023.NCEP.V_10
6363
</value>
64+
<value datm_mode="CORE_RYF6162_JRA">
65+
CORE_RYF6162_JRA.GISS.LWDN,CORE_RYF6162_JRA.GISS.SWDN,CORE_RYF6162_JRA.GCGCS,CORE_RYF6162_JRA.NCEP
66+
</value>
6467
<value datm_mode="CORE_RYF8485_JRA">
6568
CORE_RYF8485_JRA.GISS.LWDN,CORE_RYF8485_JRA.GISS.SWDN,CORE_RYF8485_JRA.GCGCS,CORE_RYF8485_JRA.NCEP
6669
</value>
@@ -90,7 +93,7 @@
9093
<type>char</type>
9194
<category>datm</category>
9295
<group>datm_nml</group>
93-
<valid_values>CLMNCEP,CORE2_NYF,CORE2_IAF,CORE_IAF_JRA,ERA5,SIMPLE,CPLHIST,1PT</valid_values>
96+
<valid_values>CLMNCEP,CORE2_NYF,CORE2_IAF,CORE_IAF_JRA,CORE_RYF6162_JRA,CORE_RYF8485_JRA,CORE_RYF9091_JRA,CORE_RYF0304_JRA,ERA5,SIMPLE,CPLHIST,1PT</valid_values>
9497
<desc>
9598
general method that operates on the data.
9699
----datamode = "CPLHIST"----
@@ -115,6 +118,14 @@
115118
Clm Dyn doi 10.1007/s00382-008-0441-3.
116119
----datamode = "CORE_IAF_JRA"----
117120
JRA55 intra-annual year forcing
121+
----datamode = "CORE_RYF6162_JRA"----
122+
JRA55 Repeat Year Forcing 1961-1962
123+
----datamode = "CORE_RYF8485_JRA"----
124+
JRA55 Repeat Year Forcing 1984-1985
125+
----datamode = "CORE_RYF9091_JRA"----
126+
JRA55 Repeat Year Forcing 1990-1991
127+
----datamode = "CORE_RYF0304_JRA"----
128+
JRA55 Repeat Year Forcing 2003-2004
118129
----datamode = "CLMNCEP"----
119130
In conjunction with NCEP climatological atmosphere data, provides the
120131
atmosphere forcing favored by the Land Model Working Group when

0 commit comments

Comments
 (0)