@@ -18,7 +18,7 @@ module MOM_barotropic
18
18
use MOM_grid, only : ocean_grid_type
19
19
use MOM_harmonic_analysis, only : HA_accum_FtSSH, harmonic_analysis_CS
20
20
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
22
22
use MOM_open_boundary, only : ocean_OBC_type, OBC_NONE, open_boundary_query
23
23
use MOM_open_boundary, only : OBC_DIRECTION_E, OBC_DIRECTION_W
24
24
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,
4459
4459
! drag piston velocity.
4460
4460
character (len= 80 ) :: wave_drag_var ! The wave drag piston velocity variable
4461
4461
! 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.
4462
4466
real :: mean_SL ! The mean sea level that is used along with the bathymetry to estimate the
4463
4467
! geometry when LINEARIZED_BT_CORIOLIS is true or BT_NONLIN_STRESS is false [Z ~> m].
4464
4468
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,
4703
4707
" piston velocities." , default= " " , do_not_log= .not. CS% linear_wave_drag)
4704
4708
call get_param(param_file, mdl, " BT_WAVE_DRAG_VAR" , wave_drag_var, &
4705
4709
" 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." , &
4707
4712
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)
4708
4721
call get_param(param_file, mdl, " BT_WAVE_DRAG_SCALE" , wave_drag_scale, &
4709
4722
" A scaling factor for the barotropic linear wave drag " // &
4710
4723
" 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,
4924
4937
wave_drag_file = trim (slasher(inputdir))// trim (wave_drag_file)
4925
4938
call log_param(param_file, mdl, " INPUTDIR/BT_WAVE_DRAG_FILE" , wave_drag_file)
4926
4939
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(:,:)
4928
4945
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
4940
4966
4941
4967
CS% dtbt_fraction = 0.98 ; if (dtbt_input < 0.0 ) CS% dtbt_fraction = - dtbt_input
4942
4968
0 commit comments