Skip to content

Commit 39ab7d5

Browse files
committed
+Add the new parameter RESOLN_FUNCTION_OBC_BUG
Added the new runtime parameter RESOLN_FUNCTION_OBC_BUG that can be set to false to take open boundary conditions into account when calculating the resolution functions at u-, v- or q-points. By default the wave speeds used to calculate resolution functions do not take OBCs into account and all answers are bitwise identical.
1 parent 665c760 commit 39ab7d5

File tree

1 file changed

+147
-79
lines changed

1 file changed

+147
-79
lines changed

src/parameterizations/lateral/MOM_lateral_mixing_coeffs.F90

Lines changed: 147 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ module MOM_lateral_mixing_coeffs
8383
!! interface heights as a proxy for isopycnal slopes.
8484
logical :: OBC_friendly !< If true, use only interior data for thickness weighting and
8585
!! to calculate stratification and other fields at open boundary
86-
!! condition faces.
86+
!! condition faces.
87+
logical :: res_fn_OBC_bug !< If false, use only interior data for calculating the resolution
88+
!! functions at open boundary condition faces and vertices.
8789
real :: cropping_distance !< Distance from surface or bottom to filter out outcropped or
8890
!! incropped interfaces for the Eady growth rate calc [Z ~> m]
8991
real :: h_min_N2 !< The minimum vertical distance to use in the denominator of the
@@ -246,10 +248,11 @@ subroutine calc_resoln_function(h, tv, G, GV, US, CS, MEKE, OBC, dt)
246248
! Local variables
247249
! Depending on the power-function being used, dimensional rescaling may be limited, so some
248250
! of the following variables have units that depend on that power.
249-
real :: cg1_q ! The gravity wave speed interpolated to q points [L T-1 ~> m s-1] or [m s-1].
250-
real :: cg1_u ! The gravity wave speed interpolated to u points [L T-1 ~> m s-1] or [m s-1].
251-
real :: cg1_v ! The gravity wave speed interpolated to v points [L T-1 ~> m s-1] or [m s-1].
251+
real :: cg1_q(SZIB_(G),SZJB_(G)) ! The gravity wave speed interpolated to q points [L T-1 ~> m s-1] or [m s-1].
252+
real :: cg1_u(SZIB_(G),SZJ_(G)) ! The gravity wave speed interpolated to u points [L T-1 ~> m s-1] or [m s-1].
253+
real :: cg1_v(SZI_(G),SZJB_(G)) ! The gravity wave speed interpolated to v points [L T-1 ~> m s-1] or [m s-1].
252254
real :: dx_term ! A term in the denominator [L2 T-2 ~> m2 s-2] or [m2 s-2]
255+
logical :: apply_u_OBC, apply_v_OBC ! If true, OBCs will be used to set the wave speed at some points on this PE.
253256
integer :: power_2
254257
integer :: is, ie, js, je, Isq, Ieq, Jsq, Jeq, nz
255258
integer :: i, j, k
@@ -371,13 +374,40 @@ subroutine calc_resoln_function(h, tv, G, GV, US, CS, MEKE, OBC, dt)
371374
if (.not. allocated(CS%beta_dx2_v)) call MOM_error(FATAL, &
372375
"calc_resoln_function: %beta_dx2_v is not associated with Resoln_scaled_Kh.")
373376

