Skip to content

Commit

Permalink
Added function cvmix_conv_is_used and register restart fields.
Browse files Browse the repository at this point in the history
This function allows other modules to know whether this parameterization will
be used without needing to duplicate the log entry. This commit also registers
restart fields when only USE_CVMIX_CONVECTION is used (i.e., all other parame-
terizations associated with vertical mixing are not enabled).
  • Loading branch information
gustavo-marques committed Mar 15, 2018
1 parent 1d850a6 commit ba2a0a4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
20 changes: 10 additions & 10 deletions src/parameterizations/vertical/MOM_cvmix_conv.F90
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module MOM_cvmix_conv

#include <MOM_memory.h>

public cvmix_conv_init, calculate_cvmix_conv, cvmix_conv_end
public cvmix_conv_init, calculate_cvmix_conv, cvmix_conv_end, cvmix_conv_is_used

!> Control structure including parameters for CVMix convection.
type, public :: cvmix_conv_cs
Expand Down Expand Up @@ -244,15 +244,15 @@ subroutine calculate_cvmix_conv(h, tv, G, GV, CS, hbl)

end subroutine calculate_cvmix_conv

! GMM, not sure if we need the code below - DELETE????
!!logical function cvmix_conv_is_used(param_file)
! Reads the parameter "USE_CVMIX_CONVECTION" and returns state.
! This function allows other modules to know whether this parameterization will
! be used without needing to duplicate the log entry.
!! type(param_file_type), intent(in) :: param_file !< A structure to parse for run-time parameters
!! call get_param(param_file, mdl, "USE_CVMIX_CONVECTION", kappa_shear_is_used, &
!! default=.false., do_not_log = .true.)
!!end function cvmix_conv_is_used
!> Reads the parameter "USE_CVMIX_CONVECTION" and returns state.
!! This function allows other modules to know whether this parameterization will
!! be used without needing to duplicate the log entry.
logical function cvmix_conv_is_used(param_file)
type(param_file_type), intent(in) :: param_file !< A structure to parse for run-time parameters
call get_param(param_file, mdl, "USE_CVMIX_CONVECTION", cvmix_conv_is_used, &
default=.false., do_not_log = .true.)

end function cvmix_conv_is_used

!> Clear pointers and dealocate memory
subroutine cvmix_conv_end(CS)
Expand Down
14 changes: 8 additions & 6 deletions src/parameterizations/vertical/MOM_set_viscosity.F90
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ module MOM_set_visc
use MOM_grid, only : ocean_grid_type
use MOM_hor_index, only : hor_index_type
use MOM_kappa_shear, only : kappa_shear_is_used
use MOM_CVMix_shear, only : CVMix_shear_is_used
use MOM_cvmix_shear, only : cvmix_shear_is_used
use MOM_cvmix_conv, only : cvmix_conv_is_used
use MOM_io, only : vardesc, var_desc
use MOM_restart, only : register_restart_field, MOM_restart_CS
use MOM_variables, only : thermo_var_ptrs
Expand Down Expand Up @@ -1783,18 +1784,19 @@ subroutine set_visc_register_restarts(HI, GV, param_file, visc, restart_CS)
! (in) restart_CS - A pointer to the restart control structure.
type(vardesc) :: vd
logical :: use_kappa_shear, adiabatic, useKPP, useEPBL
logical :: use_CVMix, MLE_use_PBL_MLD
logical :: use_cvmix_shear, MLE_use_PBL_MLD, use_cvmix_conv
integer :: isd, ied, jsd, jed, nz
character(len=40) :: mdl = "MOM_set_visc" ! This module's name.
isd = HI%isd ; ied = HI%ied ; jsd = HI%jsd ; jed = HI%jed ; nz = GV%ke

call get_param(param_file, mdl, "ADIABATIC", adiabatic, default=.false., &
do_not_log=.true.)
use_kappa_shear = .false. ; use_CVMix = .false. ;
useKPP = .false. ; useEPBL = .false.
use_kappa_shear = .false. ; use_cvmix_shear = .false. ;
useKPP = .false. ; useEPBL = .false. ; use_cvmix_conv = .false. ;
if (.not.adiabatic) then
use_kappa_shear = kappa_shear_is_used(param_file)
use_CVMix = CVMix_shear_is_used(param_file)
use_cvmix_shear = cvmix_shear_is_used(param_file)
use_cvmix_conv = cvmix_conv_is_used(param_file)
call get_param(param_file, mdl, "USE_KPP", useKPP, &
"If true, turns on the [CVmix] KPP scheme of Large et al., 1984,\n"// &
"to calculate diffusivities and non-local transport in the OBL.", &
Expand All @@ -1805,7 +1807,7 @@ subroutine set_visc_register_restarts(HI, GV, param_file, visc, restart_CS)
"in the surface boundary layer.", default=.false., do_not_log=.true.)
endif

if (use_kappa_shear .or. useKPP .or. useEPBL .or. use_CVMix) then
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%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
Expand Down

0 comments on commit ba2a0a4

Please sign in to comment.