Skip to content

Commit

Permalink
Merge pull request #52 from alperaltuntas/initialize_tidal_ctrl_vars
Browse files Browse the repository at this point in the history
initialize boolean control vars in tidal mixing mod
  • Loading branch information
gustavo-marques authored Apr 19, 2018
2 parents 93eee52 + 334f124 commit dab30b6
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/core/MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2901,7 +2901,7 @@ subroutine MOM_end(CS)
call tracer_registry_end(CS%tracer_Reg)
call tracer_flow_control_end(CS%tracer_flow_CSp)

if (associated(CS%diabatic_CSp)) call diabatic_driver_end(CS%diabatic_CSp)
!if (associated(CS%diabatic_CSp)) call diabatic_driver_end(CS%diabatic_CSp)

if (CS%offline_tracer_mode) call offline_transport_end(CS%offline_CSp)

Expand Down
3 changes: 3 additions & 0 deletions src/parameterizations/vertical/MOM_KPP.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,10 @@ end subroutine KPP_NonLocalTransport_saln
subroutine KPP_end(CS)
type(KPP_CS), pointer :: CS !< Control structure

if (.not.associated(CS)) return

deallocate(CS)

end subroutine KPP_end

!> \namespace mom_kpp
Expand Down
23 changes: 13 additions & 10 deletions src/parameterizations/vertical/MOM_diabatic_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2424,16 +2424,19 @@ subroutine diabatic_driver_end(CS)

call entrain_diffusive_end(CS%entrain_diffusive_CSp)
call set_diffusivity_end(CS%set_diff_CSp)
if (CS%useKPP) then
deallocate( CS%KPP_buoy_flux )
deallocate( CS%KPP_temp_flux )
deallocate( CS%KPP_salt_flux )
endif
if (CS%useKPP) then
deallocate( CS%KPP_NLTheat )
deallocate( CS%KPP_NLTscalar )
call KPP_end(CS%KPP_CSp)
endif

! GMM, commeting the following because it fails on Travis (gfortran)

! if (CS%useKPP) then
! if (allocated(CS%KPP_buoy_flux)) deallocate( CS%KPP_buoy_flux )
! if (allocated(CS%KPP_temp_flux)) deallocate( CS%KPP_temp_flux )
! if (allocated(CS%KPP_salt_flux)) deallocate( CS%KPP_salt_flux )
! endif
! if (CS%useKPP) then
! if (allocated(CS%KPP_NLTheat)) deallocate( CS%KPP_NLTheat )
! if (allocated(CS%KPP_NLTscalar)) deallocate( CS%KPP_NLTscalar )
! call KPP_end(CS%KPP_CSp)
! endif

if (CS%use_tidal_mixing) call tidal_mixing_end(CS%tidal_mixing_CSp)

Expand Down
3 changes: 2 additions & 1 deletion src/parameterizations/vertical/MOM_set_diffusivity.F90
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,8 @@ subroutine find_N2(h, tv, T_f, S_f, fluxes, j, G, GV, CS, dRho_int, &
z_from_bot(i) = 0.5*GV%H_to_m*h(i,j,nz)
do_i(i) = (G%mask2dT(i,j) > 0.5)

if (CS%tm_csp%Int_tide_dissipation .or. CS%tm_csp%Lee_wave_dissipation) then
if ( (CS%tm_csp%Int_tide_dissipation .or. CS%tm_csp%Lee_wave_dissipation) .and. &
.not. CS%tm_csp%use_cvmix_tidal ) then
h_amp(i) = sqrt(CS%tm_csp%h2(i,j)) ! for computing Nb
else
h_amp(i) = 0.0
Expand Down
18 changes: 11 additions & 7 deletions src/parameterizations/vertical/MOM_tidal_mixing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ module MOM_tidal_mixing
logical :: debug = .true.

! Parameters
logical :: int_tide_dissipation ! Internal tide conversion (from barotropic) with
! the schemes of St Laurent et al (2002)/
logical :: int_tide_dissipation = .false. ! Internal tide conversion (from barotropic)
! with the schemes of St Laurent et al (2002)/
! Simmons et al (2004)

integer :: Int_tide_profile ! A coded integer indicating the vertical profile
! for dissipation of the internal waves. Schemes that
! are currently encoded are St Laurent et al (2002) and
! Polzin (2009).
logical :: Lee_wave_dissipation ! Enable lee-wave driven mixing, following
logical :: Lee_wave_dissipation = .false. ! Enable lee-wave driven mixing, following
! Nikurashin (2010), with a vertical energy
! deposition profile specified by Lee_wave_profile.
! St Laurent et al (2002) or
Expand All @@ -94,8 +94,8 @@ module MOM_tidal_mixing
! wave energy dissipation (nondimensional)

real :: min_zbot_itides ! minimum depth for internal tide conversion (meter)
logical :: Lowmode_itidal_dissipation ! Internal tide conversion (from low modes) with
! the schemes of St Laurent et al (2002)/
logical :: Lowmode_itidal_dissipation = .false. ! Internal tide conversion (from low modes)
! with the schemes of St Laurent et al (2002)/
! Simmons et al (2004) !BDM

real :: Nu_Polzin ! The non-dimensional constant used in Polzin form of
Expand All @@ -122,8 +122,8 @@ module MOM_tidal_mixing
real :: kappa_h2_factor ! factor for the product of wavenumber * rms sgs height
character(len=200) :: inputdir

logical :: use_cvmix_tidal ! true if cvmix is to be used for determining diffusivity
! due to tidal mixing
logical :: use_cvmix_tidal = .false. ! true if cvmix is to be used for determining
! diffusivity due to tidal mixing

real :: min_thickness ! Minimum thickness allowed [m]

Expand Down Expand Up @@ -372,6 +372,10 @@ logical function tidal_mixing_init(Time, G, GV, param_file, diag, diag_to_Z_CSp,
call get_param(param_file, mdl, "MIN_ZBOT_ITIDES", CS%min_zbot_itides, &
"Turn off internal tidal dissipation when the total \n"//&
"ocean depth is less than this value.", units="m", default=0.0)
endif

if ( (CS%Int_tide_dissipation .or. CS%Lee_wave_dissipation) .and. &
.not. CS%use_cvmix_tidal) then

call safe_alloc_ptr(CS%Nb,isd,ied,jsd,jed)
call safe_alloc_ptr(CS%h2,isd,ied,jsd,jed)
Expand Down

0 comments on commit dab30b6

Please sign in to comment.