Skip to content

Commit

Permalink
Merge pull request #504 from mvertens/feature/update_dms_exchange
Browse files Browse the repository at this point in the history
update dms exchange
  • Loading branch information
jedwards4b authored Sep 30, 2024
2 parents a664d62 + 7c75a56 commit f4f64c3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/srt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.10.9 ]
python-version: [ 3.x ]
env:
CC: mpicc
FC: mpifort
Expand Down
21 changes: 14 additions & 7 deletions cime_config/buildnml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@ def _create_drv_namelists(case, infile, confdir, nmlgen, files):
config["mask_grid"] = case.get_value("MASK_GRID")
for val in ("HIST", "REST", "STOP"):
config[val.lower()+"_option"] = case.get_value(val+"_OPTION")


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


atm_grid = case.get_value("ATM_GRID")
lnd_grid = case.get_value("LND_GRID")
ice_grid = case.get_value("ICE_GRID")
Expand Down Expand Up @@ -113,7 +114,7 @@ def _create_drv_namelists(case, infile, confdir, nmlgen, files):
config["COMP_ROF"] = case.get_value("COMP_ROF")
config["COMP_WAV"] = case.get_value("COMP_WAV")
config["CAMDEV"] = "True" if "CAM70" in case.get_value("COMPSET") else "False"

if (
(
case.get_value("COMP_ROF") == "mosart"
Expand All @@ -135,6 +136,12 @@ def _create_drv_namelists(case, infile, confdir, nmlgen, files):

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

if config["COMP_OCN"] == "blom":
if "ecosys" in case.get_value("BLOM_TRACER_MODULES"):
config["dms_from_ocn"] = "on"
else:
config["dms_from_ocn"] = "off"

# ----------------------------------------------------
# Initialize namelist defaults
# ----------------------------------------------------
Expand All @@ -156,7 +163,7 @@ def _create_drv_namelists(case, infile, confdir, nmlgen, files):
add_gusts = literal_to_python_value(nmlgen.get_value("add_gusts"), type_="logical")
if add_gusts:
expect("CAM70" in case.get_value("COMPSET"),"ERROR: add_gusts can only be set if CAM70 in compset {}".format(case.get_value("COMPSET")))

# --------------------------------
# Overwrite: set component coupling frequencies
# --------------------------------
Expand Down Expand Up @@ -206,7 +213,7 @@ def _create_drv_namelists(case, infile, confdir, nmlgen, files):
mindt = min(mindt, cpl_dt)

# Here we convert "nsteps" to "nseconds", this simplifies the fortran

for val in ("REST", "HIST", "STOP"):
if case.get_value(val+"_OPTION") == "nsteps":
nsteps = case.get_value(val+"_N")
Expand All @@ -217,7 +224,7 @@ def _create_drv_namelists(case, infile, confdir, nmlgen, files):
else:
nmlgen.set_value("stop_n", value=mindt*nsteps)


# sanity check
comp_atm = case.get_value("COMP_ATM")
if comp_atm is not None and comp_atm not in ("datm", "xatm", "satm"):
Expand Down Expand Up @@ -640,7 +647,7 @@ def buildnml(case, caseroot, component):
major = line[-2] if "MAJOR" in line else major
minor = line[-2] if "MINOR" in line else minor
logger.debug("ESMF version major {} minor {}".format(major, minor))
expect(int(major) >= 8 and int(minor) >=6, "ESMF version should be 8.6.1 or newer")
expect(int(major) >= 8 and int(minor) >=4, "ESMF version should be 8.4.1 or newer")

confdir = os.path.join(case.get_value("CASEBUILD"), "cplconf")
if not os.path.isdir(confdir):
Expand Down Expand Up @@ -682,7 +689,7 @@ def buildnml(case, caseroot, component):
create_namelist_infile(case, user_nl_file, namelist_infile, infile_text)
infile = [namelist_infile]


# create the files nuopc.runconfig, nuopc.runseq, drv_in and drv_flds_in
_create_drv_namelists(case, infile, confdir, nmlgen, files)

Expand Down
7 changes: 4 additions & 3 deletions cime_config/namelist_definition_drv.xml
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@
<values>
<value>.false.</value>
</values>
</entry>
</entry>

<entry id="info_debug" modify_via_xml="INFO_DBUG">
<type>integer</type>
Expand Down Expand Up @@ -2450,7 +2450,7 @@
</values>
</entry>

<entry id="flds_dms" modify_via_xml="DMS_EMIS_OCN">
<entry id="flds_dms">
<type>logical</type>
<category>flds</category>
<group>ALLCOMP_attributes</group>
Expand All @@ -2459,10 +2459,11 @@
</desc>
<values>
<value>.false.</value>
<value dms_from_ocn="on">.true.</value>
</values>
</entry>

<entry id="flds_brf" modify_via_xml="BRF_EMIS_OCN">
<entry id="flds_brf">
<type>logical</type>
<category>flds</category>
<group>ALLCOMP_attributes</group>
Expand Down
8 changes: 4 additions & 4 deletions mediator/esmFldsExchange_cesm_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1721,7 +1721,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
else
if ( fldchk(is_local%wrap%FBImp(compocn,compocn), 'Faoo_fdms_ocn', rc=rc) .and. &
fldchk(is_local%wrap%FBexp(compatm) , 'Faoo_fdms_ocn', rc=rc)) then
call addmap_from(compocn, 'Faoo_fdms_ocn', compocn, mapconsd, 'one', ocn2atm_map)
call addmap_from(compocn, 'Faoo_fdms_ocn', compatm, mapconsd, 'one', ocn2atm_map)
! custom merge in med_phases_prep_atm
end if
end if
Expand All @@ -1735,7 +1735,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
else
if ( fldchk(is_local%wrap%FBImp(compocn,compocn), 'Faoo_fbrf_ocn', rc=rc) .and. &
fldchk(is_local%wrap%FBexp(compatm) , 'Faoo_fbrf_ocn', rc=rc)) then
call addmap_from(compocn, 'Faoo_fbrf_ocn', compocn, mapconsd, 'one', ocn2atm_map)
call addmap_from(compocn, 'Faoo_fbrf_ocn', compatm, mapconsd, 'one', ocn2atm_map)
! custom merge in med_phases_prep_atm
end if
end if
Expand All @@ -1749,7 +1749,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
else
if ( fldchk(is_local%wrap%FBImp(compocn,compocn), 'Faoo_fn2o_ocn', rc=rc) .and. &
fldchk(is_local%wrap%FBexp(compatm) , 'Faoo_fn2o_ocn', rc=rc)) then
call addmap_from(compocn, 'Faoo_fn2o_ocn', compocn, mapconsd, 'one', ocn2atm_map)
call addmap_from(compocn, 'Faoo_fn2o_ocn', compatm, mapconsd, 'one', ocn2atm_map)
! custom merge in med_phases_prep_atm
end if
end if
Expand All @@ -1763,7 +1763,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
else
if ( fldchk(is_local%wrap%FBImp(compocn,compocn), 'Faoo_fnh3_ocn', rc=rc) .and. &
fldchk(is_local%wrap%FBexp(compatm) , 'Faoo_fnh3_ocn', rc=rc)) then
call addmap_from(compocn, 'Faoo_fnh3_ocn', compocn, mapconsd, 'one', ocn2atm_map)
call addmap_from(compocn, 'Faoo_fnh3_ocn', compatm, mapconsd, 'one', ocn2atm_map)
! custom merge in med_phases_prep_atm
end if
end if
Expand Down

0 comments on commit f4f64c3

Please sign in to comment.