Skip to content

Commit

Permalink
check whether KD, KV and PRANDTL_BKGND are compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
alperaltuntas committed Jun 22, 2018
1 parent 4b2bd2f commit 4884517
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
21 changes: 18 additions & 3 deletions src/parameterizations/vertical/MOM_bkgnd_mixing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ subroutine bkgnd_mixing_init(Time, G, GV, param_file, diag, CS)
type(bkgnd_mixing_cs), pointer :: CS !< This module's control structure.

! Local variables
real :: Kv ! The interior vertical viscosity (m2/s) - read to set prandtl
! number unless it is provided as a parameter
real :: prandtl_bkgnd_default ! Default prandtl number computed according to CS%Kd and Kv

! This include declares and sets the variable "version".
#include "version_variable.h"
Expand All @@ -140,6 +143,11 @@ subroutine bkgnd_mixing_init(Time, G, GV, param_file, diag, CS)
"interior. Zero or the molecular value, ~1e-7 m2 s-1, \n"//&
"may be used.", units="m2 s-1", fail_if_missing=.true.)

call get_param(param_file, mdl, "KV", Kv, &
"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, "KD_MIN", CS%Kd_min, &
"The minimum diapycnal diffusivity.", &
units="m2 s-1", default=0.01*CS%Kd)
Expand Down Expand Up @@ -171,10 +179,17 @@ subroutine bkgnd_mixing_init(Time, G, GV, param_file, diag, CS)

call get_param(param_file, mdl, 'DEBUG', CS%debug, default=.False., do_not_log=.True.)

prandtl_bkgnd_default = Kv/CS%Kd
call get_param(param_file, mdl, "PRANDTL_BKGND", CS%prandtl_bkgnd, &
"Turbulent Prandtl number used to convert vertical \n"//&
"background diffusivities into viscosities.", &
units="nondim", default=1.0)
units="nondim", default=prandtl_bkgnd_default)

if ( abs(Kv-CS%Kd*CS%prandtl_bkgnd)>1.e-14) then
call MOM_error(FATAL,"set_diffusivity_init: The provided KD, KV,"//&
"and PRANDTL_BKGND values are incompatible. The following "//&
"must hold: KD*PRANDTL_BKGND==KV")
endif

! call openParameterBlock(param_file,'MOM_BACKGROUND_MIXING')

Expand Down Expand Up @@ -493,8 +508,8 @@ subroutine check_bkgnd_scheme(CS,str)
if (trim(CS%bkgnd_scheme_str)=="none") then
CS%bkgnd_scheme_str = str
else
call MOM_error(FATAL, "set_diffusivity_init: Cannot activate "//trim(str)//" while \n"//&
trim(CS%bkgnd_scheme_str)//" is already activated.")
call MOM_error(FATAL, "set_diffusivity_init: Cannot activate both "//trim(str)//" and "//&
trim(CS%bkgnd_scheme_str)//".")
endif

end subroutine
Expand Down
5 changes: 0 additions & 5 deletions src/parameterizations/vertical/MOM_set_diffusivity.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1989,11 +1989,6 @@ subroutine set_diffusivity_init(Time, G, GV, param_file, diag, CS, diag_to_Z_CSp
"The molecular value, ~1e-6 m2 s-1, may be used.", &
units="m2 s-1", fail_if_missing=.true.)

if (CS%Kv>1.e-14 .and. CS%bkgnd_mixing_csp%prandtl_bkgnd>1.e-14) then
call MOM_error(FATAL,"set_diffusivity_init: Cannot set both KV and PRANDTL_BKGND "//&
"to nonzero values.")
endif

call get_param(param_file, mdl, "KD", CS%Kd, &
"The background diapycnal diffusivity of density in the \n"//&
"interior. Zero or the molecular value, ~1e-7 m2 s-1, \n"//&
Expand Down

0 comments on commit 4884517

Please sign in to comment.