Skip to content

Commit 0ebd022

Browse files
committed
Changed adding area_tiny and h_tiny to taking the max
1 parent 8846074 commit 0ebd022

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/core/MOM_CoriolisAdv.F90

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ subroutine CorAdCalc(u, v, h, uh, vh, CAu, CAv, OBC, AD, G, GV, US, CS, pbv, Wav
526526
do J=Jsq-1,Jeq+1 ; do I=Isq-1,Ieq+1
527527
hArea_q = (hArea_u(I,j) + hArea_u(I,j+1)) + (hArea_v(i,J) + hArea_v(i+1,J))
528528
Ih_q(I,J) = Area_q(I,J) / (hArea_q + vol_neglect)
529-
h_q(I,J) = (hArea_q) / (Area_q(I,J) + area_neglect)
529+
h_q(I,J) = (hArea_q) / max(Area_q(I,J), area_neglect)
530530
q(I,J) = abs_vort(I,J) * Ih_q(I,J)
531531
enddo; enddo
532532

@@ -1408,11 +1408,12 @@ subroutine UP3_reconstruction(q4,u,qr)
14081408
real, intent(in) :: u !< Velocity or thickness flux on point i-1/2
14091409
!! [l t-1 ~> m s-1] or [l2 t-1 ~> m2 s-1]
14101410
real, intent(inout) :: qr !< Reconstruction of tracer q at point i-1/2 [A ~> a]
1411+
real, parameter :: C1_6 = 1.0/6.0 ! The ratio of 1/6 [nondim]
14111412

14121413
if (u>0.) then
1413-
qr = (-q4(1) + 5.*q4(2) + 2.*q4(3))/6.
1414+
qr = (-q4(1) + 5.*q4(2) + 2.*q4(3)) * C1_6
14141415
else
1415-
qr = (2.*q4(2) + 5.*q4(3) - q4(4))/6.
1416+
qr = (2.*q4(2) + 5.*q4(3) - q4(4)) * C1_6
14161417
endif
14171418

14181419
end subroutine UP3_reconstruction
@@ -1425,16 +1426,18 @@ subroutine UP3_Koren_limiter_reconstruction(q4,u,qr)
14251426
real, intent(in) :: u !< Velocity or thickness flux on point i-1/2
14261427
!! [L T-1 ~> m s-1] or [L2 T-1 ~> m2 s-1]
14271428
real, intent(inout) :: qr !< Reconstruction of tracer q on point i-1/2 [A ~> a]
1428-
real :: theta ! Ratio of gradient [nondim]
1429-
real :: psi ! Limiter function [nondim]
1429+
real :: theta ! Ratio of gradient [nondim]
1430+
real :: psi ! Limiter function [nondim]
1431+
real, parameter :: C1_3 = 1.0/3.0 ! The ratio of 1/3 [nondim]
1432+
real, parameter :: C1_6 = 1.0/6.0 ! The ratio of 1/6 [nondim]
14301433

14311434
if (u>0.) then
14321435
theta = (q4(2) - q4(1))/(q4(3) - q4(2) + 1e-20)
1433-
psi = max(0., min(1., 1/3. + 1/6.*theta, theta)) ! limiter introduced by Koren (1993)
1436+
psi = max(0., min(1., C1_3 + C1_6*theta, theta)) ! limiter introduced by Koren (1993)
14341437
qr = q4(2) + psi*(q4(3) - q4(2))
14351438
else
14361439
theta = (q4(4) - q4(3))/(q4(3) - q4(2) + 1e-20)
1437-
psi = max(0., min(1., 1/3. + 1/6.*theta, theta))
1440+
psi = max(0., min(1., C1_3 + C1_6*theta, theta))
14381441
qr = q4(3) + psi*(q4(2) - q4(3))
14391442
endif
14401443

@@ -1507,7 +1510,7 @@ subroutine weno_three_h_weight_reconstruction(q4, h4, u4, &
15071510
! vr = min(max(q4(3), q4(2)), vr) ; vr = max(min(q4(3), q4(2)), vr) !Impose a monotonicity limiter
15081511
hr = min(max(h4(3), h4(2)), hr) ; hr = max(min(h4(3), h4(2)), hr) ! A monotonicity limiter
15091512

1510-
qr = vr / (hr + h_tiny)
1513+
qr = vr / max(hr, h_tiny)
15111514

15121515
end subroutine weno_three_h_weight_reconstruction
15131516

@@ -1617,7 +1620,7 @@ subroutine weno_five_h_weight_reconstruction(q6, h6, u6, &
16171620
! vr = min(max(q6(3), q6(4)), vr) ; vr = max(min(q6(3), q6(4)), vr) !Impose a monotonicity limiter
16181621
hr = min(max(h6(3), h6(4)), hr) ; hr = max(min(h6(3), h6(4)), hr) !Impose a monotonicity limiter
16191622

1620-
qr = vr / (hr + h_tiny)
1623+
qr = vr / max(hr, h_tiny)
16211624

16221625
end subroutine weno_five_h_weight_reconstruction
16231626

@@ -1754,7 +1757,7 @@ subroutine weno_seven_h_weight_reconstruction(q8, h8, u8, &
17541757
endif
17551758
endif
17561759

1757-
tau = abs(b0 + 3 * b1 - 3 * b2 - b3)
1760+
tau = abs((b0 - b3) + 3 * (b1 - b2))
17581761
w0 = C4_35 * (1 + (tau / (b0 + 1e-20))**2)
17591762
w1 = C18_35 * (1 + (tau / (b1 + 1e-20))**2)
17601763
w2 = C12_35 * (1 + (tau / (b2 + 1e-20))**2)
@@ -1772,7 +1775,7 @@ subroutine weno_seven_h_weight_reconstruction(q8, h8, u8, &
17721775
! vr = min(max(q4, q5), vr) ; vr = max(min(q4, q5), vr)
17731776
hr = min(max(h8(4), h8(5)), hr) ; hr = max(min(h8(4), h8(5)), hr) ! Impose a monotonicity limiter
17741777

1775-
qr = vr / (hr + h_tiny)
1778+
qr = vr / max(hr, h_tiny)
17761779

17771780

17781781
end subroutine weno_seven_h_weight_reconstruction

0 commit comments

Comments
 (0)