377+
apply_u_OBC = .false. ; apply_v_OBC = .false.
378+
if (associated(OBC) .and. (.not.CS%res_fn_OBC_bug)) then
379+
apply_u_OBC = OBC%u_OBCs_on_PE
380+
apply_v_OBC = OBC%v_OBCs_on_PE
381+
endif
382+
383+
!$OMP parallel default(shared) private(dx_term,power_2)
384+
385+
if (apply_u_OBC .or. apply_v_OBC) then
386+
!$OMP do
387+
do J=js-1,Jeq ; do I=is-1,Ieq
388+
if ((OBC%segnum_u(I,j) /= 0) .or. (OBC%segnum_u(I,j+1) /= 0) .or. &
389+
(OBC%segnum_v(i,J) /= 0) .or. (OBC%segnum_u(i+1,J) /= 0)) then
390+
! This is an OBC node, so use the fact that G%mask2dT is zero behind OBCs. The nondimensional
391+
! constant 1e-20 in the denominator makes this a de facto implementation of Adcroft's reciprocal
392+
! rule with a value that works for either 64-bit or 32-bit real numbers.
393+
cg1_q(I,J) = ((G%mask2dT(i,j) * CS%cg1(i,j) + G%mask2dT(i+1,j+1) * CS%cg1(i+1,j+1)) + &
394+
(G%mask2dT(i+1,j) * CS%cg1(i+1,j) + G%mask2dT(i,j+1) * CS%cg1(i,j+1))) / &
395+
((G%mask2dT(i,j) + G%mask2dT(i+1,j+1)) + (G%mask2dT(i+1,j) + G%mask2dT(i,j+1)) + 1.0e-20)
396+
else
397+
cg1_q(I,J) = 0.25 * ((CS%cg1(i,j) + CS%cg1(i+1,j+1)) + (CS%cg1(i+1,j) + CS%cg1(i,j+1)))
398+
endif
399+
enddo ; enddo
400+
else
401+
!$OMP do
402+
do J=js-1,Jeq ; do I=is-1,Ieq
403+
cg1_q(I,J) = 0.25 * ((CS%cg1(i,j) + CS%cg1(i+1,j+1)) + (CS%cg1(i+1,j) + CS%cg1(i,j+1)))
404+
enddo ; enddo
405+
endif
406+
374407
! Do this calculation on the extent used in MOM_hor_visc.F90, and
375408
! MOM_tracer.F90 so that no halo update is needed.
376-
377-
!$OMP parallel default(none) shared(is,ie,js,je,Ieq,Jeq,CS,US) &
378-
!$OMP private(dx_term,cg1_q,power_2,cg1_u,cg1_v)
379409
if (CS%Res_fn_power_visc >= 100) then
380-
!$OMP do
410+
!$OMP do
381411
do j=js-1,je+1 ; do i=is-1,ie+1
382412
dx_term = CS%f2_dx2_h(i,j) + CS%cg1(i,j)*CS%beta_dx2_h(i,j)
383413
if ((CS%Res_coef_visc * CS%cg1(i,j))**2 > dx_term) then
@@ -386,139 +416,173 @@ subroutine calc_resoln_function(h, tv, G, GV, US, CS, MEKE, OBC, dt)
386416
CS%Res_fn_h(i,j) = 1.0
387417
endif
388418
enddo ; enddo
389-
!$OMP do
419+
!$OMP do
390420
do J=js-1,Jeq ; do I=is-1,Ieq
391-
cg1_q = 0.25 * ((CS%cg1(i,j) + CS%cg1(i+1,j+1)) + (CS%cg1(i+1,j) + CS%cg1(i,j+1)))
392-
dx_term = CS%f2_dx2_q(I,J) + cg1_q * CS%beta_dx2_q(I,J)
393-
if ((CS%Res_coef_visc * cg1_q)**2 > dx_term) then
421+
dx_term = CS%f2_dx2_q(I,J) + cg1_q(I,J) * CS%beta_dx2_q(I,J)
422+
if ((CS%Res_coef_visc * cg1_q(I,J))**2 > dx_term) then
394423
CS%Res_fn_q(I,J) = 0.0
395424
else
396425
CS%Res_fn_q(I,J) = 1.0
397426
endif
398427
enddo ; enddo
399428
elseif (CS%Res_fn_power_visc == 2) then
400-
!$OMP do
429+
!$OMP do
401430
do j=js-1,je+1 ; do i=is-1,ie+1
402431
dx_term = CS%f2_dx2_h(i,j) + CS%cg1(i,j)*CS%beta_dx2_h(i,j)
403432
CS%Res_fn_h(i,j) = dx_term / (dx_term + (CS%Res_coef_visc * CS%cg1(i,j))**2)
404433
enddo ; enddo
405-
!$OMP do
434+
!$OMP do
406435
do J=js-1,Jeq ; do I=is-1,Ieq
407-
cg1_q = 0.25 * ((CS%cg1(i,j) + CS%cg1(i+1,j+1)) + (CS%cg1(i+1,j) + CS%cg1(i,j+1)))
408-
dx_term = CS%f2_dx2_q(I,J) + cg1_q * CS%beta_dx2_q(I,J)
409-
CS%Res_fn_q(I,J) = dx_term / (dx_term + (CS%Res_coef_visc * cg1_q)**2)
436+
dx_term = CS%f2_dx2_q(I,J) + cg1_q(I,J) * CS%beta_dx2_q(I,J)
437+
CS%Res_fn_q(I,J) = dx_term / (dx_term + (CS%Res_coef_visc * cg1_q(I,J))**2)
410438
enddo ; enddo
411439
elseif (mod(CS%Res_fn_power_visc, 2) == 0) then
412440
power_2 = CS%Res_fn_power_visc / 2
413-
!$OMP do
441+
!$OMP do
414442
do j=js-1,je+1 ; do i=is-1,ie+1
415443
dx_term = (US%L_T_to_m_s**2*(CS%f2_dx2_h(i,j) + CS%cg1(i,j)*CS%beta_dx2_h(i,j)))**power_2
416444
CS%Res_fn_h(i,j) = dx_term / &
417445
(dx_term + (CS%Res_coef_visc * US%L_T_to_m_s*CS%cg1(i,j))**CS%Res_fn_power_visc)
418446
enddo ; enddo
419-
!$OMP do
447+
!$OMP do
420448
do J=js-1,Jeq ; do I=is-1,Ieq
421-
cg1_q = 0.25 * ((CS%cg1(i,j) + CS%cg1(i+1,j+1)) + (CS%cg1(i+1,j) + CS%cg1(i,j+1)))
422-
dx_term = (US%L_T_to_m_s**2*(CS%f2_dx2_q(I,J) + cg1_q * CS%beta_dx2_q(I,J)))**power_2
449+
dx_term = (US%L_T_to_m_s**2*(CS%f2_dx2_q(I,J) + cg1_q(I,J) * CS%beta_dx2_q(I,J)))**power_2
423450
CS%Res_fn_q(I,J) = dx_term / &
424-
(dx_term + (CS%Res_coef_visc * US%L_T_to_m_s*cg1_q)**CS%Res_fn_power_visc)
451+
(dx_term + (CS%Res_coef_visc * US%L_T_to_m_s*cg1_q(I,J))**CS%Res_fn_power_visc)
425452
enddo ; enddo
426453
else
427-
!$OMP do
454+
!$OMP do
428455
do j=js-1,je+1 ; do i=is-1,ie+1
429456
dx_term = (US%L_T_to_m_s*sqrt(CS%f2_dx2_h(i,j) + &
430457
CS%cg1(i,j)*CS%beta_dx2_h(i,j)))**CS%Res_fn_power_visc
431458
CS%Res_fn_h(i,j) = dx_term / &
432459
(dx_term + (CS%Res_coef_visc * US%L_T_to_m_s*CS%cg1(i,j))**CS%Res_fn_power_visc)
433460
enddo ; enddo
434-
!$OMP do
461+
!$OMP do
435462
do J=js-1,Jeq ; do I=is-1,Ieq
436-
cg1_q = 0.25 * ((CS%cg1(i,j) + CS%cg1(i+1,j+1)) + (CS%cg1(i+1,j) + CS%cg1(i,j+1)))
437463
dx_term = (US%L_T_to_m_s*sqrt(CS%f2_dx2_q(I,J) + &
438-
cg1_q * CS%beta_dx2_q(I,J)))**CS%Res_fn_power_visc
464+
cg1_q(I,J) * CS%beta_dx2_q(I,J)))**CS%Res_fn_power_visc
439465
CS%Res_fn_q(I,J) = dx_term / &
440-
(dx_term + (CS%Res_coef_visc * US%L_T_to_m_s*cg1_q)**CS%Res_fn_power_visc)
466+
(dx_term + (CS%Res_coef_visc * US%L_T_to_m_s*cg1_q(I,J))**CS%Res_fn_power_visc)
441467
enddo ; enddo
442468
endif
443469

