Skip to content

Commit 07be9de

Browse files
brandon.reichlHallberg-NOAA
authored andcommitted
Add option to horizontally homogenize the Stokes drift when used via the dataoverride surfbands procedure.
1 parent e06aeb5 commit 07be9de

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/user/MOM_wave_interface.F90

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ module MOM_wave_interface
1616
use MOM_io, only : file_exists, get_var_sizes, read_variable
1717
use MOM_io, only : vardesc, var_desc
1818
use MOM_safe_alloc, only : safe_alloc_ptr
19+
use MOM_spatial_means, only : global_area_mean
1920
use MOM_time_manager, only : time_type, operator(+), operator(/)
2021
use MOM_unit_scaling, only : unit_scale_type
2122
use MOM_variables, only : thermo_var_ptrs, surface
@@ -66,6 +67,7 @@ module MOM_wave_interface
6667
logical, public :: Stokes_DDT = .false. !< Developmental:
6768
!! True if Stokes d/dt is used
6869
logical, public :: Passive_Stokes_DDT = .false. !< Keeps Stokes_DDT on, but doesn't affect dynamics
70+
logical :: Homogenize_Surfbands !< True to homogenize surface band Stokes drift in the horizontal
6971

7072
real, allocatable, dimension(:,:,:), public :: &
7173
Us_x !< 3d zonal Stokes drift profile [L T-1 ~> m s-1]
@@ -441,6 +443,11 @@ subroutine MOM_wave_interface_init(time, G, GV, US, param_file, CS, diag)
441443
"A layer thickness below which the cell-center Stokes drift is used instead of "//&
442444
"the cell average. This is only used if WAVE_INTERFACE_ANSWER_DATE < 20230101.", &
443445
units="m", default=0.1, scale=US%m_to_Z, do_not_log=(CS%answer_date>=20230101))
446+
call get_param(param_file, mdl, "HOMOGENIZE_SURFBANDS", CS%Homogenize_Surfbands, &
447+
"A logical which causes the code to horizontally homogenize the surface band "//&
448+
"Stokes drift, which is needed in column mode to avoid round-off differences. "//&
449+
"At present it only works with DATAOVERRIDE, and is not coded for COUPLER.",&
450+
default=.false.)
444451
call get_param(param_file, mdl, "SURFBAND_SOURCE", TMPSTRING2, &
445452
"Choice of SURFACE_BANDS data mode, valid options include: \n"//&
446453
" DATAOVERRIDE - Read from NetCDF using FMS DataOverride. \n"//&
@@ -1071,6 +1078,7 @@ subroutine Surface_Bands_by_data_override(Time, G, GV, US, CS)
10711078
character(len=48) :: dim_name(4) ! The names of the dimensions of the variable.
10721079
character(len=20) :: varname ! The name of an input variable for data override.
10731080
real :: PI ! 3.1415926535... [nondim]
1081+
real :: avgx, avgy
10741082
logical :: wavenumber_exists
10751083
integer :: ndims, b, i, j
10761084

@@ -1151,6 +1159,14 @@ subroutine Surface_Bands_by_data_override(Time, G, GV, US, CS)
11511159
endif
11521160
enddo
11531161
enddo
1162+
if (CS%Homogenize_Surfbands) then
1163+
avgx = global_area_mean(temp_x, G)
1164+
avgy = global_area_mean(temp_y, G)
1165+
do j = G%jsd,G%jed ; do i = G%Isd,G%Ied ; if (G%mask2dT(i,j) > 0.0) then
1166+
temp_y(i,j) = avgy
1167+
temp_x(i,j) = avgx
1168+
endif ; enddo ; enddo
1169+
endif
11541170

11551171
! Interpolate to u/v grids
11561172
do j = G%jsc,G%jec

0 commit comments

Comments
 (0)