Skip to content

Commit

Permalink
Add a flag to control if visc%Kv_slow is used
Browse files Browse the repository at this point in the history
This commit adds a flag ADD_KV_SLOW (default is FALSE) that controls if
the background vertical viscosity in the interior (i.e., tidal + background
+ shear + convenction) is addded when computing the coupling coefficient.
The purpose of this flag is to be able to recover previous answers and it will
likely be removed in the future since this option should always be true.
  • Loading branch information
gustavo-marques committed May 21, 2018
1 parent 148a944 commit 70d88e4
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 43 deletions.
3 changes: 3 additions & 0 deletions src/core/MOM_variables.F90
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ module MOM_variables
!! convection etc).
TKE_turb => NULL() !< The turbulent kinetic energy per unit mass defined
!! at the interfaces between each layer, in m2 s-2.
logical :: add_Kv_slow !< If True, adds Kv_slow when calculating the
!! 'coupling coefficient' (a[k]) at the interfaces.
!! This is done in find_coupling_coef.
end type vertvisc_type

!> The BT_cont_type structure contains information about the summed layer
Expand Down
86 changes: 44 additions & 42 deletions src/parameterizations/vertical/MOM_set_viscosity.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,6 @@ module MOM_set_visc

! This file is part of MOM6. See LICENSE.md for the license.

!********+*********+*********+*********+*********+*********+*********+**
!* *
!* By Robert Hallberg, April 1994 - October 2006 *
!* Quadratic Bottom Drag by James Stephens and R. Hallberg. *
!* *
!* This file contains the subroutine that calculates various values *
!* related to the bottom boundary layer, such as the viscosity and *
!* thickness of the BBL (set_viscous_BBL). This would also be the *
!* module in which other viscous quantities that are flow-independent *
!* might be set. This information is transmitted to other modules *
!* via a vertvisc type structure. *
!* *
!* The same code is used for the two velocity components, by *
!* indirectly referencing the velocities and defining a handful of *
!* direction-specific defined variables. *
!* *
!* Macros written all in capital letters are defined in MOM_memory.h. *
!* *
!* A small fragment of the grid is shown below: *
!* *
!* j+1 x ^ x ^ x At x: q *
!* j+1 > o > o > At ^: v, frhatv, tauy *
!* j x ^ x ^ x At >: u, frhatu, taux *
!* j > o > o > At o: h *
!* j-1 x ^ x ^ x *
!* i-1 i i+1 At x & ^: *
!* i i+1 At > & o: *
!* *
!* The boundaries always run through q grid points (x). *
!* *
!********+*********+*********+*********+*********+*********+*********+**

use MOM_debugging, only : uvchksum, hchksum
use MOM_cpu_clock, only : cpu_clock_id, cpu_clock_begin, cpu_clock_end, CLOCK_ROUTINE
use MOM_diag_mediator, only : post_data, register_diag_field, safe_alloc_ptr
Expand Down Expand Up @@ -1859,16 +1827,8 @@ subroutine set_visc_init(Time, G, GV, param_file, diag, visc, CS, OBC)
type(set_visc_CS), pointer :: CS !< A pointer that is set to point to the control
!! structure for this module
type(ocean_OBC_type), pointer :: OBC
! Arguments: Time - The current model time.
! (in) G - The ocean's grid structure.
! (in) GV - The ocean's vertical grid structure.
! (in) param_file - A structure indicating the open file to parse for
! model parameter values.
! (in) diag - A structure that is used to regulate diagnostic output.
! (out) visc - A structure containing vertical viscosities and related
! fields. Allocated here.
! (in/out) CS - A pointer that is set to point to the control structure
! for this module

! local variables
real :: Csmag_chan_dflt, smag_const1, TKE_decay_dflt, bulk_Ri_ML_dflt
real :: Kv_background
real :: omega_frac_dflt
Expand Down Expand Up @@ -2020,6 +1980,15 @@ subroutine set_visc_init(Time, G, GV, param_file, diag, visc, CS, OBC)
"The background kinematic viscosity in the interior. \n"//&
"The molecular value, ~1e-6 m2 s-1, may be used.", &
units="m2 s-1", fail_if_missing=.true.)

call get_param(param_file, mdl, "ADD_KV_SLOW", visc%add_Kv_slow, &
"If true, the background vertical viscosity in the interior \n"//&
"(i.e., tidal + background + shear + convenction) is addded \n"// &
"when computing the coupling coefficient. The purpose of this \n"// &
"flag is to be able to recover previous answers and it will likely \n"// &
"be removed in the future since this option should always be true.", &
default=.false.)

call get_param(param_file, mdl, "KV_BBL_MIN", CS%KV_BBL_min, &
"The minimum viscosities in the bottom boundary layer.", &
units="m2 s-1", default=Kv_background)
Expand Down Expand Up @@ -2117,4 +2086,37 @@ subroutine set_visc_end(visc, CS)
deallocate(CS)
end subroutine set_visc_end

!> \namespace MOM_set_visc
!!********+*********+*********+*********+*********+*********+*********+**
!!* *
!!* By Robert Hallberg, April 1994 - October 2006 *
!!* Quadratic Bottom Drag by James Stephens and R. Hallberg. *
!!* *
!!* This file contains the subroutine that calculates various values *
!!* related to the bottom boundary layer, such as the viscosity and *
!!* thickness of the BBL (set_viscous_BBL). This would also be the *
!!* module in which other viscous quantities that are flow-independent *
!!* might be set. This information is transmitted to other modules *
!!* via a vertvisc type structure. *
!!* *
!!* The same code is used for the two velocity components, by *
!!* indirectly referencing the velocities and defining a handful of *
!!* direction-specific defined variables. *
!!* *
!!* Macros written all in capital letters are defined in MOM_memory.h. *
!!* *
!!* A small fragment of the grid is shown below: *
!!* *
!!* j+1 x ^ x ^ x At x: q *
!!* j+1 > o > o > At ^: v, frhatv, tauy *
!!* j x ^ x ^ x At >: u, frhatu, taux *
!!* j > o > o > At o: h *
!!* j-1 x ^ x ^ x *
!!* i-1 i i+1 At x & ^: *
!!* i i+1 At > & o: *
!!* *
!!* The boundaries always run through q grid points (x). *
!!* *
!!********+*********+*********+*********+*********+*********+*********+**

end module MOM_set_visc
2 changes: 1 addition & 1 deletion src/parameterizations/vertical/MOM_vert_friction.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ subroutine find_coupling_coef(a, hvel, do_i, h_harm, bbl_thick, kv_bbl, z_i, h_m
endif

! add "slow" varying vertical viscosity (e.g., from background, tidal etc)
if (associated(visc%Kv_slow)) then
if (associated(visc%Kv_slow) .and. (visc%add_Kv_slow)) then
! GMM/ A factor of 2 is also needed here, see comment above from BGR.
if (work_on_u) then
do K=2,nz ; do i=is,ie ; if (do_i(i)) then
Expand Down

0 comments on commit 70d88e4

Please sign in to comment.