444470
if (CS%interpolate_Res_fn) then
445-
do j=js,je ; do I=is-1,Ieq
446-
CS%Res_fn_u(I,j) = 0.5*(CS%Res_fn_h(i,j) + CS%Res_fn_h(i+1,j))
447-
enddo ; enddo
448-
do J=js-1,Jeq ; do i=is,ie
449-
CS%Res_fn_v(i,J) = 0.5*(CS%Res_fn_h(i,j) + CS%Res_fn_h(i,j+1))
450-
enddo ; enddo
471+
if (apply_u_OBC) then
472+
do j=js,je ; do I=is-1,Ieq
473+
CS%Res_fn_u(I,j) = 0.5*(CS%Res_fn_h(i,j) + CS%Res_fn_h(i+1,j))
474+
if (OBC%segnum_u(I,j) > 0) CS%Res_fn_u(I,j) = CS%Res_fn_h(i,j) ! Eastern OBC
475+
if (OBC%segnum_u(I,j) < 0) CS%Res_fn_u(I,j) = CS%Res_fn_h(i+1,j) ! Western OBC
476+
enddo ; enddo
477+
else
478+
do j=js,je ; do I=is-1,Ieq
479+
CS%Res_fn_u(I,j) = 0.5*(CS%Res_fn_h(i,j) + CS%Res_fn_h(i+1,j))
480+
enddo ; enddo
481+
endif
482+
483+
if (apply_v_OBC) then
484+
do J=js-1,Jeq ; do i=is,ie
485+
CS%Res_fn_v(i,J) = 0.5*(CS%Res_fn_h(i,j) + CS%Res_fn_h(i,j+1))
486+
if (OBC%segnum_v(i,J) > 0) CS%Res_fn_v(i,J) = CS%Res_fn_h(i,j) ! Northern OBC
487+
if (OBC%segnum_v(i,J) < 0) CS%Res_fn_v(i,J) = CS%Res_fn_h(i,j+1) ! Southern OBC
488+
enddo ; enddo
489+
else
490+
do J=js-1,Jeq ; do i=is,ie
491+
CS%Res_fn_v(i,J) = 0.5*(CS%Res_fn_h(i,j) + CS%Res_fn_h(i,j+1))
492+
enddo ; enddo
493+
endif
494+
451495
else ! .not.CS%interpolate_Res_fn
496+
if (apply_u_OBC) then
497+
!$OMP do
498+
do j=js,je ; do I=is-1,Ieq
499+
cg1_u(I,j) = 0.5 * (CS%cg1(i,j) + CS%cg1(i+1,j))
500+
if (OBC%segnum_u(I,j) > 0) cg1_u(I,j) = CS%cg1(i,j) ! Eastern OBC
501+
if (OBC%segnum_u(I,j) < 0) cg1_u(I,j) = CS%cg1(i+1,j) ! Western OBC
502+
enddo ; enddo
503+
else
504+
!$OMP do
505+
do j=js,je ; do I=is-1,Ieq
506+
cg1_u(I,j) = 0.5 * (CS%cg1(i,j) + CS%cg1(i+1,j))
507+
enddo ; enddo
508+
endif
509+
510+
if (apply_v_OBC) then
511+
!$OMP do
512+
do J=js-1,Jeq ; do i=is,ie
513+
cg1_v(i,J) = 0.5 * (CS%cg1(i,j) + CS%cg1(i,j+1))
514+
if (OBC%segnum_v(i,J) > 0) cg1_v(i,J) = CS%cg1(i,j) ! Northern OBC
515+
if (OBC%segnum_v(i,J) < 0) cg1_v(i,J) = CS%cg1(i,j+1) ! Southern OBC
516+
enddo ; enddo
517+
else
518+
!$OMP do
519+
do J=js-1,Jeq ; do i=is,ie
520+
cg1_v(i,J) = 0.5 * (CS%cg1(i,j) + CS%cg1(i,j+1))
521+
enddo ; enddo
522+
endif
523+
452524
if (CS%Res_fn_power_khth >= 100) then
453-
!$OMP do
525+
!$OMP do
454526
do j=js,je ; do I=is-1,Ieq
455-
cg1_u = 0.5 * (CS%cg1(i,j) + CS%cg1(i+1,j))
456-
dx_term = CS%f2_dx2_u(I,j) + cg1_u * CS%beta_dx2_u(I,j)
457-
if ((CS%Res_coef_khth * cg1_u)**2 > dx_term) then
527+
dx_term = CS%f2_dx2_u(I,j) + cg1_u(I,j) * CS%beta_dx2_u(I,j)
528+
if ((CS%Res_coef_khth * cg1_u(I,j))**2 > dx_term) then
458529
CS%Res_fn_u(I,j) = 0.0
459530
else
460531
CS%Res_fn_u(I,j) = 1.0
461532
endif
462533
enddo ; enddo
463-
!$OMP do
534+
!$OMP do
464535
do J=js-1,Jeq ; do i=is,ie
465-
cg1_v = 0.5 * (CS%cg1(i,j) + CS%cg1(i,j+1))
466-
dx_term = CS%f2_dx2_v(i,J) + cg1_v * CS%beta_dx2_v(i,J)
467-
if ((CS%Res_coef_khth * cg1_v)**2 > dx_term) then
536+
dx_term = CS%f2_dx2_v(i,J) + cg1_v(i,J) * CS%beta_dx2_v(i,J)
537+
if ((CS%Res_coef_khth * cg1_v(i,J))**2 > dx_term) then
468538
CS%Res_fn_v(i,J) = 0.0
469539
else
470540
CS%Res_fn_v(i,J) = 1.0
471541
endif
472542
enddo ; enddo
473543
elseif (CS%Res_fn_power_khth == 2) then
474-
!$OMP do
544+
!$OMP do
475545
do j=js,je ; do I=is-1,Ieq
476-
cg1_u = 0.5 * (CS%cg1(i,j) + CS%cg1(i+1,j))
477-
dx_term = CS%f2_dx2_u(I,j) + cg1_u * CS%beta_dx2_u(I,j)
478-
CS%Res_fn_u(I,j) = dx_term / (dx_term + (CS%Res_coef_khth * cg1_u)**2)
546+
dx_term = CS%f2_dx2_u(I,j) + cg1_u(I,j) * CS%beta_dx2_u(I,j)
547+
CS%Res_fn_u(I,j) = dx_term / (dx_term + (CS%Res_coef_khth * cg1_u(I,j))**2)
479548
enddo ; enddo
480-
!$OMP do
549+
!$OMP do
481550
do J=js-1,Jeq ; do i=is,ie
482-
cg1_v = 0.5 * (CS%cg1(i,j) + CS%cg1(i,j+1))
483-
dx_term = CS%f2_dx2_v(i,J) + cg1_v * CS%beta_dx2_v(i,J)
484-
CS%Res_fn_v(i,J) = dx_term / (dx_term + (CS%Res_coef_khth * cg1_v)**2)
551+
dx_term = CS%f2_dx2_v(i,J) + cg1_v(i,J) * CS%beta_dx2_v(i,J)
552+
CS%Res_fn_v(i,J) = dx_term / (dx_term + (CS%Res_coef_khth * cg1_v(i,J))**2)
485553
enddo ; enddo
486554
elseif (mod(CS%Res_fn_power_khth, 2) == 0) then
487555
power_2 = CS%Res_fn_power_khth / 2
488-
!$OMP do
556+
!$OMP do
489557
do j=js,je ; do I=is-1,Ieq
490-
cg1_u = 0.5 * (CS%cg1(i,j) + CS%cg1(i+1,j))
491-
dx_term = (US%L_T_to_m_s**2 * (CS%f2_dx2_u(I,j) + cg1_u * CS%beta_dx2_u(I,j)))**power_2
558+
dx_term = (US%L_T_to_m_s**2 * (CS%f2_dx2_u(I,j) + cg1_u(I,j) * CS%beta_dx2_u(I,j)))**power_2
492559
CS%Res_fn_u(I,j) = dx_term / &
493-
(dx_term + (CS%Res_coef_khth * US%L_T_to_m_s*cg1_u)**CS%Res_fn_power_khth)
560+
(dx_term + (CS%Res_coef_khth * US%L_T_to_m_s*cg1_u(I,j))**CS%Res_fn_power_khth)
494561
enddo ; enddo
495-
!$OMP do
562+
!$OMP do
496563
do J=js-1,Jeq ; do i=is,ie
497-
cg1_v = 0.5 * (CS%cg1(i,j) + CS%cg1(i,j+1))
498-
dx_term = (US%L_T_to_m_s**2 * (CS%f2_dx2_v(i,J) + cg1_v * CS%beta_dx2_v(i,J)))**power_2
564+
dx_term = (US%L_T_to_m_s**2 * (CS%f2_dx2_v(i,J) + cg1_v(i,J) * CS%beta_dx2_v(i,J)))**power_2
499565
CS%Res_fn_v(i,J) = dx_term / &
500-
(dx_term + (CS%Res_coef_khth * US%L_T_to_m_s*cg1_v)**CS%Res_fn_power_khth)
566+
(dx_term + (CS%Res_coef_khth * US%L_T_to_m_s*cg1_v(i,J))**CS%Res_fn_power_khth)
501567
enddo ; enddo
502568
else
503-
!$OMP do
569+
!$OMP do
504570
do j=js,je ; do I=is-1,Ieq
505-
cg1_u = 0.5 * (CS%cg1(i,j) + CS%cg1(i+1,j))
506571
dx_term = (US%L_T_to_m_s*sqrt(CS%f2_dx2_u(I,j) + &
507-
cg1_u * CS%beta_dx2_u(I,j)))**CS%Res_fn_power_khth
572+
cg1_u(I,j) * CS%beta_dx2_u(I,j)))**CS%Res_fn_power_khth
508573
CS%Res_fn_u(I,j) = dx_term / &
509-
(dx_term + (CS%Res_coef_khth * US%L_T_to_m_s*cg1_u)**CS%Res_fn_power_khth)
574+
(dx_term + (CS%Res_coef_khth * US%L_T_to_m_s*cg1_u(I,j))**CS%Res_fn_power_khth)
510575
enddo ; enddo
511-
!$OMP do
576+
!$OMP do
512577
do J=js-1,Jeq ; do i=is,ie
513-
cg1_v = 0.5 * (CS%cg1(i,j) + CS%cg1(i,j+1))
514578
dx_term = (US%L_T_to_m_s*sqrt(CS%f2_dx2_v(i,J) + &
515-
cg1_v * CS%beta_dx2_v(i,J)))**CS%Res_fn_power_khth
579+
cg1_v(i,J) * CS%beta_dx2_v(i,J)))**CS%Res_fn_power_khth
516580
CS%Res_fn_v(i,J) = dx_term / &
517-
(dx_term + (CS%Res_coef_khth * US%L_T_to_m_s*cg1_v)**CS%Res_fn_power_khth)
581+
(dx_term + (CS%Res_coef_khth * US%L_T_to_m_s*cg1_v(i,J))**CS%Res_fn_power_khth)
518582
enddo ; enddo
519583
endif
520584
endif
521-
!$OMP end parallel
585+
!$OMP end parallel
522586

