Skip to content

Commit

Permalink
Bugfix for tracer advection diagnostic in symmetric memory mode
Browse files Browse the repository at this point in the history
- Fix logic so tracer advection diagnostics are computed correctly for symmetric memory mode
  • Loading branch information
breichl authored and marshallward committed May 24, 2024
1 parent 1cf20b3 commit 2b69f1e
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/tracer/MOM_tracer_advect.F90
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ subroutine advect_x(Tr, hprev, uhr, uh_neglect, OBC, domore_u, ntr, Idt, &
real :: dA ! Difference between the reconstruction tracer edge values [conc]
real :: mA ! Average of the reconstruction tracer edge values [conc]
real :: a6 ! Curvature of the reconstruction tracer values [conc]
logical :: do_i(SZIB_(G),SZJ_(G)) ! If true, work on given points.
logical :: do_i(SZI_(G),SZJ_(G)) ! If true, work on given points.
logical :: usePLMslope
integer :: i, j, m, n, i_up, stencil, ntr_id
type(OBC_segment_type), pointer :: segment=>NULL()
Expand Down Expand Up @@ -659,7 +659,7 @@ subroutine advect_x(Tr, hprev, uhr, uh_neglect, OBC, domore_u, ntr, Idt, &
enddo

! diagnostics
if (associated(Tr(m)%ad_x)) then ; do I=is-1,ie ; if (do_i(i,j)) then
if (associated(Tr(m)%ad_x)) then ; do I=is-1,ie ; if (do_i(i,j) .or. do_i(i+1,j)) then
Tr(m)%ad_x(I,j,k) = Tr(m)%ad_x(I,j,k) + flux_x(I,j,m)*Idt
endif ; enddo ; endif

Expand Down Expand Up @@ -688,7 +688,7 @@ subroutine advect_x(Tr, hprev, uhr, uh_neglect, OBC, domore_u, ntr, Idt, &
!$OMP ordered
do m=1,ntr ; if (associated(Tr(m)%ad2d_x)) then
do j=js,je ; if (domore_u_initial(j,k)) then
do I=is-1,ie ; if (do_i(i,j)) then
do I=is-1,ie ; if (do_i(i,j) .or. do_i(i+1,j)) then
Tr(m)%ad2d_x(I,j) = Tr(m)%ad2d_x(I,j) + flux_x(I,j,m)*Idt
endif ; enddo
endif ; enddo
Expand Down Expand Up @@ -756,7 +756,7 @@ subroutine advect_y(Tr, hprev, vhr, vh_neglect, OBC, domore_v, ntr, Idt, &
real :: mA ! Average of the reconstruction tracer edge values [conc]
real :: a6 ! Curvature of the reconstruction tracer values [conc]
logical :: do_j_tr(SZJ_(G)) ! If true, calculate the tracer profiles.
logical :: do_i(SZIB_(G), SZJ_(G)) ! If true, work on given points.
logical :: do_i(SZI_(G), SZJ_(G)) ! If true, work on given points.
logical :: usePLMslope
integer :: i, j, j2, m, n, j_up, stencil, ntr_id
type(OBC_segment_type), pointer :: segment=>NULL()
Expand Down Expand Up @@ -1066,16 +1066,15 @@ subroutine advect_y(Tr, hprev, vhr, vh_neglect, OBC, domore_v, ntr, Idt, &
!$OMP ordered
do m=1,ntr ; if (associated(Tr(m)%ad_y)) then
do J=js-1,je ; if (domore_v_initial(J)) then
! (The logical test could be "do_i(i,j) .or. do_i(i+1,j)" to be clearer, but not needed)
do i=is,ie ; if (do_i(i,j)) then
do i=is,ie ; if (do_i(i,j) .or. do_i(i,j+1)) then
Tr(m)%ad_y(i,J,k) = Tr(m)%ad_y(i,J,k) + flux_y(i,m,J)*Idt
endif ; enddo
endif ; enddo
endif ; enddo ! End of m-loop.

do m=1,ntr ; if (associated(Tr(m)%ad2d_y)) then
do J=js-1,je ; if (domore_v_initial(J)) then
do i=is,ie ; if (do_i(i,j)) then
do i=is,ie ; if (do_i(i,j) .or. do_i(i,j+1)) then
Tr(m)%ad2d_y(i,J) = Tr(m)%ad2d_y(i,J) + flux_y(i,m,J)*Idt
endif ; enddo
endif ; enddo
Expand Down

0 comments on commit 2b69f1e

Please sign in to comment.