Skip to content

Commit ad80a23

Browse files
committed
Added stencil in $OMP(shared). Added additional comments
1 parent 0e6cd39 commit ad80a23

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

src/core/MOM_CoriolisAdv.F90

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ subroutine CorAdCalc(u, v, h, uh, vh, CAu, CAv, OBC, AD, G, GV, US, CS, pbv, Wav
315315

316316
!$OMP parallel do default(private) shared(u,v,h,uh,vh,CAu,CAv,G,GV,CS,AD,Area_h,Area_q,&
317317
!$OMP RV,PV,is,ie,js,je,Isq,Ieq,Jsq,Jeq,nz,vol_neglect,h_tiny,OBC,eps_vel, &
318-
!$OMP area_neglect, pbv, Stokes_VF)
318+
!$OMP area_neglect, pbv, Stokes_VF, stencil)
319319
do k=1,nz
320320

321321
Isq = G%IscB - stencil + 2
@@ -1519,7 +1519,7 @@ subroutine weno_three_h_weight_reconstruction(q4, h4, u4, &
15191519
w1 = C1_3 * fac_fn(tau, b1)
15201520

15211521
s = 1. / (w0 + w1)
1522-
w0 = w0 * s
1522+
w0 = w0 * s ! Weights of stencils
15231523
w1 = w1 * s
15241524

15251525
vr = w0 * c0 + w1 * c1
@@ -1531,10 +1531,10 @@ subroutine weno_three_h_weight_reconstruction(q4, h4, u4, &
15311531

15321532
end subroutine weno_three_h_weight_reconstruction
15331533

1534-
!> Compute weights for the two-point stencil of the third-order WENO scheme
1534+
!> Compute the smoothness indicator for the two-point stencil of the third-order WENO scheme
15351535
subroutine weno_three_weight(q2, w0)
15361536
real, intent(in) :: q2(2) !< Tracer values on the two-point stencil [A ~> a]
1537-
real, intent(inout) :: w0 !< Weight for this stencil [A2 ~> a2]
1537+
real, intent(inout) :: w0 !< Smoothness indicator for this stencil [A2 ~> a2]
15381538

15391539
w0 = q2(1) * q2(1) - 2 * q2(1) * q2(2) + q2(2) * q2(2)
15401540

@@ -1628,7 +1628,7 @@ subroutine weno_five_h_weight_reconstruction(q6, h6, u6, &
16281628
w2 = C1_10 * fac_fn(tau, b2)
16291629

16301630
s = 1. / (w0 + w1 + w2)
1631-
w0 = w0 * s
1631+
w0 = w0 * s ! Weights of stencils
16321632
w1 = w1 * s
16331633
w2 = w2 * s
16341634

@@ -1641,30 +1641,30 @@ subroutine weno_five_h_weight_reconstruction(q6, h6, u6, &
16411641

16421642
end subroutine weno_five_h_weight_reconstruction
16431643

1644-
!> Compute weights for the third upwind stencil of the fifth-order WENO scheme
1644+
!> Compute the smoothness indicator for the third upwind stencil of the fifth-order WENO scheme
16451645
subroutine weno_five_weight_0(q3, w0)
16461646
real, intent(in) :: q3(3) !< Tracer values on the three-point stencil [A ~> a]
1647-
real, intent(inout) :: w0 !< Weight for this stencil [A2 ~> a2]
1647+
real, intent(inout) :: w0 !< Smoothness indicator for this stencil [A2 ~> a2]
16481648

16491649
w0 = q3(1) * (10 * q3(1) - 31 * q3(2) + 11 * q3(3)) + &
16501650
q3(2) * (25 * q3(2) - 19 * q3(3)) + 4 * q3(3) * q3(3)
16511651

16521652
end subroutine weno_five_weight_0
16531653

1654-
!> Compute weights for the second upwind stencil of the fifth-order WENO scheme
1654+
!> Compute the smoothness indicator for the second upwind stencil of the fifth-order WENO scheme
16551655
subroutine weno_five_weight_1(q3, w1)
16561656
real, intent(in) :: q3(3) !< Tracer values on the three-point stencil [A ~> a]
1657-
real, intent(inout) :: w1 !< Weight for this stencil [A2 ~> a2]
1657+
real, intent(inout) :: w1 !< Smoothness indicator for this stencil [A2 ~> a2]
16581658

16591659
w1 = q3(1) * (4 * q3(1) - 13 * q3(2) + 5 * q3(3)) + &
16601660
q3(2) * (13 * q3(2) - 13 * q3(3)) + 4 * q3(3) * q3(3)
16611661

16621662
end subroutine weno_five_weight_1
16631663

1664-
!> Compute weights for the first upwind stencil of the fifth-order WENO scheme
1664+
!> Compute the smoothness indicator for the first upwind stencil of the fifth-order WENO scheme
16651665
subroutine weno_five_weight_2(q3, w2)
16661666
real, intent(in) :: q3(3) !< Tracer values on the three-point stencil [A ~> a]
1667-
real, intent(inout) :: w2 !< Weight for this stencil [A2 ~> a2]
1667+
real, intent(inout) :: w2 !< Smoothness indicator for this stencil [A2 ~> a2]
16681668

16691669
w2 = q3(1) * (4 * q3(1) - 19 * q3(2) + 11 * q3(3)) + &
16701670
q3(2) * (25 * q3(2) - 31 * q3(3)) + 10 * q3(3) * q3(3)
@@ -1781,7 +1781,7 @@ subroutine weno_seven_h_weight_reconstruction(q8, h8, u8, &
17811781
w3 = C1_35 * fac_fn(tau, b3)
17821782

17831783
s = 1. / (w0 + w1 + w2 + w3)
1784-
w0 = w0 * s
1784+
w0 = w0 * s ! Weights of the stencils
17851785
w1 = w1 * s
17861786
w2 = w2 * s
17871787
w3 = w3 * s
@@ -1797,44 +1797,48 @@ subroutine weno_seven_h_weight_reconstruction(q8, h8, u8, &
17971797

17981798
end subroutine weno_seven_h_weight_reconstruction
17991799

1800-
!> Compute weights for the fourth upwind stencil of the seventh-order WENO scheme
1800+
!> Compute the smoothness indicator for the fourth upwind stencil of the seventh-order WENO scheme
18011801
subroutine weno_seven_weight_0(q4, w0)
18021802
real, intent(in) :: q4(4) !< Tracer values on the four-point stencil [A ~> a]
1803-
real, intent(inout) :: w0 !< Weight for this stencil [A2 ~> a2]
1803+
real, intent(inout) :: w0 !< Smoothness indicator for this stencil [A2 ~> a2]
18041804

1805+
! Coefficients from Balsara and Shu (2000). The division by 1000 will be normalized out by fac_fn
18051806
w0 = q4(1) * (2.107 * q4(1) - 9.402 * q4(2) + 7.042 * q4(3) - 1.854 * q4(4)) + &
18061807
q4(2) * (11.003 * q4(2) - 17.246 * q4(3) + 4.642 * q4(4)) + &
18071808
q4(3) * (7.043 * q4(3) - 3.882 * q4(4)) + 0.547 * q4(4) * q4(4)
18081809

18091810
end subroutine weno_seven_weight_0
18101811

1811-
!> Compute weights for the third upwind stencil of the seventh-order WENO scheme
1812+
!> Compute the smoothness indicator for the third upwind stencil of the seventh-order WENO scheme
18121813
subroutine weno_seven_weight_1(q4, w1)
18131814
real, intent(in) :: q4(4) !< Tracer values on the four-point stencil [A ~> a]
1814-
real, intent(inout) :: w1 !< Weight for this stencil [A2 ~> a2]
1815+
real, intent(inout) :: w1 !< Smoothness indicator for this stencil [A2 ~> a2]
18151816

1817+
! Coefficients from Balsara and Shu (2000). The division by 1000 will be normalized out by fac_fn
18161818
w1 = q4(1) * (0.547 * q4(1) - 2.522 * q4(2) + 1.922 * q4(3) - 0.494 * q4(4)) + &
18171819
q4(2) * (3.443 * q4(2) - 5.966 * q4(3) + 1.602 * q4(4)) + &
18181820
q4(3) * (2.843 * q4(3) - 1.642 * q4(4)) + 0.267 * q4(4) * q4(4)
18191821

18201822
end subroutine weno_seven_weight_1
18211823

1822-
!> Compute weights for the second upwind stencil of the seventh-order WENO scheme
1824+
!> Compute the smoothness indicator for the second upwind stencil of the seventh-order WENO scheme
18231825
subroutine weno_seven_weight_2(q4, w2)
18241826
real, intent(in) :: q4(4) !< Tracer values on the four-point stencil [A ~> a]
1825-
real, intent(inout) :: w2 !< Weight for this stencil [A2 ~> a2]
1827+
real, intent(inout) :: w2 !< Smoothness indicator for this stencil [A2 ~> a2]
18261828

1829+
! Coefficients from Balsara and Shu (2000). The division by 1000 will be normalized out by fac_fn
18271830
w2 = q4(1) * (0.267 * q4(1) - 1.642 * q4(2) + 1.602 * q4(3) - 0.494 * q4(4)) + &
18281831
q4(2) * (2.843 * q4(2) - 5.966 * q4(3) + 1.922 * q4(4)) + &
18291832
q4(3) * (3.443 * q4(3) - 2.522 * q4(4)) + 0.547 * q4(4) * q4(4)
18301833

18311834
end subroutine weno_seven_weight_2
18321835

1833-
!> Compute weights for the first upwind stencil of the seventh-order WENO scheme
1836+
!> Compute smoothness indicator for the first upwind stencil of the seventh-order WENO scheme
18341837
subroutine weno_seven_weight_3(q4, w3)
18351838
real, intent(in) :: q4(4) !< Tracer values on the four-point stencil [A ~> a]
1836-
real, intent(inout) :: w3 !< Weight for this stencil [A2 ~> a2]
1839+
real, intent(inout) :: w3 !< Smoothness indicator for this stencil [A2 ~> a2]
18371840

1841+
! Coefficients from Balsara and Shu (2000). The division by 1000 will be normalized out by fac_fn
18381842
w3 = q4(1) * (0.547 * q4(1) - 3.882 * q4(2) + 4.642 * q4(3) - 1.854 * q4(4)) + &
18391843
q4(2) * (7.043 * q4(2) - 17.246 * q4(3) + 7.042 * q4(4)) + &
18401844
q4(3) * (11.003 * q4(3) - 9.402 * q4(4)) + 2.107 * q4(4) * q4(4)

0 commit comments

Comments
 (0)