Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to avoid negative MEKE #279

Merged
merged 4 commits into from
May 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/parameterizations/lateral/MOM_MEKE.F90
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ module MOM_MEKE
!! first baroclinic deformation radius.
logical :: use_old_lscale !< Use the old formula for mixing length scale.
logical :: use_min_lscale !< Use simple minimum for mixing length scale.
logical :: MEKE_positive !< If true, it guarantees that MEKE will always be >= 0.
real :: lscale_maxval !< The ceiling on the MEKE mixing length scale when use_min_lscale is true [L ~> m].
real :: cdrag !< The bottom drag coefficient for MEKE, times rescaling factors [H L-1 ~> nondim or kg m-3]
real :: MEKE_BGsrc !< Background energy source for MEKE [L2 T-3 ~> W kg-1] (= m2 s-3).
Expand Down Expand Up @@ -648,6 +649,13 @@ subroutine step_forward_MEKE(MEKE, h, SN_u, SN_v, visc, dt, G, GV, US, CS, hu, h
call MOM_error(FATAL,"Invalid method specified for calculating EKE")
end select

if (CS%MEKE_positive) then
!$OMP parallel do default(shared)
do j=js,je ; do i=is,ie
MEKE%MEKE(i,j) = MAX(0., MEKE%MEKE(i,j))
enddo ; enddo
endif

call cpu_clock_begin(CS%id_clock_pass)
call do_group_pass(CS%pass_MEKE, G%Domain)
call cpu_clock_end(CS%id_clock_pass)
Expand Down Expand Up @@ -1228,6 +1236,9 @@ logical function MEKE_init(Time, G, GV, US, param_file, diag, dbcomms_CS, CS, ME
call get_param(param_file, mdl, "MEKE_DTSCALE", CS%MEKE_dtScale, &
"A scaling factor to accelerate the time evolution of MEKE.", &
units="nondim", default=1.0)
call get_param(param_file, mdl, "MEKE_POSITIVE", CS%MEKE_positive, &
"If true, it guarantees that MEKE will always be >= 0.", &
default=.false.)
case("dbclient")
CS%eke_src = EKE_DBCLIENT
call ML_MEKE_init(diag, G, US, Time, param_file, dbcomms_CS, CS)
Expand Down
Loading