Skip to content

Commit

Permalink
wav2ocn and ocn2wav maps are still needed in some cases
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Aug 12, 2024
1 parent 4520051 commit 34acae4
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 9 deletions.
16 changes: 16 additions & 0 deletions cime_config/config_component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1405,6 +1405,22 @@
<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>
<default_value>idmap</default_value>
<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
26 changes: 26 additions & 0 deletions cime_config/namelist_definition_drv.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2303,6 +2303,32 @@
</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>$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>$WAV2OCN_SMAPNAME</value>
</values>
</entry>

<!-- =========================== -->
<!-- ALLCOMP attributes -->
<!-- =========================== -->
Expand Down
28 changes: 19 additions & 9 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_smap ='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 @@ -202,6 +204,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_smap, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
if (maintask) write(logunit, '(a)') trim(subname)//'wav2ocn_smapname = '// trim(wav2ocn_smap)
call NUOPC_CompAttributeGet(gcomp, name='ocn2wav_smapname', value=ocn2wav_smap, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
if (maintask) write(logunit, '(a)') trim(subname)//'ocn2wav_smapname = '// trim(ocn2wav_smap)


! 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 Expand Up @@ -2470,7 +2480,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
else
if ( fldchk(is_local%wrap%FBExp(compocn) , 'Sw_lamult', rc=rc) .and. &
fldchk(is_local%wrap%FBImp(compwav, compwav), 'Sw_lamult', rc=rc)) then
call addmap_from(compwav, 'Sw_lamult', compocn, mapbilnr_nstod, 'one', wav2ocn_map)
call addmap_from(compwav, 'Sw_lamult', compocn, mapbilnr_nstod, 'one', wav2ocn_smap)
call addmrg_to(compocn, 'Sw_lamult', mrg_from=compwav, mrg_fld='Sw_lamult', mrg_type='copy')
end if
end if
Expand All @@ -2483,7 +2493,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
else
if ( fldchk(is_local%wrap%FBExp(compocn) , 'Sw_ustokes', rc=rc) .and. &
fldchk(is_local%wrap%FBImp(compwav, compwav), 'Sw_ustokes', rc=rc)) then
call addmap_from(compwav, 'Sw_ustokes', compocn, mapbilnr_nstod, 'one', wav2ocn_map)
call addmap_from(compwav, 'Sw_ustokes', compocn, mapbilnr_nstod, 'one', wav2ocn_smap)
call addmrg_to(compocn, 'Sw_ustokes', mrg_from=compwav, mrg_fld='Sw_ustokes', mrg_type='copy')
end if
end if
Expand All @@ -2496,7 +2506,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
else
if ( fldchk(is_local%wrap%FBExp(compocn) , 'Sw_vstokes', rc=rc) .and. &
fldchk(is_local%wrap%FBImp(compwav, compwav), 'Sw_vstokes', rc=rc)) then
call addmap_from(compwav, 'Sw_vstokes', compocn, mapbilnr_nstod, 'one', wav2ocn_map)
call addmap_from(compwav, 'Sw_vstokes', compocn, mapbilnr_nstod, 'one', wav2ocn_smap)
call addmrg_to(compocn, 'Sw_vstokes', mrg_from=compwav, mrg_fld='Sw_vstokes', mrg_type='copy')
end if
end if
Expand All @@ -2509,7 +2519,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
else
if ( fldchk(is_local%wrap%FBExp(compocn) , 'Sw_hstokes', rc=rc) .and. &
fldchk(is_local%wrap%FBImp(compwav, compwav), 'Sw_hstokes', rc=rc)) then
call addmap_from(compwav, 'Sw_hstokes', compocn, mapbilnr_nstod, 'one', wav2ocn_map)
call addmap_from(compwav, 'Sw_hstokes', compocn, mapbilnr_nstod, 'one', wav2ocn_smap)
call addmrg_to(compocn, 'Sw_hstokes', mrg_from=compwav, mrg_fld='Sw_hstokes', mrg_type='copy')
end if
end if
Expand All @@ -2522,7 +2532,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
else
if ( fldchk(is_local%wrap%FBExp(compocn) , 'Sw_pstokes_x', rc=rc) .and. &
fldchk(is_local%wrap%FBImp(compwav, compwav), 'Sw_pstokes_x', rc=rc)) then
call addmap_from(compwav, 'Sw_pstokes_x', compocn, mapbilnr_nstod, 'one', wav2ocn_map)
call addmap_from(compwav, 'Sw_pstokes_x', compocn, mapbilnr_nstod, 'one', wav2ocn_smap)
call addmrg_to(compocn, 'Sw_pstokes_x', mrg_from=compwav, mrg_fld='Sw_pstokes_x', mrg_type='copy')
end if
end if
Expand All @@ -2535,7 +2545,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
else
if ( fldchk(is_local%wrap%FBExp(compocn) , 'Sw_pstokes_y', rc=rc) .and. &
fldchk(is_local%wrap%FBImp(compwav, compwav), 'Sw_pstokes_y', rc=rc)) then
call addmap_from(compwav, 'Sw_pstokes_y', compocn, mapbilnr_nstod, 'one', wav2ocn_map)
call addmap_from(compwav, 'Sw_pstokes_y', compocn, mapbilnr_nstod, 'one', wav2ocn_smap)
call addmrg_to(compocn, 'Sw_pstokes_y', mrg_from=compwav, mrg_fld='Sw_pstokes_y', mrg_type='copy')
end if
end if
Expand Down Expand Up @@ -2988,7 +2998,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
else
if ( fldchk(is_local%wrap%FBExp(compice) , 'Sw_elevation_spectrum', rc=rc) .and. &
fldchk(is_local%wrap%FBImp(compwav,compwav), 'Sw_elevation_spectrum', rc=rc)) then
call addmap_from(compwav, 'Sw_elevation_spectrum', compice, mapbilnr_nstod, 'one', wav2ocn_map)
call addmap_from(compwav, 'Sw_elevation_spectrum', compice, mapbilnr_nstod, 'one', wav2ocn_smap)
call addmrg_to(compice, 'Sw_elevation_spectrum', &
mrg_from=compwav, mrg_fld='Sw_elevation_spectrum', mrg_type='copy')
end if
Expand Down

0 comments on commit 34acae4

Please sign in to comment.