Skip to content

Commit

Permalink
Replaced Kd_turb -> Kd_shear and Kv_turb -> Kv_shear
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavo-marques committed Mar 30, 2018
1 parent 69ab998 commit 6a2e864
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 41 deletions.
10 changes: 5 additions & 5 deletions src/core/MOM_variables.F90
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ module MOM_variables
!! coefficients, and related fields.
type, public :: vertvisc_type
real :: Prandtl_turb !< The Prandtl number for the turbulent diffusion
!! that is captured in Kd_turb.
!! that is captured in Kd_shear.
real, pointer, dimension(:,:) :: &
bbl_thick_u => NULL(), & !< The bottom boundary layer thickness at the
!! u-points, in m.
Expand Down Expand Up @@ -224,10 +224,10 @@ module MOM_variables
! Kd_extra_S is positive for salt fingering; Kd_extra_T
! is positive for double diffusive convection. These
! are only allocated if DOUBLE_DIFFUSION is true.
Kd_turb => NULL(), &!< The turbulent diapycnal diffusivity at the interfaces
!! between each layer, in m2 s-1.
Kv_turb => NULL(), &!< The turbulent vertical viscosity at the interfaces
!! between each layer, in m2 s-1.
Kd_shear => NULL(), &!< The shear-driven turbulent diapycnal diffusivity
!! at the interfaces between each layer, in m2 s-1.
Kv_shear => NULL(), &!< The shear-driven turbulent vertical viscosity
!! at the interfaces between each layer, in m2 s-1.
TKE_turb => NULL() !< The turbulent kinetic energy per unit mass defined
!! at the interfaces between each layer, in m2 s-2.
end type vertvisc_type
Expand Down
24 changes: 12 additions & 12 deletions src/parameterizations/vertical/MOM_diabatic_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -582,8 +582,8 @@ subroutine diabatic(u, v, h, tv, Hml, fluxes, visc, ADp, CDp, dt, Time_end, G, G

call cpu_clock_begin(id_clock_set_diffusivity)
! Sets: Kd, Kd_int, visc%Kd_extra_T, visc%Kd_extra_S
! Also changes: visc%Kd_turb, visc%TKE_turb (not clear that TKE_turb is used as input ????)
! And sets visc%Kv_turb
! Also changes: visc%Kd_shear, visc%TKE_turb (not clear that TKE_turb is used as input ????
! And sets visc%Kv_shear
call set_diffusivity(u, v, h, u_h, v_h, tv, fluxes, CS%optics, visc, dt, G, GV, CS%set_diff_CSp, Kd, Kd_int)
call cpu_clock_end(id_clock_set_diffusivity)
if (showCallTree) call callTree_waypoint("done with set_diffusivity (diabatic)")
Expand Down Expand Up @@ -632,7 +632,7 @@ subroutine diabatic(u, v, h, tv, Hml, fluxes, visc, ADp, CDp, dt, Time_end, G, G
!$OMP end parallel

call KPP_calculate(CS%KPP_CSp, G, GV, h, tv%T, tv%S, u, v, tv%eqn_of_state, &
fluxes%ustar, CS%KPP_buoy_flux, Kd_heat, Kd_salt, visc%Kv_turb, CS%KPP_NLTheat, CS%KPP_NLTscalar)
fluxes%ustar, CS%KPP_buoy_flux, Kd_heat, Kd_salt, visc%Kv_shear, CS%KPP_NLTheat, CS%KPP_NLTscalar)
!$OMP parallel default(none) shared(is,ie,js,je,nz,Kd_salt,Kd_int,visc,CS,Kd_heat)

if (associated(Hml)) then
Expand Down Expand Up @@ -678,9 +678,9 @@ subroutine diabatic(u, v, h, tv, Hml, fluxes, visc, ADp, CDp, dt, Time_end, G, G
!!!!!!!! GMM, the following needs to be checked !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
do k=1,nz ; do j=js,je ; do i=is,ie
Kd_int(i,j,k) = Kd_int(i,j,k) + CS%cvmix_conv_csp%kd_conv_3d(i,j,k)
! GMM, I am not sure if Kv_turb is the right place to add kv_conv_3d
visc%Kv_turb(i,j,k) = visc%Kv_turb(i,j,k) + CS%cvmix_conv_csp%kv_conv_3d(i,j,k)
visc%Kd_turb(i,j,k) = visc%Kd_turb(i,j,k) + CS%cvmix_conv_csp%kd_conv_3d(i,j,k)
! GMM, I am not sure if Kv_shear is the right place to add kv_conv_3d
visc%Kv_shear(i,j,k) = visc%Kv_shear(i,j,k) + CS%cvmix_conv_csp%kv_conv_3d(i,j,k)
visc%Kd_shear(i,j,k) = visc%Kd_shear(i,j,k) + CS%cvmix_conv_csp%kd_conv_3d(i,j,k)
enddo ; enddo ; enddo
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Expand Down Expand Up @@ -829,10 +829,10 @@ subroutine diabatic(u, v, h, tv, Hml, fluxes, visc, ADp, CDp, dt, Time_end, G, G

if (CS%ePBL_is_additive) then
Kd_add_here = Kd_ePBL(i,j,K)
visc%Kv_turb(i,j,K) = visc%Kv_turb(i,j,K) + Kd_ePBL(i,j,K)
visc%Kv_shear(i,j,K) = visc%Kv_shear(i,j,K) + Kd_ePBL(i,j,K)
else
Kd_add_here = max(Kd_ePBL(i,j,K) - visc%Kd_turb(i,j,K), 0.0)
visc%Kv_turb(i,j,K) = max(visc%Kv_turb(i,j,K), Kd_ePBL(i,j,K))
Kd_add_here = max(Kd_ePBL(i,j,K) - visc%Kd_shear(i,j,K), 0.0)
visc%Kv_shear(i,j,K) = max(visc%Kv_shear(i,j,K), Kd_ePBL(i,j,K))
endif
Ent_int = Kd_add_here * (GV%m_to_H**2 * dt) / &
(0.5*(h(i,j,k-1) + h(i,j,k)) + h_neglect)
Expand Down Expand Up @@ -1365,9 +1365,9 @@ subroutine diabatic(u, v, h, tv, Hml, fluxes, visc, ADp, CDp, dt, Time_end, G, G
call create_group_pass(CS%pass_hold_eb_ea, eb, G%Domain, dir_flag, halo=1)
call create_group_pass(CS%pass_hold_eb_ea, ea, G%Domain, dir_flag, halo=1)
call do_group_pass(CS%pass_hold_eb_ea, G%Domain)
! visc%Kv_turb is not in the group pass because it has larger vertical extent.
if (associated(visc%Kv_turb)) &
call pass_var(visc%Kv_turb, G%Domain, To_All+Omit_Corners, halo=1)
! visc%Kv_shear is not in the group pass because it has larger vertical extent.
if (associated(visc%Kv_shear)) &
call pass_var(visc%Kv_shear, G%Domain, To_All+Omit_Corners, halo=1)
call cpu_clock_end(id_clock_pass)

if (.not. CS%useALEalgorithm) then
Expand Down
6 changes: 3 additions & 3 deletions src/parameterizations/vertical/MOM_kappa_shear.F90
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ module MOM_kappa_shear
real :: TKE_bg ! The background level of TKE, in m2 s-2.
real :: kappa_0 ! The background diapycnal diffusivity, in m2 s-1.
real :: kappa_tol_err ! The fractional error in kappa that is tolerated.
real :: Prandtl_turb ! Prandtl number used to convert Kd_turb into viscosity.
real :: Prandtl_turb ! Prandtl number used to convert Kd_shear into viscosity.
integer :: nkml ! The number of layers in the mixed layer, as
! treated in this routine. If the pieces of the
! mixed layer are not to be treated collectively,
Expand Down Expand Up @@ -130,7 +130,7 @@ subroutine Calculate_kappa_shear(u_in, v_in, h, tv, p_surf, kappa_io, tke_io, &
intent(inout) :: kv_io !< The vertical viscosity at each interface
!! (not layer!) in m2 s-1. This discards any
!! previous value i.e. intent(out) and simply
!! sets Kv = Prandtl * Kd_turb
!! sets Kv = Prandtl * Kd_shear
real, intent(in) :: dt !< Time increment, in s.
type(Kappa_shear_CS), pointer :: CS !< The control structure returned by a previous
!! call to kappa_shear_init.
Expand All @@ -156,7 +156,7 @@ subroutine Calculate_kappa_shear(u_in, v_in, h, tv, p_surf, kappa_io, tke_io, &
! the iteration toward convergence.
! (in/out) kv_io - The vertical viscosity at each interface
! (not layer!) in m2 s-1. This discards any previous value
! i.e. intent(out) and simply sets Kv = Prandtl * Kd_turb
! i.e. intent(out) and simply sets Kv = Prandtl * Kd_shear
! (in) dt - Time increment, in s.
! (in) G - The ocean's grid structure.
! (in) GV - The ocean's vertical grid structure.
Expand Down
26 changes: 13 additions & 13 deletions src/parameterizations/vertical/MOM_set_diffusivity.F90
Original file line number Diff line number Diff line change
Expand Up @@ -461,22 +461,22 @@ subroutine set_diffusivity(u, v, h, u_h, v_h, tv, fluxes, optics, visc, dt, &
call hchksum(v_h, "before calc_KS v_h",G%HI)
endif
call cpu_clock_begin(id_clock_kappaShear)
! Changes: visc%Kd_turb, visc%TKE_turb (not clear that TKE_turb is used as input ????)
! Sets visc%Kv_turb
call calculate_kappa_shear(u_h, v_h, h, tv, fluxes%p_surf, visc%Kd_turb, visc%TKE_turb, &
visc%Kv_turb, dt, G, GV, CS%kappaShear_CSp)
! Changes: visc%Kd_shear, visc%TKE_turb (not clear that TKE_turb is used as input ????)
! Sets visc%Kv_shear
call calculate_kappa_shear(u_h, v_h, h, tv, fluxes%p_surf, visc%Kd_shear, visc%TKE_turb, &
visc%Kv_shear, dt, G, GV, CS%kappaShear_CSp)
call cpu_clock_end(id_clock_kappaShear)
if (CS%debug) then
call hchksum(visc%Kd_turb, "after calc_KS visc%Kd_turb",G%HI)
call hchksum(visc%Kv_turb, "after calc_KS visc%Kv_turb",G%HI)
call hchksum(visc%Kd_shear, "after calc_KS visc%Kd_shear",G%HI)
call hchksum(visc%Kv_shear, "after calc_KS visc%Kv_shear",G%HI)
call hchksum(visc%TKE_turb, "after calc_KS visc%TKE_turb",G%HI)
endif
if (showCallTree) call callTree_waypoint("done with calculate_kappa_shear (set_diffusivity)")
elseif (CS%use_cvmix_shear) then
!NOTE{BGR}: this needs to be cleaned up. It works in 1D case, but has not been tested outside.
call calculate_cvmix_shear(u_h, v_h, h, tv, visc%Kd_turb, visc%Kv_turb,G,GV,CS%cvmix_shear_csp)
elseif (associated(visc%Kv_turb)) then
visc%Kv_turb(:,:,:) = 0. ! needed if calculate_kappa_shear is not enabled
call calculate_cvmix_shear(u_h, v_h, h, tv, visc%Kd_shear, visc%Kv_shear,G,GV,CS%cvmix_shear_csp)
elseif (associated(visc%Kv_shear)) then
visc%Kv_shear(:,:,:) = 0. ! needed if calculate_kappa_shear is not enabled
endif

! Calculate the diffusivity, Kd, for each layer. This would be
Expand Down Expand Up @@ -539,15 +539,15 @@ subroutine set_diffusivity(u, v, h, u_h, v_h, tv, fluxes, optics, visc, dt, &
if (CS%useKappaShear .or. CS%use_cvmix_shear) then
if (present(Kd_int)) then
do K=2,nz ; do i=is,ie
Kd_int(i,j,K) = visc%Kd_turb(i,j,K) + 0.5*(Kd(i,j,k-1) + Kd(i,j,k))
Kd_int(i,j,K) = visc%Kd_shear(i,j,K) + 0.5*(Kd(i,j,k-1) + Kd(i,j,k))
enddo ; enddo
do i=is,ie
Kd_int(i,j,1) = visc%Kd_turb(i,j,1) ! This isn't actually used. It could be 0.
Kd_int(i,j,1) = visc%Kd_shear(i,j,1) ! This isn't actually used. It could be 0.
Kd_int(i,j,nz+1) = 0.0
enddo
endif
do k=1,nz ; do i=is,ie
Kd(i,j,k) = Kd(i,j,k) + 0.5*(visc%Kd_turb(i,j,K) + visc%Kd_turb(i,j,K+1))
Kd(i,j,k) = Kd(i,j,k) + 0.5*(visc%Kd_shear(i,j,K) + visc%Kd_shear(i,j,K+1))
enddo ; enddo
else
if (present(Kd_int)) then
Expand Down Expand Up @@ -635,7 +635,7 @@ subroutine set_diffusivity(u, v, h, u_h, v_h, tv, fluxes, optics, visc, dt, &
!!if (associated(CS%bkgnd_mixing_csp%kv_bkgnd)) &
!! call hchksum(CS%bkgnd_mixing_csp%kv_bkgnd, "kv_bkgnd",G%HI,haloshift=0)

if (CS%useKappaShear) call hchksum(visc%Kd_turb,"Turbulent Kd",G%HI,haloshift=0)
if (CS%useKappaShear) call hchksum(visc%Kd_shear,"Turbulent Kd",G%HI,haloshift=0)

if (associated(visc%kv_bbl_u) .and. associated(visc%kv_bbl_v)) then
call uvchksum("BBL Kv_bbl_[uv]", visc%kv_bbl_u, visc%kv_bbl_v, &
Expand Down
16 changes: 8 additions & 8 deletions src/parameterizations/vertical/MOM_set_viscosity.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1808,20 +1808,20 @@ subroutine set_visc_register_restarts(HI, GV, param_file, visc, restart_CS)
endif

if (use_kappa_shear .or. useKPP .or. useEPBL .or. use_cvmix_shear .or. use_cvmix_conv) then
allocate(visc%Kd_turb(isd:ied,jsd:jed,nz+1)) ; visc%Kd_turb(:,:,:) = 0.0
allocate(visc%Kd_shear(isd:ied,jsd:jed,nz+1)) ; visc%Kd_shear(:,:,:) = 0.0
allocate(visc%TKE_turb(isd:ied,jsd:jed,nz+1)) ; visc%TKE_turb(:,:,:) = 0.0
allocate(visc%Kv_turb(isd:ied,jsd:jed,nz+1)) ; visc%Kv_turb(:,:,:) = 0.0
allocate(visc%Kv_shear(isd:ied,jsd:jed,nz+1)) ; visc%Kv_shear(:,:,:) = 0.0

vd = var_desc("Kd_turb","m2 s-1","Turbulent diffusivity at interfaces", &
vd = var_desc("Kd_shear","m2 s-1","Shear-driven turbulent diffusivity at interfaces", &
hor_grid='h', z_grid='i')
call register_restart_field(visc%Kd_turb, vd, .false., restart_CS)
call register_restart_field(visc%Kd_shear, vd, .false., restart_CS)

vd = var_desc("TKE_turb","m2 s-2","Turbulent kinetic energy per unit mass at interfaces", &
hor_grid='h', z_grid='i')
call register_restart_field(visc%TKE_turb, vd, .false., restart_CS)
vd = var_desc("Kv_turb","m2 s-1","Turbulent viscosity at interfaces", &
vd = var_desc("Kv_shear","m2 s-1","Shear-driven turbulent viscosity at interfaces", &
hor_grid='h', z_grid='i')
call register_restart_field(visc%Kv_turb, vd, .false., restart_CS)
call register_restart_field(visc%Kv_shear, vd, .false., restart_CS)
endif

! visc%MLD is used to communicate the state of the (e)PBL to the rest of the model
Expand Down Expand Up @@ -2092,9 +2092,9 @@ subroutine set_visc_end(visc, CS)
if (CS%dynamic_viscous_ML) then
deallocate(visc%nkml_visc_u) ; deallocate(visc%nkml_visc_v)
endif
if (associated(visc%Kd_turb)) deallocate(visc%Kd_turb)
if (associated(visc%Kd_shear)) deallocate(visc%Kd_shear)
if (associated(visc%TKE_turb)) deallocate(visc%TKE_turb)
if (associated(visc%Kv_turb)) deallocate(visc%Kv_turb)
if (associated(visc%Kv_shear)) deallocate(visc%Kv_shear)
if (associated(visc%ustar_bbl)) deallocate(visc%ustar_bbl)
if (associated(visc%TKE_bbl)) deallocate(visc%TKE_bbl)
if (associated(visc%taux_shelf)) deallocate(visc%taux_shelf)
Expand Down

0 comments on commit 6a2e864

Please sign in to comment.