Skip to content

Commit

Permalink
Merge pull request #498 from jedwards4b/reintroduce_wav2ocn_maps
Browse files Browse the repository at this point in the history
wav2ocn and ocn2wav maps are still needed in some cases
  • Loading branch information
jedwards4b authored Sep 30, 2024
2 parents 842be8a + 9c3751e commit a664d62
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 2 deletions.
3 changes: 3 additions & 0 deletions cime_config/buildnml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ def _create_drv_namelists(case, infile, confdir, nmlgen, files):
atm_mesh = case.get_value("ATM_DOMAIN_MESH")
lnd_mesh = case.get_value("LND_DOMAIN_MESH")
rof_mesh = case.get_value("ROF_DOMAIN_MESH")
ocn_mesh = case.get_value("OCN_DOMAIN_MESH")
wav_mesh = case.get_value("WAV_DOMAIN_MESH")
config["samegrid_atm_lnd"] = (
"true" if atm_mesh == case.get_value("LND_DOMAIN_MESH") else "false"
)
Expand All @@ -88,6 +90,7 @@ def _create_drv_namelists(case, infile, confdir, nmlgen, files):
"true" if atm_mesh == case.get_value("WAV_DOMAIN_MESH") else "false"
)
config["samegrid_lnd_rof"] = "true" if lnd_mesh == rof_mesh else "false"
config["samegrid_wav_ocn"] = "true" if ocn_mesh == wav_mesh else "false"

# determine if need to set atm_domainfile
scol_lon = float(case.get_value("PTS_LON"))
Expand Down
18 changes: 18 additions & 0 deletions cime_config/config_component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1405,6 +1405,24 @@
<desc>rof2ocn runoff mapping file</desc>
</entry>

<entry id="OCN2WAV_SMAPNAME">
<type>char</type>
<default_value>idmap</default_value>
<group>run_domain</group>
<file>env_run.xml</file>
<desc>ocn2wav state mapping file</desc>
</entry>

<entry id="WAV2OCN_SMAPNAME">
<type>char</type>
<values>
<value>unset</value>
</values>
<group>run_domain</group>
<file>env_run.xml</file>
<desc>wav2ocn state mapping file</desc>
</entry>

<entry id="EPS_FRAC">
<type>char</type>
<default_value>1.0e-02</default_value>
Expand Down
28 changes: 28 additions & 0 deletions cime_config/namelist_definition_drv.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2299,6 +2299,34 @@
</values>
</entry>

<entry id="ocn2wav_smapname" modify_via_xml="OCN2WAV_SMAPNAME">
<type>char</type>
<category>mapping</category>
<input_pathname>abs</input_pathname>
<group>MED_attributes</group>
<desc>
ocn to wav state mapping file for states
</desc>
<values>
<value samegrid_ocn_wav="true">idmap</value>
<value>$OCN2WAV_SMAPNAME</value>
</values>
</entry>

<entry id="wav2ocn_smapname" modify_via_xml="WAV2OCN_SMAPNAME">
<type>char</type>
<category>mapping</category>
<input_pathname>abs</input_pathname>
<group>MED_attributes</group>
<desc>
wav to ocn state mapping file for states
</desc>
<values>
<value samegrid_ocn_wav="true">idmap</value>
<value>$WAV2OCN_SMAPNAME</value>
</values>
</entry>

<!-- =========================== -->
<!-- ALLCOMP attributes -->
<!-- =========================== -->
Expand Down
14 changes: 12 additions & 2 deletions mediator/esmFldsExchange_cesm_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ module esmFldsExchange_cesm_mod
character(len=CX) :: rof2lnd_map = 'unset'
character(len=CX) :: lnd2rof_map = 'unset'

! optional mapping files
character(len=CX) :: wav2ocn_map ='unset'
character(len=CX) :: ocn2wav_map = 'unset'

! no mapping files (value is 'idmap' or 'unset')
character(len=CX) :: atm2ice_map = 'unset'
character(len=CX) :: atm2ocn_map = 'unset'
Expand All @@ -84,9 +88,7 @@ module esmFldsExchange_cesm_mod
character(len=CX) :: ice2wav_map = 'unset'
character(len=CX) :: lnd2atm_map = 'unset'
character(len=CX) :: ocn2atm_map = 'unset'
character(len=CX) :: ocn2wav_map = 'unset'
character(len=CX) :: rof2ocn_map = 'unset'
character(len=CX) :: wav2ocn_map = 'unset'

logical :: mapuv_with_cart3d ! Map U/V vector wind fields from ATM to OCN/ICE by rotating in Cartesian 3D space and then back
logical :: flds_i2o_per_cat ! Ice thickness category fields passed to OCN
Expand Down Expand Up @@ -203,6 +205,14 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
if (maintask) write(logunit, '(a)') trim(subname)//'rof2ocn_ice_rmapname = '// trim(rof2ocn_ice_rmap)

call NUOPC_CompAttributeGet(gcomp, name='wav2ocn_smapname', value=wav2ocn_map, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
if (maintask) write(logunit, '(a)') trim(subname)//'wav2ocn_smapname = '// trim(wav2ocn_map)
call NUOPC_CompAttributeGet(gcomp, name='ocn2wav_smapname', value=ocn2wav_map, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
if (maintask) write(logunit, '(a)') trim(subname)//'ocn2wav_smapname = '// trim(ocn2wav_map)


! uv cart3d mapping
call NUOPC_CompAttributeGet(gcomp, name='mapuv_with_cart3d', value=cvalue, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
Expand Down

0 comments on commit a664d62

Please sign in to comment.