From 2b69f1e9816b6d7a0235326a6e67de500aeb419e Mon Sep 17 00:00:00 2001 From: "brandon.reichl" Date: Thu, 23 May 2024 19:19:37 -0400 Subject: [PATCH] Bugfix for tracer advection diagnostic in symmetric memory mode - Fix logic so tracer advection diagnostics are computed correctly for symmetric memory mode --- src/tracer/MOM_tracer_advect.F90 | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/tracer/MOM_tracer_advect.F90 b/src/tracer/MOM_tracer_advect.F90 index ef2c3125cd..b77949342d 100644 --- a/src/tracer/MOM_tracer_advect.F90 +++ b/src/tracer/MOM_tracer_advect.F90 @@ -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() @@ -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 @@ -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 @@ -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() @@ -1066,8 +1066,7 @@ 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 @@ -1075,7 +1074,7 @@ subroutine advect_y(Tr, hprev, vhr, vh_neglect, OBC, domore_v, ntr, Idt, & 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