diff --git a/src/core/MOM_open_boundary.F90 b/src/core/MOM_open_boundary.F90 index 3797f4bec1..fb248ad6a7 100644 --- a/src/core/MOM_open_boundary.F90 +++ b/src/core/MOM_open_boundary.F90 @@ -6084,6 +6084,14 @@ subroutine rotate_OBC_segment_data(segment_in, segment, turns) segment%field(n)%handle = segment_in%field(n)%handle segment%field(n)%dz_handle = segment_in%field(n)%dz_handle + if (allocated(segment_in%field(n)%buffer_dst)) then + call allocate_rotated_array(segment_in%field(n)%buffer_dst, & + lbound(segment_in%field(n)%buffer_dst), turns, & + segment%field(n)%buffer_dst) + call rotate_array(segment_in%field(n)%buffer_dst, turns, & + segment%field(n)%buffer_dst) + endif + if (modulo(turns, 2) /= 0) then select case (segment_in%field(n)%name) case ('U') @@ -6094,7 +6102,7 @@ subroutine rotate_OBC_segment_data(segment_in, segment, turns) segment%field(n)%name = 'Vphase' case ('V') segment%field(n)%name = 'U' - segment%field(n)%value = -segment%field(n)%value + segment%field(n)%buffer_dst(:,:,:) = -segment%field(n)%buffer_dst(:,:,:) case ('Vamp') segment%field(n)%name = 'Uamp' case ('Vphase') @@ -6118,14 +6126,6 @@ subroutine rotate_OBC_segment_data(segment_in, segment, turns) segment%field(n)%buffer_src) endif - if (allocated(segment_in%field(n)%buffer_dst)) then - call allocate_rotated_array(segment_in%field(n)%buffer_dst, & - lbound(segment_in%field(n)%buffer_dst), turns, & - segment%field(n)%buffer_dst) - call rotate_array(segment_in%field(n)%buffer_dst, turns, & - segment%field(n)%buffer_dst) - endif - segment%field(n)%nk_src = segment_in%field(n)%nk_src if (allocated(segment_in%field(n)%dz_src)) then