Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add wave/cice coupling fields #296

Merged
merged 4 commits into from
May 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 57 additions & 2 deletions mediator/esmFldsExchange_cesm_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,21 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
integer :: n, ns
character(len=CL) :: cvalue
character(len=CS) :: name
logical :: wavice_coupling
logical :: ocn2glc_coupling
character(len=*) , parameter :: subname=' (esmFldsExchange_cesm) '
!--------------------------------------

rc = ESMF_SUCCESS

call NUOPC_CompAttributeGet(gcomp, name='wavice_coupling', value=cvalue, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
read(cvalue,*) wavice_coupling

call NUOPC_CompAttributeGet(gcomp, name='ocn2glc_coupling', value=cvalue, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
read(cvalue,*) ocn2glc_coupling

!---------------------------------------
! Get the internal state
!---------------------------------------
Expand Down Expand Up @@ -2790,6 +2800,23 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
end if
end if

! ---------------------------------------------------------------------
! to ice: wave elevation spectrum (field with ungridded dimensions)
! ---------------------------------------------------------------------
if (wavice_coupling) then
if (phase == 'advertise') then
call addfld(fldListFr(compwav)%flds, 'Sw_elevation_spectrum')
call addfld(fldListTo(compice)%flds, 'Sw_elevation_spectrum')
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(fldListFr(compwav)%flds, 'Sw_elevation_spectrum', compice, mapbilnr, 'one', 'unset')
call addmrg(fldListTo(compice)%flds, 'Sw_elevation_spectrum', &
mrg_from=compwav, mrg_fld='Sw_elevation_spectrum', mrg_type='copy')
end if
end if
end if

!=====================================================================
! FIELDS TO WAVE (compwav)
!=====================================================================
Expand All @@ -2808,7 +2835,36 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
call addmrg(fldListTo(compwav)%flds, 'Si_ifrac', mrg_from=compice, mrg_fld='Si_ifrac', mrg_type='copy')
end if
end if

!----------------------------------------------------------
! to wav: ice thickness from ice
!----------------------------------------------------------
if (wavice_coupling) then
if (phase == 'advertise') then
call addfld(fldListFr(compice)%flds, 'Si_thick')
call addfld(fldListTo(compwav)%flds, 'Si_thick')
else
if (fldchk(is_local%wrap%FBexp(compwav) , 'Si_thick', rc=rc) .and. &
fldchk(is_local%wrap%FBImp(compice,compice ), 'Si_thick', rc=rc)) then
call addmap(fldListFr(compice)%flds, 'Si_thick', compwav, mapbilnr, 'one', ice2wav_smap)
call addmrg(fldListTo(compwav)%flds, 'Si_thick', mrg_from=compice, mrg_fld='Si_thick', mrg_type='copy')
end if
end if
end if
!----------------------------------------------------------
! to wav: ice floe diameter from ice
!----------------------------------------------------------
if (wavice_coupling) then
if (phase == 'advertise') then
call addfld(fldListFr(compice)%flds, 'Si_floediam')
call addfld(fldListTo(compwav)%flds, 'Si_floediam')
else
if (fldchk(is_local%wrap%FBexp(compwav) , 'Si_floediam', rc=rc) .and. &
fldchk(is_local%wrap%FBImp(compice,compice ), 'Si_floediam', rc=rc)) then
call addmap(fldListFr(compice)%flds, 'Si_floediam', compwav, mapbilnr, 'one', ice2wav_smap)
call addmrg(fldListTo(compwav)%flds, 'Si_floediam', mrg_from=compice, mrg_fld='Si_floediam', mrg_type='copy')
end if
end if
end if
! ---------------------------------------------------------------------
! to wav: ocean surface temperature from ocn
! ---------------------------------------------------------------------
Expand All @@ -2823,7 +2879,6 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
call addmrg(fldListTo(compwav)%flds, 'So_t', mrg_from=compocn, mrg_fld='So_t', mrg_type='copy')
end if
end if

! ---------------------------------------------------------------------
! to wav: ocean currents from ocn
! ---------------------------------------------------------------------
Expand Down
15 changes: 15 additions & 0 deletions mediator/fd_cesm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,14 @@
canonical_units: m
description: sea-ice export - volume of snow per unit area
#
- standard_name: Si_thick
canonical_units: m
description: sea-ice export - ice thickness
#
- standard_name: Si_floediam
canonical_units: m
description: sea-ice export - ice floe diameter
#
#-----------------------------------
# section: ocean export to mediator
#-----------------------------------
Expand Down Expand Up @@ -1157,6 +1165,13 @@
- standard_name: Sw_pstokes_y
canonical_units: m/s
description: Northward partitioned stokes drift components

#
- standard_name: Sw_elevation_spectrum
alias: wave_elevation_spectrum
canonical_units: m2/s
description: wave elevation spectrum

#-----------------------------------
# mediator fields
#-----------------------------------
Expand Down