Skip to content

Commit 43bd7bf

Browse files
committed
Merge remote-tracking branch 'origin/main' into add_timestamp_rpointer
2 parents 27c2af7 + f4f64c3 commit 43bd7bf

File tree

6 files changed

+132
-47
lines changed

6 files changed

+132
-47
lines changed

.github/workflows/srt.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ubuntu-latest
1919
strategy:
2020
matrix:
21-
python-version: [ 3.10.9 ]
21+
python-version: [ 3.x ]
2222
env:
2323
CC: mpicc
2424
FC: mpifort

cime_config/buildnml

+17-7
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,11 @@ def _create_drv_namelists(case, infile, confdir, nmlgen, files):
5252
config["mask_grid"] = case.get_value("MASK_GRID")
5353
for val in ("HIST", "REST", "STOP"):
5454
config[val.lower()+"_option"] = case.get_value(val+"_OPTION")
55-
55+
5656

5757
config["comp_ocn"] = case.get_value("COMP_OCN")
5858

59+
5960
atm_grid = case.get_value("ATM_GRID")
6061
lnd_grid = case.get_value("LND_GRID")
6162
ice_grid = case.get_value("ICE_GRID")
@@ -75,6 +76,8 @@ def _create_drv_namelists(case, infile, confdir, nmlgen, files):
7576
atm_mesh = case.get_value("ATM_DOMAIN_MESH")
7677
lnd_mesh = case.get_value("LND_DOMAIN_MESH")
7778
rof_mesh = case.get_value("ROF_DOMAIN_MESH")
79+
ocn_mesh = case.get_value("OCN_DOMAIN_MESH")
80+
wav_mesh = case.get_value("WAV_DOMAIN_MESH")
7881
config["samegrid_atm_lnd"] = (
7982
"true" if atm_mesh == case.get_value("LND_DOMAIN_MESH") else "false"
8083
)
@@ -88,6 +91,7 @@ def _create_drv_namelists(case, infile, confdir, nmlgen, files):
8891
"true" if atm_mesh == case.get_value("WAV_DOMAIN_MESH") else "false"
8992
)
9093
config["samegrid_lnd_rof"] = "true" if lnd_mesh == rof_mesh else "false"
94+
config["samegrid_wav_ocn"] = "true" if ocn_mesh == wav_mesh else "false"
9195

