Skip to content

Commit

Permalink
uncomment omp in barotropic solver
Browse files Browse the repository at this point in the history
  • Loading branch information
alperaltuntas committed Apr 13, 2020
1 parent 0a2bb50 commit 01f7c45
Showing 1 changed file with 54 additions and 54 deletions.
108 changes: 54 additions & 54 deletions src/core/MOM_barotropic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1584,24 +1584,24 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
call find_face_areas(Datu, Datv, G, GV, US, CS, MS, eta, 1+iev-ie)
endif

!GOMP parallel default(shared)
!$OMP parallel default(shared)
if (CS%dynamic_psurf .or. .not.project_velocity) then
if (use_BT_cont) then
!GOMP do
!$OMP do
do j=jsv-1,jev+1 ; do I=isv-2,iev+1
uhbt(I,j) = find_uhbt(ubt(I,j), BTCL_u(I,j), US) + uhbt0(I,j)
enddo ; enddo
!GOMP do
!$OMP do
do J=jsv-2,jev+1 ; do i=isv-1,iev+1
vhbt(i,J) = find_vhbt(vbt(i,J), BTCL_v(i,J), US) + vhbt0(i,J)
enddo ; enddo
!GOMP do
!$OMP do
do j=jsv-1,jev+1 ; do i=isv-1,iev+1
eta_pred(i,j) = (eta(i,j) + eta_src(i,j)) + (dtbt * CS%IareaT(i,j)) * &
((uhbt(I-1,j) - uhbt(I,j)) + (vhbt(i,J-1) - vhbt(i,J)))
enddo ; enddo
else
!GOMP do
!$OMP do
do j=jsv-1,jev+1 ; do i=isv-1,iev+1
eta_pred(i,j) = (eta(i,j) + eta_src(i,j)) + (dtbt * CS%IareaT(i,j)) * &
(((Datu(I-1,j)*ubt(I-1,j) + uhbt0(I-1,j)) - &
Expand All @@ -1612,7 +1612,7 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
endif

if (CS%dynamic_psurf) then
!GOMP do
!$OMP do
do j=jsv-1,jev+1 ; do i=isv-1,iev+1
p_surf_dyn(i,j) = dyn_coef_eta(i,j) * (eta_pred(i,j) - eta(i,j))
enddo ; enddo
Expand All @@ -1623,31 +1623,31 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
! eta_PF_BT => eta_pred ; if (project_velocity) eta_PF_BT => eta

if (find_etaav) then
!GOMP do
!$OMP do
do j=js,je ; do i=is,ie
eta_sum(i,j) = eta_sum(i,j) + wt_accel2(n) * eta_PF_BT(i,j)
enddo ; enddo
endif

if (interp_eta_PF) then
wt_end = n*Instep ! This could be (n-0.5)*Instep.
!GOMP do
!$OMP do
do j=jsv-1,jev+1 ; do i=isv-1,iev+1
eta_PF(i,j) = eta_PF_1(i,j) + wt_end*d_eta_PF(i,j)
enddo ; enddo
endif

if (apply_OBC_flather .or. apply_OBC_open) then
!GOMP do
!$OMP do
do j=jsv,jev ; do I=isv-2,iev+1
ubt_old(I,j) = ubt(I,j)
enddo ; enddo
!GOMP do
!$OMP do
do J=jsv-2,jev+1 ; do i=isv,iev
vbt_old(i,J) = vbt(i,J)
enddo ; enddo
endif
!GOMP end parallel
!$OMP end parallel

if (apply_OBCs) then
if (MOD(n+G%first_direction,2)==1) then
Expand All @@ -1657,26 +1657,26 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
endif

if (CS%BT_OBC%apply_u_OBCs) then ! save the old value of ubt and uhbt
!GOMP parallel do default(shared)
!$OMP parallel do default(shared)
do J=jsv-joff,jev+joff ; do i=isv-1,iev
ubt_prev(i,J) = ubt(i,J) ; uhbt_prev(i,J) = uhbt(i,J)
ubt_sum_prev(i,J) = ubt_sum(i,J) ; uhbt_sum_prev(i,J) = uhbt_sum(i,J) ; ubt_wtd_prev(i,J) = ubt_wtd(i,J)
enddo ; enddo
endif

if (CS%BT_OBC%apply_v_OBCs) then ! save the old value of vbt and vhbt
!GOMP parallel do default(shared)
!$OMP parallel do default(shared)
do J=jsv-1,jev ; do i=isv-ioff,iev+ioff
vbt_prev(i,J) = vbt(i,J) ; vhbt_prev(i,J) = vhbt(i,J)
vbt_sum_prev(i,J) = vbt_sum(i,J) ; vhbt_sum_prev(i,J) = vhbt_sum(i,J) ; vbt_wtd_prev(i,J) = vbt_wtd(i,J)
enddo ; enddo
endif
endif

!GOMP parallel default(shared) private(vel_prev)
!$OMP parallel default(shared) private(vel_prev)
if (MOD(n+G%first_direction,2)==1) then
! On odd-steps, update v first.
!GOMP do
!$OMP do
do J=jsv-1,jev ; do i=isv-1,iev+1
Cor_v(i,J) = -1.0*((amer(I-1,j) * ubt(I-1,j) + cmer(I,j+1) * ubt(I,j+1)) + &
(bmer(I,j) * ubt(I,j) + dmer(I-1,j+1) * ubt(I-1,j+1))) - Cor_ref_v(i,J)
Expand All @@ -1685,19 +1685,19 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
dgeo_de * CS%IdyCv(i,J)
enddo ; enddo
if (CS%dynamic_psurf) then
!GOMP do
!$OMP do
do J=jsv-1,jev ; do i=isv-1,iev+1
PFv(i,J) = PFv(i,J) + (p_surf_dyn(i,j) - p_surf_dyn(i,j+1)) * CS%IdyCv(i,J)
enddo ; enddo
endif

if (CS%BT_OBC%apply_v_OBCs) then ! zero out PF across boundary
!GOMP do
!$OMP do
do J=jsv-1,jev ; do i=isv-1,iev+1 ; if (OBC%segnum_v(i,J) /= OBC_NONE) then
PFv(i,J) = 0.0
endif ; enddo ; enddo
endif
!GOMP do
!$OMP do
do J=jsv-1,jev ; do i=isv-1,iev+1
vel_prev = vbt(i,J)
vbt(i,J) = bt_rem_v(i,J) * (vbt(i,J) + &
Expand All @@ -1713,24 +1713,24 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
enddo ; enddo

if (use_BT_cont) then
!GOMP do
!$OMP do
do J=jsv-1,jev ; do i=isv-1,iev+1
vhbt(i,J) = find_vhbt(vbt_trans(i,J), BTCL_v(i,J), US) + vhbt0(i,J)
enddo ; enddo
else
!GOMP do
!$OMP do
do J=jsv-1,jev ; do i=isv-1,iev+1
vhbt(i,J) = Datv(i,J)*vbt_trans(i,J) + vhbt0(i,J)
enddo ; enddo
endif
if (CS%BT_OBC%apply_v_OBCs) then ! copy back the value for v-points on the boundary.
!GOMP do
!$OMP do
do J=jsv-1,jev ; do i=isv-1,iev+1 ; if (OBC%segnum_v(i,J) /= OBC_NONE) then
vbt(i,J) = vbt_prev(i,J) ; vhbt(i,J) = vhbt_prev(i,J)
endif ; enddo ; enddo
endif
! Now update the zonal velocity.
!GOMP do
!$OMP do
do j=jsv,jev ; do I=isv-1,iev
Cor_u(I,j) = ((azon(I,j) * vbt(i+1,J) + czon(I,j) * vbt(i,J-1)) + &
(bzon(I,j) * vbt(i,J) + dzon(I,j) * vbt(i+1,J-1))) - &
Expand All @@ -1741,19 +1741,19 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
enddo ; enddo

if (CS%dynamic_psurf) then
!GOMP do
!$OMP do
do j=jsv,jev ; do I=isv-1,iev
PFu(I,j) = PFu(I,j) + (p_surf_dyn(i,j) - p_surf_dyn(i+1,j)) * CS%IdxCu(I,j)
enddo ; enddo
endif

if (CS%BT_OBC%apply_u_OBCs) then ! zero out pressure force across boundary
!GOMP do
!$OMP do
do j=jsv,jev ; do I=isv-1,iev ; if (OBC%segnum_u(I,j) /= OBC_NONE) then
PFu(I,j) = 0.0
endif ; enddo ; enddo
endif
!GOMP do
!$OMP do
do j=jsv,jev ; do I=isv-1,iev
vel_prev = ubt(I,j)
ubt(I,j) = bt_rem_u(I,j) * (ubt(I,j) + &
Expand All @@ -1770,25 +1770,25 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
enddo ; enddo

if (use_BT_cont) then
!GOMP do
!$OMP do
do j=jsv,jev ; do I=isv-1,iev
uhbt(I,j) = find_uhbt(ubt_trans(I,j), BTCL_u(I,j), US) + uhbt0(I,j)
enddo ; enddo
else
!GOMP do
!$OMP do
do j=jsv,jev ; do I=isv-1,iev
uhbt(I,j) = Datu(I,j)*ubt_trans(I,j) + uhbt0(I,j)
enddo ; enddo
endif
if (CS%BT_OBC%apply_u_OBCs) then ! copy back the value for u-points on the boundary.
!GOMP do
!$OMP do
do j=jsv,jev ; do I=isv-1,iev ; if (OBC%segnum_u(I,j) /= OBC_NONE) then
ubt(I,j) = ubt_prev(I,j); uhbt(I,j) = uhbt_prev(I,j)
endif ; enddo ; enddo
endif
else
! On even steps, update u first.
!GOMP do
!$OMP do
do j=jsv-1,jev+1 ; do I=isv-1,iev
Cor_u(I,j) = ((azon(I,j) * vbt(i+1,J) + czon(I,j) * vbt(i,J-1)) + &
(bzon(I,j) * vbt(i,J) + dzon(I,j) * vbt(i+1,J-1))) - &
Expand All @@ -1799,20 +1799,20 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
enddo ; enddo

if (CS%dynamic_psurf) then
!GOMP do
!$OMP do
do j=jsv-1,jev+1 ; do I=isv-1,iev
PFu(I,j) = PFu(I,j) + (p_surf_dyn(i,j) - p_surf_dyn(i+1,j)) * CS%IdxCu(I,j)
enddo ; enddo
endif

if (CS%BT_OBC%apply_u_OBCs) then ! zero out pressure force across boundary
!GOMP do
!$OMP do
do j=jsv,jev ; do I=isv-1,iev ; if (OBC%segnum_u(I,j) /= OBC_NONE) then
PFu(I,j) = 0.0
endif ; enddo ; enddo
endif

!GOMP do
!$OMP do
do j=jsv-1,jev+1 ; do I=isv-1,iev
vel_prev = ubt(I,j)
ubt(I,j) = bt_rem_u(I,j) * (ubt(I,j) + &
Expand All @@ -1829,26 +1829,26 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
enddo ; enddo

if (use_BT_cont) then
!GOMP do
!$OMP do
do j=jsv-1,jev+1 ; do I=isv-1,iev
uhbt(I,j) = find_uhbt(ubt_trans(I,j), BTCL_u(I,j), US) + uhbt0(I,j)
enddo ; enddo
else
!GOMP do
!$OMP do
do j=jsv-1,jev+1 ; do I=isv-1,iev
uhbt(I,j) = Datu(I,j)*ubt_trans(I,j) + uhbt0(I,j)
enddo ; enddo
endif
if (CS%BT_OBC%apply_u_OBCs) then ! copy back the value for u-points on the boundary.
!GOMP do
!$OMP do
do j=jsv-1,jev+1 ; do I=isv-1,iev ; if (OBC%segnum_u(I,j) /= OBC_NONE) then
ubt(I,j) = ubt_prev(I,j); uhbt(I,j) = uhbt_prev(I,j)
endif ; enddo ; enddo
endif

! Now update the meridional velocity.
if (CS%use_old_coriolis_bracket_bug) then
!GOMP do
!$OMP do
do J=jsv-1,jev ; do i=isv,iev
Cor_v(i,J) = -1.0*((amer(I-1,j) * ubt(I-1,j) + bmer(I,j) * ubt(I,j)) + &
(cmer(I,j+1) * ubt(I,j+1) + dmer(I-1,j+1) * ubt(I-1,j+1))) - Cor_ref_v(i,J)
Expand All @@ -1857,7 +1857,7 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
dgeo_de * CS%IdyCv(i,J)
enddo ; enddo
else
!GOMP do
!$OMP do
do J=jsv-1,jev ; do i=isv,iev
Cor_v(i,J) = -1.0*((amer(I-1,j) * ubt(I-1,j) + cmer(I,j+1) * ubt(I,j+1)) + &
(bmer(I,j) * ubt(I,j) + dmer(I-1,j+1) * ubt(I-1,j+1))) - Cor_ref_v(i,J)
Expand All @@ -1868,20 +1868,20 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
endif

if (CS%dynamic_psurf) then
!GOMP do
!$OMP do
do J=jsv-1,jev ; do i=isv,iev
PFv(i,J) = PFv(i,J) + (p_surf_dyn(i,j) - p_surf_dyn(i,j+1)) * CS%IdyCv(i,J)
enddo ; enddo
endif

if (CS%BT_OBC%apply_v_OBCs) then ! zero out PF across boundary
!GOMP do
!$OMP do
do J=jsv-1,jev ; do i=isv-1,iev+1 ; if (OBC%segnum_v(i,J) /= OBC_NONE) then
PFv(i,J) = 0.0
endif ; enddo ; enddo
endif

!GOMP do
!$OMP do
do J=jsv-1,jev ; do i=isv,iev
vel_prev = vbt(i,J)
vbt(i,J) = bt_rem_v(i,J) * (vbt(i,J) + &
Expand All @@ -1897,64 +1897,64 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
endif
enddo ; enddo
if (use_BT_cont) then
!GOMP do
!$OMP do
do J=jsv-1,jev ; do i=isv,iev
vhbt(i,J) = find_vhbt(vbt_trans(i,J), BTCL_v(i,J), US) + vhbt0(i,J)
enddo ; enddo
else
!GOMP do
!$OMP do
do J=jsv-1,jev ; do i=isv,iev
vhbt(i,J) = Datv(i,J)*vbt_trans(i,J) + vhbt0(i,J)
enddo ; enddo
endif
if (CS%BT_OBC%apply_v_OBCs) then ! copy back the value for v-points on the boundary.
!GOMP do
!$OMP do
do J=jsv-1,jev ; do i=isv,iev ; if (OBC%segnum_v(i,J) /= OBC_NONE) then
vbt(i,J) = vbt_prev(i,J); vhbt(i,J) = vhbt_prev(i,J)
endif ; enddo ; enddo
endif
endif
!GOMP end parallel
!$OMP end parallel

!GOMP parallel default(shared)
!$OMP parallel default(shared)
if (find_PF) then
!GOMP do
!$OMP do
do j=js,je ; do I=is-1,ie
PFu_bt_sum(I,j) = PFu_bt_sum(I,j) + wt_accel2(n) * PFu(I,j)
enddo ; enddo
!GOMP do
!$OMP do
do J=js-1,je ; do i=is,ie
PFv_bt_sum(i,J) = PFv_bt_sum(i,J) + wt_accel2(n) * PFv(i,J)
enddo ; enddo
endif
if (find_Cor) then
!GOMP do
!$OMP do
do j=js,je ; do I=is-1,ie
Coru_bt_sum(I,j) = Coru_bt_sum(I,j) + wt_accel2(n) * Cor_u(I,j)
enddo ; enddo
!GOMP do
!$OMP do
do J=js-1,je ; do i=is,ie
Corv_bt_sum(i,J) = Corv_bt_sum(i,J) + wt_accel2(n) * Cor_v(i,J)
enddo ; enddo
endif

!GOMP do
!$OMP do
do j=js,je ; do I=is-1,ie
ubt_sum(I,j) = ubt_sum(I,j) + wt_trans(n) * ubt_trans(I,j)
uhbt_sum(I,j) = uhbt_sum(I,j) + wt_trans(n) * uhbt(I,j)
ubt_wtd(I,j) = ubt_wtd(I,j) + wt_vel(n) * ubt(I,j)
enddo ; enddo
!GOMP do
!$OMP do
do J=js-1,je ; do i=is,ie
vbt_sum(i,J) = vbt_sum(i,J) + wt_trans(n) * vbt_trans(i,J)
vhbt_sum(i,J) = vhbt_sum(i,J) + wt_trans(n) * vhbt(i,J)
vbt_wtd(i,J) = vbt_wtd(i,J) + wt_vel(n) * vbt(i,J)
enddo ; enddo
!GOMP end parallel
!$OMP end parallel

if (apply_OBCs) then
if (CS%BT_OBC%apply_u_OBCs) then ! copy back the value for u-points on the boundary.
!GOMP parallel do default(shared)
!$OMP parallel do default(shared)
do j=js,je ; do I=is-1,ie
if (OBC%segnum_u(I,j) /= OBC_NONE) then
ubt_sum(I,j) = ubt_sum_prev(I,j) ; uhbt_sum(I,j) = uhbt_sum_prev(I,j)
Expand All @@ -1964,7 +1964,7 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
endif

if (CS%BT_OBC%apply_v_OBCs) then ! copy back the value for v-points on the boundary.
!GOMP parallel do default(shared)
!$OMP parallel do default(shared)
do J=js-1,je ; do I=is,ie
if (OBC%segnum_v(i,J) /= OBC_NONE) then
vbt_sum(i,J) = vbt_sum_prev(i,J) ; vhbt_sum(i,J) = vhbt_sum_prev(i,J)
Expand Down

0 comments on commit 01f7c45

Please sign in to comment.