523587
if (query_averaging_enabled(CS%diag)) then
524588
if (CS%id_Res_fn > 0) call post_data(CS%id_Res_fn, CS%Res_fn_h, CS%diag)
@@ -549,23 +613,23 @@ subroutine calc_sqg_struct(h, tv, G, GV, US, CS, dt, MEKE, OBC)
549613
type(ocean_OBC_type), pointer :: OBC !< Open boundaries control structure
550614

551615
! Local variables
552-
real, dimension(SZI_(G), SZJ_(G), SZK_(GV)+1) :: e ! The interface heights relative to mean sea level [Z ~> m]
553-
real, dimension(SZIB_(G), SZJ_(G),SZK_(GV)+1) :: N2_u ! Square of buoyancy frequency at u-points [L2 Z-2 T-2 ~> s-2]
554-
real, dimension(SZI_(G), SZJB_(G),SZK_(GV)+1) :: N2_v ! Square of buoyancy frequency at v-points [L2 Z-2 T-2 ~> s-2]
555-
real, dimension(SZIB_(G), SZJ_(G),SZK_(GV)+1) :: dzu ! Z-thickness at u-points [Z ~> m]
556-
real, dimension(SZI_(G), SZJB_(G),SZK_(GV)+1) :: dzv ! Z-thickness at v-points [Z ~> m]
557-
real, dimension(SZIB_(G), SZJ_(G),SZK_(GV)+1) :: dzSxN ! |Sx| N times dz at u-points [Z T-1 ~> m s-1]
558-
real, dimension(SZI_(G), SZJB_(G),SZK_(GV)+1) :: dzSyN ! |Sy| N times dz at v-points [Z T-1 ~> m s-1]
559-
real, dimension(SZI_(G), SZJ_(G)) :: f ! Absolute value of the Coriolis parameter at h point [T-1 ~> s-1]
616+
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)+1) :: e ! The interface heights relative to mean sea level [Z ~> m]
617+
real, dimension(SZIB_(G),SZJ_(G),SZK_(GV)+1) :: N2_u ! Square of buoyancy frequency at u-points [L2 Z-2 T-2 ~> s-2]
618+
real, dimension(SZI_(G),SZJB_(G),SZK_(GV)+1) :: N2_v ! Square of buoyancy frequency at v-points [L2 Z-2 T-2 ~> s-2]
619+
real, dimension(SZIB_(G),SZJ_(G),SZK_(GV)+1) :: dzu ! Z-thickness at u-points [Z ~> m]
620+
real, dimension(SZI_(G),SZJB_(G),SZK_(GV)+1) :: dzv ! Z-thickness at v-points [Z ~> m]
621+
real, dimension(SZIB_(G),SZJ_(G),SZK_(GV)+1) :: dzSxN ! |Sx| N times dz at u-points [Z T-1 ~> m s-1]
622+
real, dimension(SZI_(G),SZJB_(G),SZK_(GV)+1) :: dzSyN ! |Sy| N times dz at v-points [Z T-1 ~> m s-1]
623+
real, dimension(SZI_(G),SZJ_(G)) :: f ! Absolute value of the Coriolis parameter at h point [T-1 ~> s-1]
560624
real :: N2 ! Positive buoyancy frequency square or zero [L2 Z-2 T-2 ~> s-2]
561625
real :: dzc ! Spacing between two adjacent layers in stretched vertical coordinate [Z ~> m]
562626
real :: f_subround ! The minimal resolved value of Coriolis parameter to prevent division by zero [T-1 ~> s-1]
563-
real, dimension(SZI_(G), SZJ_(G)) :: Le ! Eddy length scale [L ~> m]
627+
real, dimension(SZI_(G),SZJ_(G)) :: Le ! Eddy length scale [L ~> m]
564628

