Skip to content

Commit b959f1c

Browse files
author
brandon.reichl
committed
Add option to horizontally homogenize the Stokes drift when used via the dataoverride surfbands procedure.
1 parent e486f50 commit b959f1c

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]
@@ -444,6 +446,11 @@ subroutine MOM_wave_interface_init(time, G, GV, US, param_file, CS, diag)
444446
"A layer thickness below which the cell-center Stokes drift is used instead of "//&
445447
"the cell average. This is only used if WAVE_INTERFACE_ANSWER_DATE < 20230101.", &
446448
units="m", default=0.1, scale=US%m_to_Z, do_not_log=(CS%answer_date>=20230101))
449+
call get_param(param_file, mdl, "HOMOGENIZE_SURFBANDS", CS%Homogenize_Surfbands, &
450+
"A logical which causes the code to horizontally homogenize the surface band "//&
451+
"Stokes drift, which is needed in column mode to avoid round-off differences. "//&
452+
"At present it only works with DATAOVERRIDE, and is not coded for COUPLER.",&
453+
default=.false.)
447454
call get_param(param_file, mdl, "SURFBAND_SOURCE", TMPSTRING2, &
448455
"Choice of SURFACE_BANDS data mode, valid options include: \n"//&
449456
" DATAOVERRIDE - Read from NetCDF using FMS DataOverride. \n"//&
@@ -1076,6 +1083,7 @@ subroutine Surface_Bands_by_data_override(Time, G, GV, US, CS)
10761083
character(len=48) :: dim_name(4) ! The names of the dimensions of the variable.
10771084
character(len=20) :: varname ! The name of an input variable for data override.
10781085
real :: PI ! 3.1415926535... [nondim]
1086+
real :: avgx, avgy
10791087
logical :: wavenumber_exists
10801088
integer :: ndims, b, i, j
10811089

@@ -1156,6 +1164,14 @@ subroutine Surface_Bands_by_data_override(Time, G, GV, US, CS)
11561164
endif
11571165
enddo
11581166
enddo
1167+
if (CS%Homogenize_Surfbands) then
1168+
avgx = global_area_mean(temp_x, G)
1169+
avgy = global_area_mean(temp_y, G)
1170+
do j = G%jsd,G%jed ; do i = G%Isd,G%Ied ; if (G%mask2dT(i,j) > 0.0) then
1171+
temp_y(i,j) = avgy
1172+
temp_x(i,j) = avgx
1173+
endif ; enddo ; enddo
1174+
endif
11591175

11601176
! Interpolate to u/v grids
11611177
do j = G%jsc,G%jec

0 commit comments

Comments
 (0)