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

Update CMEPS for 2-way ocean-wave coupling in HAFS #133

Open
wants to merge 7 commits into
base: emc/develop
Choose a base branch
from
60 changes: 60 additions & 0 deletions mediator/esmFldsExchange_hafs_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,18 @@ subroutine esmFldsExchange_hafs_advt(gcomp, phase, rc)
end if
end if

! to ocn: partitioned stokes drift from wav
if (hafs_attr%wav_present .and. hafs_attr%ocn_present) then
allocate(S_flds(2))
S_flds = (/'Sw_pstokes_x', 'Sw_pstokes_y'/)
do n = 1,size(S_flds)
fldname = trim(S_flds(n))
call addfld_from(compwav , fldname)
call addfld_to(compocn , fldname)
end do
deallocate(S_flds)
end if

!=====================================================================
! FIELDS TO WAVE (compwav)
!=====================================================================
Expand All @@ -298,6 +310,22 @@ subroutine esmFldsExchange_hafs_advt(gcomp, phase, rc)
deallocate(S_flds)
end if

! ---------------------------------------------------------------------
! to wav: states from ocn
! - zonal sea water velocity from ocn
! - meridional sea water velocity from ocn
! ---------------------------------------------------------------------
if (hafs_attr%ocn_present .and. hafs_attr%wav_present) then
allocate(S_flds(2))
S_flds = (/'So_u', 'So_v'/)
do n = 1,size(S_flds)
fldname = trim(S_flds(n))
call addfld_from(compocn , fldname)
call addfld_to(compwav , fldname)
end do
deallocate(S_flds)
end if

call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO)

end subroutine esmFldsExchange_hafs_advt
Expand Down Expand Up @@ -569,6 +597,21 @@ subroutine esmFldsExchange_hafs_init(gcomp, phase, rc)
end if
end if

! ---------------------------------------------------------------------
! to ocn: partitioned stokes drift from wav
! ---------------------------------------------------------------------
allocate(S_flds(2))
S_flds = (/'Sw_pstokes_x', 'Sw_pstokes_y'/)
do n = 1,size(S_flds)
fldname = trim(S_flds(n))
if ( fldchk(is_local%wrap%FBexp(compocn) , fldname, rc=rc) .and. &
fldchk(is_local%wrap%FBImp(compwav,compwav), fldname, rc=rc)) then
call addmap_from(compwav, fldname, compocn, mapfillv_bilnr, 'one', 'unset')
call addmrg_to(compocn, fldname, mrg_from=compwav, mrg_fld=fldname, mrg_type='copy')
end if
end do
deallocate(S_flds)

!=====================================================================
! FIELDS TO WAVE (compwav)
!=====================================================================
Expand All @@ -593,6 +636,23 @@ subroutine esmFldsExchange_hafs_init(gcomp, phase, rc)
deallocate(S_flds)
end if

! ---------------------------------------------------------------------
! to wav: states from ocn
! - zonal sea water velocity from ocn
! - meridional sea water velocity from ocn
! ---------------------------------------------------------------------
allocate(S_flds(2))
S_flds = (/'So_u', 'So_v'/)
do n = 1,size(S_flds)
fldname = trim(S_flds(n))
if ( fldchk(is_local%wrap%FBexp(compwav) , fldname, rc=rc) .and. &
fldchk(is_local%wrap%FBImp(compocn,compocn), fldname, rc=rc)) then
call addmap_from(compocn, fldname, compwav, mapfillv_bilnr , 'one', 'unset')
call addmrg_to(compwav, fldname, mrg_from=compocn, mrg_fld=fldname, mrg_type='copy')
end if
end do
deallocate(S_flds)

call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO)

end subroutine esmFldsExchange_hafs_init
Expand Down