565-
real :: dz(SZI_(G), SZJ_(G), SZK_(GV)) ! Geometric layer thicknesses in height units [Z ~> m]
566-
real :: I_f_Le(SZI_(G), SZJ_(G)) ! The inverse of the absolute value of f times the Eddy
629+
real :: dz(SZI_(G),SZJ_(G),SZK_(GV)) ! Geometric layer thicknesses in height units [Z ~> m]
630+
real :: I_f_Le(SZI_(G),SZJ_(G)) ! The inverse of the absolute value of f times the Eddy
567631
! length scale [T L-1 ~> s m-1]
568-
real :: p_i(SZI_(G), SZJ_(G)) ! Pressure at the interface [R L2 T-2 ~> Pa]
632+
real :: p_i(SZI_(G),SZJ_(G)) ! Pressure at the interface [R L2 T-2 ~> Pa]
569633
real :: T_i(SZI_(G)) ! Temperature at the interface [C ~> degC]
570634
real :: S_i(SZI_(G)) ! Salinity at the interface [S ~> ppt]
571635
real :: dRho_dS(SZI_(G)) ! Local change in density with salinity using the model EOS and
@@ -801,7 +865,7 @@ subroutine calc_Visbeck_coeffs_old(h, slope_x, slope_y, N2_u, N2_v, G, GV, US, C
801865
! These settings apply where there are not open boundary conditions.
802866
OBC_dir_u(:,:) = 0 ; OBC_dir_v(:,:) = 0
803867

804-
if (associated(OBC).and. CS%OBC_friendly) then
868+
if (associated(OBC) .and. CS%OBC_friendly) then
805869
! Store the direction of any OBC faces.
806870
!$OMP parallel do default(shared)
807871
do j=js-1,je+1 ; do I=is-1,ie ; if (OBC%segnum_u(I,j) /= 0) then
@@ -1631,6 +1695,10 @@ subroutine VarMix_init(Time, G, GV, US, param_file, diag, CS)
16311695
"open boundary condition faces.", &
16321696
default=enable_bugs, do_not_log=(number_of_OBC_segments<=0))
16331697
CS%OBC_friendly = .not. MIXING_COEFS_OBC_BUG
1698+
call get_param(param_file, mdl, "RESOLN_FUNCTION_OBC_BUG", CS%res_fn_OBC_bug, &
1699+
"If false, use only interior data for calculating the resolution functions at "//&
1700+
"open boundary condition faces and vertices.", &
1701+
default=enable_bugs, do_not_log=(number_of_OBC_segments<=0))
16341702

16351703
if (CS%Resoln_use_ebt .or. CS%khth_use_ebt_struct .or. CS%kdgl90_use_ebt_struct &
16361704
.or. CS%BS_EBT_power>0. .or. CS%khtr_use_ebt_struct) then

0 commit comments

Comments
 (0)