Skip to content

Commit

Permalink
fix low mode in tidal_mixing
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphael Dussin authored and marshallward committed Oct 22, 2021
1 parent 037af8e commit ee3b92f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
8 changes: 4 additions & 4 deletions src/parameterizations/lateral/MOM_internal_tides.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1451,9 +1451,9 @@ subroutine propagate_x(En, speed_x, Cgx_av, dCgx, dt, G, US, Nangle, CS, LB)
! Only reflect newly arrived energy; existing energy in incident wedge is not reflected
! and will eventually propagate out of cell. (This code only reflects if En > 0.)
call reflect(Fdt_m, Nangle, CS, G, LB)
call teleport(Fdt_m, Nangle, CS, G, LB)
!call teleport(Fdt_m, Nangle, CS, G, LB)
call reflect(Fdt_p, Nangle, CS, G, LB)
call teleport(Fdt_p, Nangle, CS, G, LB)
!call teleport(Fdt_p, Nangle, CS, G, LB)

! Update reflected energy [R Z3 T-2 ~> J m-2]
do a=1,Nangle ; do j=jsh,jeh ; do i=ish,ieh
Expand Down Expand Up @@ -1533,9 +1533,9 @@ subroutine propagate_y(En, speed_y, Cgy_av, dCgy, dt, G, US, Nangle, CS, LB)
! Only reflect newly arrived energy; existing energy in incident wedge is not reflected
! and will eventually propagate out of cell. (This code only reflects if En > 0.)
call reflect(Fdt_m, Nangle, CS, G, LB)
call teleport(Fdt_m, Nangle, CS, G, LB)
!call teleport(Fdt_m, Nangle, CS, G, LB)
call reflect(Fdt_p, Nangle, CS, G, LB)
call teleport(Fdt_p, Nangle, CS, G, LB)
!call teleport(Fdt_p, Nangle, CS, G, LB)

! Update reflected energy [R Z3 T-2 ~> J m-2]
do a=1,Nangle ; do j=jsh,jeh ; do i=ish,ieh
Expand Down
4 changes: 2 additions & 2 deletions src/parameterizations/vertical/MOM_set_diffusivity.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2058,8 +2058,8 @@ subroutine set_diffusivity_init(Time, G, GV, US, param_file, diag, CS, int_tide_
"forms of the same expressions.", default=default_2018_answers)

! CS%use_tidal_mixing is set to True if an internal tidal dissipation scheme is to be used.
CS%use_tidal_mixing = tidal_mixing_init(Time, G, GV, US, param_file, diag, &
CS%tidal_mixing_CSp)
CS%use_tidal_mixing = tidal_mixing_init(Time, G, GV, US, param_file, &
CS%int_tide_CSp, diag, CS%tidal_mixing_CSp)

call get_param(param_file, mdl, "ML_RADIATION", CS%ML_radiation, &
"If true, allow a fraction of TKE available from wind "//&
Expand Down
13 changes: 6 additions & 7 deletions src/parameterizations/vertical/MOM_tidal_mixing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module MOM_tidal_mixing
use MOM_file_parser, only : get_param, log_param, log_version, param_file_type
use MOM_grid, only : ocean_grid_type
use MOM_io, only : slasher, MOM_read_data, field_size
use MOM_internal_tides, only : int_tide_CS, get_lowmode_loss
use MOM_remapping, only : remapping_CS, initialize_remapping, remapping_core_h
use MOM_string_functions, only : uppercase, lowercase
use MOM_unit_scaling, only : unit_scale_type
Expand Down Expand Up @@ -155,6 +156,7 @@ module MOM_tidal_mixing
real, pointer, dimension(:,:) :: mask_itidal => NULL() !< A mask of where internal tide energy is input
real, pointer, dimension(:,:) :: h2 => NULL() !< Squared bottom depth variance [Z2 ~> m2].
real, pointer, dimension(:,:) :: tideamp => NULL() !< RMS tidal amplitude [Z T-1 ~> m s-1]
type(int_tide_CS), pointer :: int_tide_CSp=> NULL() !< Control structure for a child module
real, allocatable, dimension(:) :: h_src !< tidal constituent input layer thickness [m]
real, allocatable, dimension(:,:) :: tidal_qe_2d !< Tidal energy input times the local dissipation
!! fraction, q*E(x,y), with the CVMix implementation
Expand Down Expand Up @@ -209,12 +211,13 @@ module MOM_tidal_mixing
contains

!> Initializes internal tidal dissipation scheme for diapycnal mixing
logical function tidal_mixing_init(Time, G, GV, US, param_file, diag, CS)
logical function tidal_mixing_init(Time, G, GV, US, param_file, int_tide_CSp, diag, CS)
type(time_type), intent(in) :: Time !< The current time.
type(ocean_grid_type), intent(in) :: G !< Grid structure.
type(verticalGrid_type), intent(in) :: GV !< Vertical grid structure.
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
type(param_file_type), intent(in) :: param_file !< Run-time parameter file handle
type(int_tide_CS),target, intent(in) :: int_tide_CSp !< A pointer to the internal tides control structure
type(diag_ctrl), target, intent(inout) :: diag !< Diagnostics control structure.
type(tidal_mixing_cs), pointer :: CS !< This module's control structure.

Expand Down Expand Up @@ -272,6 +275,7 @@ logical function tidal_mixing_init(Time, G, GV, US, param_file, diag, CS)
allocate(CS%dd)
CS%debug = CS%debug.and.is_root_pe()
CS%diag => diag
CS%int_tide_CSp => int_tide_CSp
CS%use_CVmix_tidal = use_CVmix_tidal
CS%int_tide_dissipation = int_tide_dissipation

Expand Down Expand Up @@ -1215,12 +1219,7 @@ subroutine add_int_tide_diffusivity(h, N2_bot, j, TKE_to_Kd, max_TKE, G, GV, US,
TKE_lowmode_bot(i) = 0.0
if (CS%Lowmode_itidal_dissipation) then
! get loss rate due to wave drag on low modes (already multiplied by q)

! TODO: uncomment the following call and fix it
!call get_lowmode_loss(i,j,G,CS%int_tide_CSp,"WaveDrag",TKE_lowmode_tot)
write (mesg,*) "========", __FILE__, __LINE__
call MOM_error(FATAL,trim(mesg)//": this block not supported yet. (aa)")

call get_lowmode_loss(i,j,G,CS%int_tide_CSp,"WaveDrag",TKE_lowmode_tot)
TKE_lowmode_bot(i) = CS%Mu_itides * I_rho0 * TKE_lowmode_tot
endif
! Vertical energy flux at bottom
Expand Down

0 comments on commit ee3b92f

Please sign in to comment.