Skip to content

Commit

Permalink
Merge remote-tracking branch 'gustavo/double_diffusion_cvmix2' into d…
Browse files Browse the repository at this point in the history
…ouble_diffusion_cvmix
  • Loading branch information
gustavo-marques committed May 22, 2018
2 parents 1e6cb67 + bf6c003 commit 884dd3a
Showing 1 changed file with 6 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ logical function CVMix_ddiff_init(Time, G, GV, param_file, diag, CS)
type(diag_ctrl), target, intent(inout) :: diag !< Diagnostics control structure.
type(CVMix_ddiff_cs), pointer :: CS !< This module's control structure.

! Local variables
! real :: prandtl_conv !< Turbulent Prandtl number used in convective instabilities.

! This include declares and sets the variable "version".
#include "version_variable.h"

Expand Down Expand Up @@ -133,11 +130,6 @@ logical function CVMix_ddiff_init(Time, G, GV, param_file, diag, CS)

call closeParameterBlock(param_file)

! allocate arrays and set them to zero
! GMM, dont need the following
!allocate(CS%KT_extra(SZI_(G), SZJ_(G), SZK_(G)+1)); CS%KT_extra(:,:,:) = 0.
!allocate(CS%KS_extra(SZI_(G), SZJ_(G), SZK_(G)+1)); CS%KS_extra(:,:,:) = 0.

! Register diagnostics
CS%diag => diag

Expand Down Expand Up @@ -173,8 +165,6 @@ subroutine compute_ddiff_coeffs(h, tv, G, GV, j, Kd_T, Kd_S, CS)
real, dimension(SZI_(G),SZJ_(G),SZK_(G)), intent(in) :: h !< Layer thickness, in m or kg m-2.
type(thermo_var_ptrs), intent(in) :: tv !< Thermodynamics structure.
real, dimension(SZI_(G),SZJ_(G),SZK_(G)+1), intent(out) :: Kd_T !< Interface double diffusion diapycnal
! real, dimension(:,:,:), pointer :: Kd_T
! real, dimension(:,:,:), pointer :: Kd_S
!! diffusivity for temp (m2/sec).
real, dimension(SZI_(G),SZJ_(G),SZK_(G)+1), intent(out) :: Kd_S !< Interface double diffusion diapycnal
!! diffusivity for salt (m2/sec).
Expand Down Expand Up @@ -209,7 +199,9 @@ subroutine compute_ddiff_coeffs(h, tv, G, GV, j, Kd_T, Kd_S, CS)
! set Kd_T and Kd_S to zero to avoid passing values from previous call
Kd_T(:,j,:) = 0.0; Kd_S(:,j,:) = 0.0

! GMM, check this.
! GMM, I am leaving some code commented below. We need to pass BLD to
! this soubroutine to avoid adding diffusivity above that. This needs
! to be done once we re-structure the order of the calls.
!if (.not. associated(hbl)) then
! allocate(hbl(SZI_(G), SZJ_(G)));
! hbl(:,:) = 0.0
Expand Down Expand Up @@ -239,9 +231,9 @@ subroutine compute_ddiff_coeffs(h, tv, G, GV, j, Kd_T, Kd_S, CS)

call calculate_density_derivs(temp_int(:), salt_int(:), pres_int(:), drho_dT(:), drho_dS(:), 1, G%ke, TV%EQN_OF_STATE)

! GMM, explain need for -1 in front of alpha
! if ((alpha_dT > beta_dS) .and. (beta_dS > 0.0)) then ! salt finger case
! if ((alpha_dT < 0.) .and. (beta_dS < 0.) .and. (alpha_dT > beta_dS)) then ! diffusive convection
! The "-1.0" below is needed so that the following criteria is satisfied:
! if ((alpha_dT > beta_dS) .and. (beta_dS > 0.0)) then "salt finger"
! if ((alpha_dT < 0.) .and. (beta_dS < 0.) .and. (alpha_dT > beta_dS)) then "diffusive convection"
do k=1,G%ke
alpha_dT(k) = -1.0*drho_dT(k) * dT(k)
beta_dS(k) = drho_dS(k) * dS(k)
Expand Down Expand Up @@ -277,13 +269,6 @@ subroutine compute_ddiff_coeffs(h, tv, G, GV, j, Kd_T, Kd_S, CS)
nlev=G%ke, &
max_nlev=G%ke)

!if (is_root_pe()) then
! write(*,*)'drho_dT, alpha_dT', &
! drho_dT(:), alpha_dT(:)
! write(*,*)'drho_dS, beta_dS', &
! drho_dS(:), beta_dS(:)
!endif

! Do not apply mixing due to convection within the boundary layer
!do k=1,kOBL
! Kd_T(i,j,k) = 0.0
Expand Down

0 comments on commit 884dd3a

Please sign in to comment.