9296
# determine if need to set atm_domainfile
9397
scol_lon = float(case.get_value("PTS_LON"))
@@ -110,7 +114,7 @@ def _create_drv_namelists(case, infile, confdir, nmlgen, files):
110114
config["COMP_ROF"] = case.get_value("COMP_ROF")
111115
config["COMP_WAV"] = case.get_value("COMP_WAV")
112116
config["CAMDEV"] = "True" if "CAM70" in case.get_value("COMPSET") else "False"
113-
117+
114118
if (
115119
(
116120
case.get_value("COMP_ROF") == "mosart"
@@ -132,6 +136,12 @@ def _create_drv_namelists(case, infile, confdir, nmlgen, files):
132136

133137
config['wav_ice_coupling'] = 'ww3' in config['COMP_WAV'] and config['COMP_ICE'] == 'cice'
134138

139+
if config["COMP_OCN"] == "blom":
140+
if "ecosys" in case.get_value("BLOM_TRACER_MODULES"):
141+
config["dms_from_ocn"] = "on"
142+
else:
143+
config["dms_from_ocn"] = "off"
144+
135145
# ----------------------------------------------------
136146
# Initialize namelist defaults
137147
# ----------------------------------------------------
@@ -153,7 +163,7 @@ def _create_drv_namelists(case, infile, confdir, nmlgen, files):
153163
add_gusts = literal_to_python_value(nmlgen.get_value("add_gusts"), type_="logical")
154164
if add_gusts:
155165
expect("CAM70" in case.get_value("COMPSET"),"ERROR: add_gusts can only be set if CAM70 in compset {}".format(case.get_value("COMPSET")))
156-
166+
157167
# --------------------------------
158168
# Overwrite: set component coupling frequencies
159169
# --------------------------------
@@ -203,7 +213,7 @@ def _create_drv_namelists(case, infile, confdir, nmlgen, files):
203213
mindt = min(mindt, cpl_dt)
204214

205215
# Here we convert "nsteps" to "nseconds", this simplifies the fortran
206-
216+
207217
for val in ("REST", "HIST", "STOP"):
208218
if case.get_value(val+"_OPTION") == "nsteps":
209219
nsteps = case.get_value(val+"_N")
@@ -214,7 +224,7 @@ def _create_drv_namelists(case, infile, confdir, nmlgen, files):
214224
else:
215225
nmlgen.set_value("stop_n", value=mindt*nsteps)
216226

217-
227+
218228
# sanity check
219229
comp_atm = case.get_value("COMP_ATM")
220230
if comp_atm is not None and comp_atm not in ("datm", "xatm", "satm"):
@@ -635,7 +645,7 @@ def buildnml(case, caseroot, component):
635645
major = line[-2] if "MAJOR" in line else major
636646
minor = line[-2] if "MINOR" in line else minor
637647
logger.debug("ESMF version major {} minor {}".format(major, minor))
638-
expect(int(major) >= 8 and int(minor) >=6, "ESMF version should be 8.6.1 or newer")
648+
expect(int(major) >= 8 and int(minor) >=4, "ESMF version should be 8.4.1 or newer")
639649

640650
confdir = os.path.join(case.get_value("CASEBUILD"), "cplconf")
641651
if not os.path.isdir(confdir):
@@ -677,7 +687,7 @@ def buildnml(case, caseroot, component):
677687
create_namelist_infile(case, user_nl_file, namelist_infile, infile_text)
678688
infile = [namelist_infile]
679689

680-
690+
681691
# create the files nuopc.runconfig, nuopc.runseq, drv_in and drv_flds_in
682692
_create_drv_namelists(case, infile, confdir, nmlgen, files)
683693

cime_config/config_component.xml

+18
Original file line numberDiff line numberDiff line change
@@ -1416,6 +1416,24 @@
14161416
<desc>rof2ocn runoff mapping file</desc>
14171417
</entry>
14181418

1419+
<entry id="OCN2WAV_SMAPNAME">
1420+
<type>char</type>
1421+
<default_value>idmap</default_value>
1422+
<group>run_domain</group>
1423+
<file>env_run.xml</file>
1424+
<desc>ocn2wav state mapping file</desc>
1425+
</entry>
1426+
1427+
<entry id="WAV2OCN_SMAPNAME">
1428+
<type>char</type>
1429+
<values>
1430+
<value>unset</value>
1431+
</values>
1432+
<group>run_domain</group>
1433+
<file>env_run.xml</file>
1434+
<desc>wav2ocn state mapping file</desc>
1435+
</entry>
1436+
14191437
<entry id="EPS_FRAC">
14201438
<type>char</type>
14211439
<default_value>1.0e-02</default_value>

cime_config/namelist_definition_drv.xml

+32-3
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@
889889
<values>
890890
<value>.false.</value>
891891
</values>
892-
</entry>
892+
</entry>
893893

894894
<entry id="info_debug" modify_via_xml="INFO_DBUG">
895895
<type>integer</type>
@@ -2299,6 +2299,34 @@
22992299
</values>
23002300
</entry>
23012301

2302+
<entry id="ocn2wav_smapname" modify_via_xml="OCN2WAV_SMAPNAME">
2303+
<type>char</type>
2304+
<category>mapping</category>
2305+
<input_pathname>abs</input_pathname>
2306+
<group>MED_attributes</group>
2307+
<desc>
2308+
ocn to wav state mapping file for states
2309+
</desc>
2310+
<values>
2311+
<value samegrid_ocn_wav="true">idmap</value>
2312+
<value>$OCN2WAV_SMAPNAME</value>
2313+
</values>
2314+
</entry>
2315+
2316+
<entry id="wav2ocn_smapname" modify_via_xml="WAV2OCN_SMAPNAME">
2317+
<type>char</type>
2318+
<category>mapping</category>
2319+
<input_pathname>abs</input_pathname>
2320+
<group>MED_attributes</group>
2321+
<desc>
2322+
wav to ocn state mapping file for states
2323+
</desc>
2324+
<values>
2325+
<value samegrid_ocn_wav="true">idmap</value>
2326+
<value>$WAV2OCN_SMAPNAME</value>
2327+
</values>
2328+
</entry>
2329+
23022330
<!-- =========================== -->
23032331
<!-- ALLCOMP attributes -->
23042332
<!-- =========================== -->
@@ -2422,7 +2450,7 @@
24222450
</values>
24232451
</entry>
24242452

2425-
<entry id="flds_dms" modify_via_xml="DMS_EMIS_OCN">
2453+
<entry id="flds_dms">
24262454
<type>logical</type>
24272455
<category>flds</category>
24282456
<group>ALLCOMP_attributes</group>
@@ -2431,10 +2459,11 @@
24312459
</desc>
24322460
<values>
24332461
<value>.false.</value>
2462+
<value dms_from_ocn="on">.true.</value>
24342463
</values>
24352464
</entry>
24362465

2437-
<entry id="flds_brf" modify_via_xml="BRF_EMIS_OCN">
2466+
<entry id="flds_brf">
24382467
<type>logical</type>
24392468
<category>flds</category>
24402469
<group>ALLCOMP_attributes</group>

mediator/esmFldsExchange_cesm_mod.F90

+47-26
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ module esmFldsExchange_cesm_mod
7575
character(len=CX) :: rof2lnd_map = 'unset'
7676
character(len=CX) :: lnd2rof_map = 'unset'
7777

78+
! optional mapping files
79+
character(len=CX) :: wav2ocn_map ='unset'
80+
character(len=CX) :: ocn2wav_map = 'unset'
81+
7882
! no mapping files (value is 'idmap' or 'unset')
7983
character(len=CX) :: atm2ice_map = 'unset'
8084
character(len=CX) :: atm2ocn_map = 'unset'
@@ -84,9 +88,7 @@ module esmFldsExchange_cesm_mod
8488
character(len=CX) :: ice2wav_map = 'unset'
8589
character(len=CX) :: lnd2atm_map = 'unset'
8690
character(len=CX) :: ocn2atm_map = 'unset'
87-
character(len=CX) :: ocn2wav_map = 'unset'
8891
character(len=CX) :: rof2ocn_map = 'unset'
89-
character(len=CX) :: wav2ocn_map = 'unset'
9092

9193
logical :: mapuv_with_cart3d ! Map U/V vector wind fields from ATM to OCN/ICE by rotating in Cartesian 3D space and then back
9294
logical :: flds_i2o_per_cat ! Ice thickness category fields passed to OCN
@@ -95,6 +97,7 @@ module esmFldsExchange_cesm_mod
9597
logical :: flds_co2c ! Pass CO2 from ATM to surface (OCN/LND) and back from them to ATM
9698
logical :: flds_wiso ! Pass water isotop fields
9799
logical :: flds_r2l_stream_channel_depths ! Pass channel depths from ROF to LND
100+
logical :: add_gusts ! Whether to include fields related to the gustiness parameterization
98101

99102
character(*), parameter :: u_FILE_u = &
100103
__FILE__
@@ -202,6 +205,14 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
202205
if (chkerr(rc,__LINE__,u_FILE_u)) return
203206
if (maintask) write(logunit, '(a)') trim(subname)//'rof2ocn_ice_rmapname = '// trim(rof2ocn_ice_rmap)
204207

208+
call NUOPC_CompAttributeGet(gcomp, name='wav2ocn_smapname', value=wav2ocn_map, rc=rc)
209+
if (chkerr(rc,__LINE__,u_FILE_u)) return
210+
if (maintask) write(logunit, '(a)') trim(subname)//'wav2ocn_smapname = '// trim(wav2ocn_map)
211+
call NUOPC_CompAttributeGet(gcomp, name='ocn2wav_smapname', value=ocn2wav_map, rc=rc)
212+
if (chkerr(rc,__LINE__,u_FILE_u)) return
213+
if (maintask) write(logunit, '(a)') trim(subname)//'ocn2wav_smapname = '// trim(ocn2wav_map)
214+
215+
205216
! uv cart3d mapping
206217
call NUOPC_CompAttributeGet(gcomp, name='mapuv_with_cart3d', value=cvalue, rc=rc)
207218
if (chkerr(rc,__LINE__,u_FILE_u)) return
@@ -232,6 +243,11 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
232243
if (ChkErr(rc,__LINE__,u_FILE_u)) return
233244
read(cvalue,*) flds_r2l_stream_channel_depths
234245

246+
! are fields related to the gustiness parameterization enabled?
247+
call NUOPC_CompAttributeGet(gcomp, name='add_gusts', value=cvalue, rc=rc)
248+
if (ChkErr(rc,__LINE__,u_FILE_u)) return
249+
read(cvalue,*) add_gusts
250+
235251
! write diagnostic output
236252
if (maintask) then
237253
write(logunit,'(a)' ) ' flds_co2a: prognostic and diagnostic CO2 at lowest atm level is sent to lnd and ocn'
@@ -246,6 +262,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
246262
write(logunit,'(a,l7)') trim(subname)//' flds_wiso = ',flds_wiso
247263
write(logunit,'(a,l7)') trim(subname)//' flds_i2o_per_cat = ',flds_i2o_per_cat
248264
write(logunit,'(a,l7)') trim(subname)//' flds_r2l_stream_channel_depths = ',flds_r2l_stream_channel_depths
265+
write(logunit,'(a,l7)') trim(subname)//' add_gusts = ', add_gusts
249266
write(logunit,'(a,l7)') trim(subname)//' mapuv_with_cart3d = ',mapuv_with_cart3d
250267
end if
251268

@@ -1414,35 +1431,39 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
14141431
! ---------------------------------------------------------------------
14151432
! to atm: unmerged ugust_out from ocn
14161433
! ---------------------------------------------------------------------
1417-
if (phase == 'advertise') then
1418-
call addfld_aoflux('So_ugustOut')
1419-
call addfld_to(compatm, 'So_ugustOut')
1420-
else
1421-
if ( fldchk(is_local%wrap%FBexp(compatm), 'So_ugustOut', rc=rc)) then
1422-
if (fldchk(is_local%wrap%FBMed_aoflux_o, 'So_ugustOut', rc=rc)) then
1423-
if (trim(is_local%wrap%aoflux_grid) == 'ogrid') then
1424-
call addmap_aoflux('So_ugustOut', compatm, mapconsf, 'ofrac', ocn2atm_map)
1434+
if (add_gusts) then
1435+
if (phase == 'advertise') then
1436+
call addfld_aoflux('So_ugustOut')
1437+
call addfld_to(compatm, 'So_ugustOut')
1438+
else
1439+
if ( fldchk(is_local%wrap%FBexp(compatm), 'So_ugustOut', rc=rc)) then
1440+
if (fldchk(is_local%wrap%FBMed_aoflux_o, 'So_ugustOut', rc=rc)) then
1441+
if (trim(is_local%wrap%aoflux_grid) == 'ogrid') then
1442+
call addmap_aoflux('So_ugustOut', compatm, mapconsf, 'ofrac', ocn2atm_map)
1443+
end if
1444+
call addmrg_to(compatm , 'So_ugustOut', &
1445+
mrg_from=compmed, mrg_fld='So_ugustOut', mrg_type='merge', mrg_fracname='ofrac')
14251446
end if
1426-
call addmrg_to(compatm , 'So_ugustOut', &
1427-
mrg_from=compmed, mrg_fld='So_ugustOut', mrg_type='merge', mrg_fracname='ofrac')
14281447
end if
14291448
end if
14301449
end if
14311450

14321451
! ---------------------------------------------------------------------
14331452
! to atm: 10 m winds including/excluding gust component
14341453
! ---------------------------------------------------------------------
1435-
if (phase == 'advertise') then
1436-
call addfld_aoflux('So_u10withGust')
1437-
call addfld_to(compatm, 'So_u10withGust')
1438-
else
1439-
if ( fldchk(is_local%wrap%FBexp(compatm), 'So_u10withGust', rc=rc)) then
1440-
if (fldchk(is_local%wrap%FBMed_aoflux_o, 'So_u10withGust', rc=rc)) then
1441-
if (trim(is_local%wrap%aoflux_grid) == 'ogrid') then
1442-
call addmap_aoflux('So_u10withGust', compatm, mapconsf, 'ofrac', ocn2atm_map)
1454+
if (add_gusts) then
1455+
if (phase == 'advertise') then
1456+
call addfld_aoflux('So_u10withGust')
1457+
call addfld_to(compatm, 'So_u10withGust')
1458+
else
1459+
if ( fldchk(is_local%wrap%FBexp(compatm), 'So_u10withGust', rc=rc)) then
1460+
if (fldchk(is_local%wrap%FBMed_aoflux_o, 'So_u10withGust', rc=rc)) then
1461+
if (trim(is_local%wrap%aoflux_grid) == 'ogrid') then
1462+
call addmap_aoflux('So_u10withGust', compatm, mapconsf, 'ofrac', ocn2atm_map)
1463+
end if
1464+
call addmrg_to(compatm , 'So_u10withGust', &
1465+
mrg_from=compmed, mrg_fld='So_u10withGust', mrg_type='merge', mrg_fracname='ofrac')
14431466
end if
1444-
call addmrg_to(compatm , 'So_u10withGust', &
1445-
mrg_from=compmed, mrg_fld='So_u10withGust', mrg_type='merge', mrg_fracname='ofrac')
14461467
end if
14471468
end if
14481469
end if
@@ -1700,7 +1721,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
17001721
else
17011722
if ( fldchk(is_local%wrap%FBImp(compocn,compocn), 'Faoo_fdms_ocn', rc=rc) .and. &
17021723
fldchk(is_local%wrap%FBexp(compatm) , 'Faoo_fdms_ocn', rc=rc)) then
1703-
call addmap_from(compocn, 'Faoo_fdms_ocn', compocn, mapconsd, 'one', ocn2atm_map)
1724+
call addmap_from(compocn, 'Faoo_fdms_ocn', compatm, mapconsd, 'one', ocn2atm_map)
17041725
! custom merge in med_phases_prep_atm
17051726
end if
17061727
end if
@@ -1714,7 +1735,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
17141735
else
17151736
if ( fldchk(is_local%wrap%FBImp(compocn,compocn), 'Faoo_fbrf_ocn', rc=rc) .and. &
17161737
fldchk(is_local%wrap%FBexp(compatm) , 'Faoo_fbrf_ocn', rc=rc)) then
1717-
call addmap_from(compocn, 'Faoo_fbrf_ocn', compocn, mapconsd, 'one', ocn2atm_map)
1738+
call addmap_from(compocn, 'Faoo_fbrf_ocn', compatm, mapconsd, 'one', ocn2atm_map)
17181739
! custom merge in med_phases_prep_atm
17191740
end if
17201741
end if
@@ -1728,7 +1749,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
17281749
else
17291750
if ( fldchk(is_local%wrap%FBImp(compocn,compocn), 'Faoo_fn2o_ocn', rc=rc) .and. &
17301751
fldchk(is_local%wrap%FBexp(compatm) , 'Faoo_fn2o_ocn', rc=rc)) then
1731-
call addmap_from(compocn, 'Faoo_fn2o_ocn', compocn, mapconsd, 'one', ocn2atm_map)
1752+
call addmap_from(compocn, 'Faoo_fn2o_ocn', compatm, mapconsd, 'one', ocn2atm_map)
17321753
! custom merge in med_phases_prep_atm
17331754
end if
17341755
end if
@@ -1742,7 +1763,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
17421763
else
17431764
if ( fldchk(is_local%wrap%FBImp(compocn,compocn), 'Faoo_fnh3_ocn', rc=rc) .and. &
17441765
fldchk(is_local%wrap%FBexp(compatm) , 'Faoo_fnh3_ocn', rc=rc)) then
1745-
call addmap_from(compocn, 'Faoo_fnh3_ocn', compocn, mapconsd, 'one', ocn2atm_map)
1766+
call addmap_from(compocn, 'Faoo_fnh3_ocn', compatm, mapconsd, 'one', ocn2atm_map)
17461767
! custom merge in med_phases_prep_atm
17471768
end if
17481769
end if

0 commit comments

Comments
 (0)