Skip to content
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
12 changes: 11 additions & 1 deletion config_src/drivers/nuopc_cap/mom_cap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ module MOM_cap_mod
logical :: grid_attach_area = .false.
logical :: use_coldstart = .true.
logical :: use_mommesh = .true.
logical :: set_missing_stks_to_zero = .false.
logical :: restart_eor = .false.
character(len=128) :: scalar_field_name = ''
integer :: scalar_field_count = 0
Expand Down Expand Up @@ -367,6 +368,14 @@ subroutine InitializeP0(gcomp, importState, exportState, clock, rc)
write(logmsg,*) use_coldstart
call ESMF_LogWrite('MOM_cap:use_coldstart = '//trim(logmsg), ESMF_LOGMSG_INFO)

set_missing_stks_to_zero = .false.
call NUOPC_CompAttributeGet(gcomp, name="set_missing_stks_to_zero", value=value, &
isPresent=isPresent, isSet=isSet, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
if (isPresent .and. isSet) set_missing_stks_to_zero=(trim(value)=="true")
write(logmsg,*) set_missing_stks_to_zero
call ESMF_LogWrite('MOM_cap:set_missing_stks_to_zero = '//trim(logmsg), ESMF_LOGMSG_INFO)

use_mommesh = .true.
call NUOPC_CompAttributeGet(gcomp, name="use_mommesh", value=value, &
isPresent=isPresent, isSet=isSet, rc=rc)
Expand Down Expand Up @@ -1844,7 +1853,8 @@ subroutine ModelAdvance(gcomp, rc)
! Import data
!---------------

call mom_import(ocean_public, ocean_grid, importState, ice_ocean_boundary, rc=rc)
call mom_import(ocean_public, ocean_grid, importState, ice_ocean_boundary, &
set_missing_stks_to_zero, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

!---------------
Expand Down
42 changes: 30 additions & 12 deletions config_src/drivers/nuopc_cap/mom_cap_methods.F90
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,16 @@ end subroutine mom_set_geomtype
!> This function has a few purposes:
!! (1) it imports surface fluxes using data from the mediator; and
!! (2) it can apply restoring in SST and SSS.
subroutine mom_import(ocean_public, ocean_grid, importState, ice_ocean_boundary, rc)
type(ocean_public_type) , intent(in) :: ocean_public !< Ocean surface state
type(ocean_grid_type) , intent(in) :: ocean_grid !< Ocean model grid
type(ESMF_State) , intent(inout) :: importState !< incoming data from mediator
type(ice_ocean_boundary_type) , intent(inout) :: ice_ocean_boundary !< Ocean boundary forcing
integer , intent(inout) :: rc !< Return code
!! (3) it can convert imported stokes drift components to zero if they are missing.
subroutine mom_import(ocean_public, ocean_grid, importState, ice_ocean_boundary, &
set_missing_stks_to_zero, rc)
type(ocean_public_type) , intent(in) :: ocean_public !< Ocean surface state
type(ocean_grid_type) , intent(in) :: ocean_grid !< Ocean model grid
logical , intent(in) :: set_missing_stks_to_zero !< If true, set
!! missing stokes drift to zero
type(ESMF_State) , intent(inout) :: importState !< incoming data from mediator
type(ice_ocean_boundary_type) , intent(inout) :: ice_ocean_boundary !< Ocean boundary forcing
integer , intent(inout) :: rc !< Return code

! Local Variables
integer :: i, j, ib, ig, jg, n
Expand Down Expand Up @@ -537,12 +541,26 @@ subroutine mom_import(ocean_public, ocean_grid, importState, ice_ocean_boundary,
do i = isc, iec
ig = i + ocean_grid%isc - isc
!rotate
do ib = 1, nsc
ice_ocean_boundary%ustkb(i,j,ib) = ocean_grid%cos_rot(ig,jg)*stkx(i,j,ib) &
- ocean_grid%sin_rot(ig,jg)*stky(i,j,ib)
ice_ocean_boundary%vstkb(i,j,ib) = ocean_grid%cos_rot(ig,jg)*stky(i,j,ib) &
+ ocean_grid%sin_rot(ig,jg)*stkx(i,j,ib)
enddo
if(set_missing_stks_to_zero) then
do ib = 1, nsc
if((abs(stkx(i,j,ib)-9.99E20_ESMF_KIND_R8) <= 0.01_ESMF_KIND_R8)) then
ice_ocean_boundary%ustkb(i,j,ib) = 0.0
ice_ocean_boundary%vstkb(i,j,ib) = 0.0
else
ice_ocean_boundary%ustkb(i,j,ib) = ocean_grid%cos_rot(ig,jg)*stkx(i,j,ib) &
- ocean_grid%sin_rot(ig,jg)*stky(i,j,ib)
ice_ocean_boundary%vstkb(i,j,ib) = ocean_grid%cos_rot(ig,jg)*stky(i,j,ib) &
+ ocean_grid%sin_rot(ig,jg)*stkx(i,j,ib)
endif
enddo
else
do ib = 1, nsc
ice_ocean_boundary%ustkb(i,j,ib) = ocean_grid%cos_rot(ig,jg)*stkx(i,j,ib) &
- ocean_grid%sin_rot(ig,jg)*stky(i,j,ib)
ice_ocean_boundary%vstkb(i,j,ib) = ocean_grid%cos_rot(ig,jg)*stky(i,j,ib) &
+ ocean_grid%sin_rot(ig,jg)*stkx(i,j,ib)
enddo
endif
! apply masks
ice_ocean_boundary%ustkb(i,j,:) = ice_ocean_boundary%ustkb(i,j,:) * ocean_grid%mask2dT(ig,jg)
ice_ocean_boundary%vstkb(i,j,:) = ice_ocean_boundary%vstkb(i,j,:) * ocean_grid%mask2dT(ig,jg)
Expand Down
Loading