Skip to content

Commit 2171723

Browse files
kshedstromHallberg-NOAA
authored andcommitted
Fix OBC check if not associated.
1 parent 321f9c8 commit 2171723

File tree

1 file changed

+27
-23
lines changed

1 file changed

+27
-23
lines changed

src/tracer/MOM_tracer_advect.F90

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -649,17 +649,19 @@ subroutine advect_x(Tr, hprev, uhr, uh_neglect, OBC, domore_u, ntr, Idt, &
649649
enddo
650650

651651
! Update do_i so that nothing changes outside of the OBC (problem for interior OBCs only)
652-
if (associated(OBC) .and. (OBC%exterior_OBC_bug .eqv. .false.)) then ; if (OBC%OBC_pe) then
653-
if (OBC%specified_u_BCs_exist_globally .or. OBC%open_u_BCs_exist_globally) then
654-
do i=is,ie-1 ; if (OBC%segnum_u(I,j) /= OBC_NONE) then
655-
if (OBC%segment(OBC%segnum_u(I,j))%direction == OBC_DIRECTION_E) then
656-
do_i(i+1,j) = .false.
657-
elseif (OBC%segment(OBC%segnum_u(I,j))%direction == OBC_DIRECTION_W) then
658-
do_i(i,j) = .false.
659-
endif
660-
endif ; enddo
652+
if (associated(OBC)) then
653+
if ((OBC%exterior_OBC_bug .eqv. .false.) .and. (OBC%OBC_pe)) then
654+
if (OBC%specified_u_BCs_exist_globally .or. OBC%open_u_BCs_exist_globally) then
655+
do i=is,ie-1 ; if (OBC%segnum_u(I,j) /= OBC_NONE) then
656+
if (OBC%segment(OBC%segnum_u(I,j))%direction == OBC_DIRECTION_E) then
657+
do_i(i+1,j) = .false.
658+
elseif (OBC%segment(OBC%segnum_u(I,j))%direction == OBC_DIRECTION_W) then
659+
do_i(i,j) = .false.
660+
endif
661+
endif ; enddo
662+
endif
661663
endif
662-
endif ; endif
664+
endif
663665

664666
! update tracer concentration from i-flux and save some diagnostics
665667
do m=1,ntr
@@ -1053,22 +1055,24 @@ subroutine advect_y(Tr, hprev, vhr, vh_neglect, OBC, domore_v, ntr, Idt, &
10531055
enddo
10541056

10551057
! Update do_i so that nothing changes outside of the OBC (problem for interior OBCs only)
1056-
if (associated(OBC) .and. (OBC%exterior_OBC_bug .eqv. .false.)) then ; if (OBC%OBC_pe) then
1057-
if (OBC%specified_v_BCs_exist_globally .or. OBC%open_v_BCs_exist_globally) then
1058-
do i=is,ie
1059-
if (OBC%segnum_v(i,J-1) /= OBC_NONE) then
1060-
if (OBC%segment(OBC%segnum_v(i,J-1))%direction == OBC_DIRECTION_N) then
1061-
do_i(i,j) = .false.
1058+
if (associated(OBC)) then
1059+
if ((OBC%exterior_OBC_bug .eqv. .false.) .and. (OBC%OBC_pe)) then
1060+
if (OBC%specified_v_BCs_exist_globally .or. OBC%open_v_BCs_exist_globally) then
1061+
do i=is,ie
1062+
if (OBC%segnum_v(i,J-1) /= OBC_NONE) then
1063+
if (OBC%segment(OBC%segnum_v(i,J-1))%direction == OBC_DIRECTION_N) then
1064+
do_i(i,j) = .false.
1065+
endif
10621066
endif
1063-
endif
1064-
if (OBC%segnum_v(i,J) /= OBC_NONE) then
1065-
if (OBC%segment(OBC%segnum_v(i,J))%direction == OBC_DIRECTION_S) then
1066-
do_i(i,j) = .false.
1067+
if (OBC%segnum_v(i,J) /= OBC_NONE) then
1068+
if (OBC%segment(OBC%segnum_v(i,J))%direction == OBC_DIRECTION_S) then
1069+
do_i(i,j) = .false.
1070+
endif
10671071
endif
1068-
endif
1069-
enddo
1072+
enddo
1073+
endif
10701074
endif
1071-
endif ; endif
1075+
endif
10721076

10731077
! update tracer and save some diagnostics
10741078
do m=1,ntr

0 commit comments

Comments
 (0)