Skip to content

Commit

Permalink
Fix incorrect limiter in FULL_DEPTH_KHTR_MIN implementation (#318)
Browse files Browse the repository at this point in the history
The initial implementation of FULL_DEPTH_KHTR_MIN was incorrect.
CS%KhTr_min [L2 T-1] was used to limit Coef_y/Coef_x [L2 or H L2]
and this was wrong. Here is the (wrong) example at v-points:

Coef_y = max(Coef_y, KhTr_min)

This patch fixes this bug by introducing a local limiting value
for Coef_x and Coef_y, Coef_min [L2 or H L2]:

Coef_min = I_numitts * dt * (KhTr_min*(dx_Cv*IdyCv))

The correct limit is then:

Coef_y = max(Coef_y, Coef_min)
  • Loading branch information
gustavo-marques authored Oct 31, 2024
1 parent a73cd49 commit c9dab57
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/tracer/MOM_tracer_hor_diff.F90
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ subroutine tracer_hordiff(h, dt, MEKE, VarMix, visc, G, GV, US, CS, Reg, tv, do_
Kh_v ! Tracer mixing coefficient at u-points [L2 T-1 ~> m2 s-1].

real :: khdt_max ! The local limiting value of khdt_x or khdt_y [L2 ~> m2].
real :: max_CFL ! The global maximum of the diffusive CFL number [nondim]
real :: Coef_min ! The local limiting value of Coef_x or Coef_y, in [L2 ~> m2] for some
! schemes and [H L2 ~> m3 or kg] for others.
real :: max_CFL ! The global maximum of the diffusive CFL number [nondim]
logical :: use_VarMix, Resoln_scaled, do_online, use_Eady
integer :: i, j, k, m, is, ie, js, je, nz, ntr, itt, num_itts
real :: I_numitts ! The inverse of the number of iterations, num_itts [nondim]
Expand Down Expand Up @@ -431,15 +433,17 @@ subroutine tracer_hordiff(h, dt, MEKE, VarMix, visc, G, GV, US, CS, Reg, tv, do_
do J=js-1,je
do i=is,ie
Coef_y(i,J,K) = Coef_y(i,J,1) * 0.5 * ( VarMix%ebt_struct(i,j,k-1) + VarMix%ebt_struct(i,j+1,k-1) )
Coef_y(i,J,K) = max(Coef_y(i,J,K), CS%KhTr_min)
Coef_min = I_numitts * dt * (CS%KhTr_min*(G%dx_Cv(i,J)*G%IdyCv(i,J)))
Coef_y(i,J,K) = max(Coef_y(i,J,K), Coef_min)
enddo
enddo
enddo
do k=2,nz+1
do j=js,je
do I=is-1,ie
Coef_x(I,j,K) = Coef_x(I,j,1) * 0.5 * ( VarMix%ebt_struct(i,j,k-1) + VarMix%ebt_struct(i+1,j,k-1) )
Coef_x(I,j,K) = max(Coef_x(I,j,K), CS%KhTr_min)
Coef_min = I_numitts * dt * (CS%KhTr_min*(G%dy_Cu(I,j)*G%IdxCu(I,j)))
Coef_x(I,j,K) = max(Coef_x(I,j,K), Coef_min)
enddo
enddo
enddo
Expand Down

0 comments on commit c9dab57

Please sign in to comment.