Skip to content

Commit 2024f6f

Browse files
authored
Directional linear wave drag (#703)
* Directional linear wave drag This commit allows the linear wave drag to be applied to the u and v components of the barotropic velocity separately.
1 parent 42c1a32 commit 2024f6f

File tree

1 file changed

+40
-14
lines changed

1 file changed

+40
-14
lines changed

src/core/MOM_barotropic.F90

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module MOM_barotropic
1818
use MOM_grid, only : ocean_grid_type
1919
use MOM_harmonic_analysis, only : HA_accum_FtSSH, harmonic_analysis_CS
2020
use MOM_hor_index, only : hor_index_type
21-
use MOM_io, only : vardesc, var_desc, MOM_read_data, slasher
21+
use MOM_io, only : vardesc, var_desc, MOM_read_data, slasher, NORTH_FACE, EAST_FACE
2222
use MOM_open_boundary, only : ocean_OBC_type, OBC_NONE, open_boundary_query
2323
use MOM_open_boundary, only : OBC_DIRECTION_E, OBC_DIRECTION_W
2424
use MOM_open_boundary, only : OBC_DIRECTION_N, OBC_DIRECTION_S, OBC_segment_type
@@ -4459,6 +4459,10 @@ subroutine barotropic_init(u, v, h, eta, Time, G, GV, US, param_file, diag, CS,
44594459
! drag piston velocity.
44604460
character(len=80) :: wave_drag_var ! The wave drag piston velocity variable
44614461
! name in wave_drag_file.
4462+
character(len=80) :: wave_drag_u ! The wave drag piston velocity variable
4463+
! name in wave_drag_file.
4464+
character(len=80) :: wave_drag_v ! The wave drag piston velocity variable
4465+
! name in wave_drag_file.
44624466
real :: mean_SL ! The mean sea level that is used along with the bathymetry to estimate the
44634467
! geometry when LINEARIZED_BT_CORIOLIS is true or BT_NONLIN_STRESS is false [Z ~> m].
44644468
real :: Z_to_H ! A local unit conversion factor [H Z-1 ~> nondim or kg m-3]
@@ -4703,8 +4707,17 @@ subroutine barotropic_init(u, v, h, eta, Time, G, GV, US, param_file, diag, CS,
47034707
"piston velocities.", default="", do_not_log=.not.CS%linear_wave_drag)
47044708
call get_param(param_file, mdl, "BT_WAVE_DRAG_VAR", wave_drag_var, &
47054709
"The name of the variable in BT_WAVE_DRAG_FILE with the "//&
4706-
"barotropic linear wave drag piston velocities at h points.", &
4710+
"barotropic linear wave drag piston velocities at h points. "//&
4711+
"It will not be used if both BT_WAVE_DRAG_U and BT_WAVE_DRAG_V are defined.", &
47074712
default="rH", do_not_log=.not.CS%linear_wave_drag)
4713+
call get_param(param_file, mdl, "BT_WAVE_DRAG_U", wave_drag_u, &
4714+
"The name of the variable in BT_WAVE_DRAG_FILE with the "//&
4715+
"barotropic linear wave drag piston velocities at u points.", &
4716+
default="", do_not_log=.not.CS%linear_wave_drag)
4717+
call get_param(param_file, mdl, "BT_WAVE_DRAG_V", wave_drag_v, &
4718+
"The name of the variable in BT_WAVE_DRAG_FILE with the "//&
4719+
"barotropic linear wave drag piston velocities at v points.", &
4720+
default="", do_not_log=.not.CS%linear_wave_drag)
47084721
call get_param(param_file, mdl, "BT_WAVE_DRAG_SCALE", wave_drag_scale, &
47094722
"A scaling factor for the barotropic linear wave drag "//&
47104723
"piston velocities.", default=1.0, units="nondim", &
@@ -4924,19 +4937,32 @@ subroutine barotropic_init(u, v, h, eta, Time, G, GV, US, param_file, diag, CS,
49244937
wave_drag_file = trim(slasher(inputdir))//trim(wave_drag_file)
49254938
call log_param(param_file, mdl, "INPUTDIR/BT_WAVE_DRAG_FILE", wave_drag_file)
49264939

4927-
allocate(lin_drag_h(isd:ied,jsd:jed), source=0.0)
4940+
if (len_trim(wave_drag_u) > 0 .and. len_trim(wave_drag_v) > 0) then
4941+
call MOM_read_data(wave_drag_file, wave_drag_u, CS%lin_drag_u, G%Domain, &
4942+
position=EAST_FACE, scale=GV%m_to_H*US%T_to_s)
4943+
call pass_var(CS%lin_drag_u, G%Domain)
4944+
CS%lin_drag_u(:,:) = wave_drag_scale * CS%lin_drag_u(:,:)
49284945

4929-
call MOM_read_data(wave_drag_file, wave_drag_var, lin_drag_h, G%Domain, scale=GV%m_to_H*US%T_to_s)
4930-
call pass_var(lin_drag_h, G%Domain)
4931-
do j=js,je ; do I=is-1,ie
4932-
CS%lin_drag_u(I,j) = wave_drag_scale * 0.5 * (lin_drag_h(i,j) + lin_drag_h(i+1,j))
4933-
enddo ; enddo
4934-
do J=js-1,je ; do i=is,ie
4935-
CS%lin_drag_v(i,J) = wave_drag_scale * 0.5 * (lin_drag_h(i,j) + lin_drag_h(i,j+1))
4936-
enddo ; enddo
4937-
deallocate(lin_drag_h)
4938-
endif
4939-
endif
4946+
call MOM_read_data(wave_drag_file, wave_drag_v, CS%lin_drag_v, G%Domain, &
4947+
position=NORTH_FACE, scale=GV%m_to_H*US%T_to_s)
4948+
call pass_var(CS%lin_drag_v, G%Domain)
4949+
CS%lin_drag_v(:,:) = wave_drag_scale * CS%lin_drag_v(:,:)
4950+
4951+
else
4952+
allocate(lin_drag_h(isd:ied,jsd:jed), source=0.0)
4953+
4954+
call MOM_read_data(wave_drag_file, wave_drag_var, lin_drag_h, G%Domain, scale=GV%m_to_H*US%T_to_s)
4955+
call pass_var(lin_drag_h, G%Domain)
4956+
do j=js,je ; do I=is-1,ie
4957+
CS%lin_drag_u(I,j) = wave_drag_scale * 0.5 * (lin_drag_h(i,j) + lin_drag_h(i+1,j))
4958+
enddo ; enddo
4959+
do J=js-1,je ; do i=is,ie
4960+
CS%lin_drag_v(i,J) = wave_drag_scale * 0.5 * (lin_drag_h(i,j) + lin_drag_h(i,j+1))
4961+
enddo ; enddo
4962+
deallocate(lin_drag_h)
4963+
endif ! len_trim(wave_drag_u) > 0 .and. len_trim(wave_drag_v) > 0
4964+
endif ! len_trim(wave_drag_file) > 0
4965+
endif ! CS%linear_wave_drag
49404966

49414967
CS%dtbt_fraction = 0.98 ; if (dtbt_input < 0.0) CS%dtbt_fraction = -dtbt_input
49424968

0 commit comments

Comments
 (0)