Skip to content

Commit

Permalink
Undid changes to re-activate circle_obcs
Browse files Browse the repository at this point in the history
- Commented out code was needed for circle_obcs to work
  • Loading branch information
adcroft committed Jan 11, 2017
1 parent f8ecb1e commit 39f3b74
Showing 1 changed file with 62 additions and 76 deletions.
138 changes: 62 additions & 76 deletions src/core/MOM_open_boundary.F90
Original file line number Diff line number Diff line change
Expand Up @@ -482,11 +482,11 @@ subroutine setup_u_point_obc(OBC, G, segment_str, l_seg)
this_kind = OBC_NONE

! Hack to extend segment by one point
! if (Js_obc<Je_obc) then
! Js_obc = Js_obc - 1 ; Je_obc = Je_obc + 1
! else
! Js_obc = Js_obc + 1 ; Je_obc = Je_obc - 1
! endif
if (Js_obc<Je_obc) then
Js_obc = Js_obc - 1 ; Je_obc = Je_obc + 1
else
Js_obc = Js_obc + 1 ; Je_obc = Je_obc - 1
endif

if (Je_obc>Js_obc) then
OBC%OBC_segment_number(l_seg)%direction = OBC_DIRECTION_E
Expand Down Expand Up @@ -538,53 +538,47 @@ subroutine setup_u_point_obc(OBC, G, segment_str, l_seg)
OBC%update_OBC = .true.
OBC%specified_u_BCs_exist_globally = .true. ! This avoids deallocation
! Hack to undo the hack above for SIMPLE BCs
! Js_obc = Js_obc + 1 ; Je_obc = Je_obc - 1
Js_obc = Js_obc + 1 ; Je_obc = Je_obc - 1
else
call MOM_error(FATAL, "MOM_open_boundary.F90, setup_u_point_obc: "//&
"String '"//trim(action_str(a_loop))//"' not understood.")
endif

if (I_obc<G%HI%IscB .or. I_obc>G%HI%IecB) return ! Boundary is not on tile
if (I_obc<G%HI%IsdB .or. I_obc>G%HI%IedB) return ! Boundary is not on tile
! if (max(Js_obc,Je_obc)<G%HI%JsdB .or. min(Js_obc,Je_obc)>G%HI%JedB) return ! Segment is not on tile
if (Js_obc<G%HI%JscB .and. Je_obc<G%HI%JscB) then
return ! Segment is not on tile
endif

if (Js_obc>G%HI%JecB) then
return ! Segment is not on tile
endif
if (Js_obc<G%HI%JsdB .and. Je_obc<G%HI%JsdB) return ! Segment is not on tile
if (Js_obc>G%HI%JedB) return ! Segment is not on tile

OBC%OBC_segment_number(l_seg)%on_pe = .true.

do j=G%HI%jsd, G%HI%jed
if (j>Js_obc-1 .and. j<=Je_obc) then
if (j>Js_obc .and. j<=Je_obc) then

OBC%OBC_segment_u(I_obc,j) = l_seg
! if (OBC%OBC_segment_number(l_seg)%direction == OBC_DIRECTION_E) then ! East is outward
! if (this_kind == OBC_FLATHER) then
! ! Set v points outside segment
! if (OBC%OBC_segment_v(i_obc+1,J) == OBC_NONE) then
! OBC%OBC_segment_v(i_obc+1,J) = l_seg
! endif
! if (OBC%OBC_segment_v(i_obc+1,J-1) == OBC_NONE) then
! OBC%OBC_segment_v(i_obc+1,J-1) = l_seg
! endif
! endif
! else ! West is outward
! if (this_kind == OBC_FLATHER) then
! ! Set v points outside segment
! if (OBC%OBC_segment_v(i_obc,J) == OBC_NONE) then
! OBC%OBC_segment_v(i_obc,J) = l_seg
! endif
! if (OBC%OBC_segment_v(i_obc,J-1) == OBC_NONE) then
! OBC%OBC_segment_v(i_obc,J-1) = l_seg
! endif
! endif
! endif
if (OBC%OBC_segment_number(l_seg)%direction == OBC_DIRECTION_E) then ! East is outward
if (this_kind == OBC_FLATHER) then
! Set v points outside segment
if (OBC%OBC_segment_v(i_obc+1,J) == OBC_NONE) then
OBC%OBC_segment_v(i_obc+1,J) = l_seg
endif
if (OBC%OBC_segment_v(i_obc+1,J-1) == OBC_NONE) then
OBC%OBC_segment_v(i_obc+1,J-1) = l_seg
endif
endif
else ! West is outward
if (this_kind == OBC_FLATHER) then
! Set v points outside segment
if (OBC%OBC_segment_v(i_obc,J) == OBC_NONE) then
OBC%OBC_segment_v(i_obc,J) = l_seg
endif
if (OBC%OBC_segment_v(i_obc,J-1) == OBC_NONE) then
OBC%OBC_segment_v(i_obc,J-1) = l_seg
endif
endif
endif
endif
enddo
enddo ! a_loop

OBC%OBC_segment_number(l_seg)%Is_obc = I_obc
OBC%OBC_segment_number(l_seg)%Ie_obc = I_obc
OBC%OBC_segment_number(l_seg)%Js_obc = Js_obc
Expand Down Expand Up @@ -613,13 +607,12 @@ subroutine setup_v_point_obc(OBC, G, segment_str, l_seg)
Ie_obc = Ie_obc - G%idg_offset ! Convert to local tile indices on this tile
this_kind = OBC_NONE


! Hack to extend segment by one point
! if (Is_obc<Ie_obc) then
! Is_obc = Is_obc - 1 ; Ie_obc = Ie_obc + 1
! else
! Is_obc = Is_obc + 1 ; Ie_obc = Ie_obc - 1
! endif
if (Is_obc<Ie_obc) then
Is_obc = Is_obc - 1 ; Ie_obc = Ie_obc + 1
else
Is_obc = Is_obc + 1 ; Ie_obc = Ie_obc - 1
endif

if (Ie_obc>Is_obc) then
OBC%OBC_segment_number(l_seg)%direction = OBC_DIRECTION_S
Expand Down Expand Up @@ -673,55 +666,48 @@ subroutine setup_v_point_obc(OBC, G, segment_str, l_seg)
OBC%update_OBC = .true.
OBC%specified_v_BCs_exist_globally = .true. ! This avoids deallocation
! Hack to undo the hack above for SIMPLE BCs
! Is_obc = Is_obc + 1 ; Ie_obc = Ie_obc - 1
Is_obc = Is_obc + 1 ; Ie_obc = Ie_obc - 1
else
call MOM_error(FATAL, "MOM_open_boundary.F90, setup_v_point_obc: "//&
"String '"//trim(action_str(a_loop))//"' not understood.")
endif

if (J_obc<G%HI%JscB .or. J_obc>G%HI%JecB) return ! Boundary is not on tile

if (Is_obc<G%HI%IscB .and. Ie_obc<G%HI%IscB) then
return ! Segment is not on tile
endif

if (Is_obc>G%HI%IecB) then
return ! Segment is not on tile
endif
if (J_obc<G%HI%JsdB .or. J_obc>G%HI%JedB) return ! Boundary is not on tile
if (Is_obc<G%HI%IsdB .and. Ie_obc<G%HI%IsdB) return ! Segment is not on tile
if (Is_obc>G%HI%IedB) return ! Segment is not on tile

OBC%OBC_segment_number(l_seg)%on_pe = .true.

! if (J_obc<G%HI%JsdB .or. J_obc>G%HI%JedB) return ! Boundary is not on tile
! if (max(Is_obc,Ie_obc)<G%HI%IsdB .or. min(Is_obc,Ie_obc)>G%HI%IedB) return ! Segment is not on tile

do i=G%HI%isd, G%HI%ied
if (i>Is_obc-1 .and. i<=Ie_obc) then
if (i>Is_obc .and. i<=Ie_obc) then
OBC%OBC_segment_v(i,J_obc) = l_seg
! if (OBC%OBC_segment_number(l_seg)%direction == OBC_DIRECTION_N) then ! North is outward
! if (this_kind == OBC_FLATHER) then
! ! Set u points outside segment
! if (OBC%OBC_segment_u(I,j_obc+1) == OBC_NONE) then
! OBC%OBC_segment_u(I,j_obc+1) = l_seg
! endif
! if (OBC%OBC_segment_u(I-1,j_obc+1) == OBC_NONE) then
! OBC%OBC_segment_u(I-1,j_obc+1) = l_seg
! endif
! endif
! else ! South is outward
! if (this_kind == OBC_FLATHER) then
! ! Set u points outside segment
! if (OBC%OBC_segment_u(I,j_obc) == OBC_NONE) then
! OBC%OBC_segment_u(I,j_obc) = l_seg
! endif
! if (OBC%OBC_segment_u(I-1,j_obc) == OBC_NONE) then
! OBC%OBC_segment_u(I-1,j_obc) = l_seg
! endif
! endif
! endif
if (OBC%OBC_segment_number(l_seg)%direction == OBC_DIRECTION_N) then ! North is outward
if (this_kind == OBC_FLATHER) then
! Set u points outside segment
if (OBC%OBC_segment_u(I,j_obc+1) == OBC_NONE) then
OBC%OBC_segment_u(I,j_obc+1) = l_seg
endif
if (OBC%OBC_segment_u(I-1,j_obc+1) == OBC_NONE) then
OBC%OBC_segment_u(I-1,j_obc+1) = l_seg
endif
endif
else ! South is outward
if (this_kind == OBC_FLATHER) then
! Set u points outside segment
if (OBC%OBC_segment_u(I,j_obc) == OBC_NONE) then
OBC%OBC_segment_u(I,j_obc) = l_seg
endif
if (OBC%OBC_segment_u(I-1,j_obc) == OBC_NONE) then
OBC%OBC_segment_u(I-1,j_obc) = l_seg
endif
endif
endif
endif
enddo
enddo ! a_loop

OBC%OBC_segment_number(l_seg)%Is_obc = Is_obc
OBC%OBC_segment_number(l_seg)%Ie_obc = Ie_obc
OBC%OBC_segment_number(l_seg)%Js_obc = J_obc
Expand Down

0 comments on commit 39f3b74

Please sign in to comment.