@@ -212,22 +212,29 @@ subroutine ocn_export(ind, ocn_public, grid, o2x)
212
212
real (kind= 8 ), intent (inout ) :: o2x(:,:) ! < MCT outgoing bugger
213
213
! Local variables
214
214
real , dimension (grid% isd:grid% ied,grid% jsd:grid% jed) :: ssh ! < Local copy of sea_lev with updated halo
215
- integer :: i, j, n
215
+ integer :: i, j, n, ig, jg
216
216
real :: slp_L, slp_R, slp_C, slope, u_min, u_max
217
217
218
+ ! Copy from ocn_public to o2x. ocn_public uses global indexing with no halos.
219
+ ! The mask comes from "grid" that uses the usual MOM domain that has halos
220
+ ! and does not use global indexing.
218
221
n = 0
219
- do j= grid% jsc, grid% jec ; do i= grid% isc,grid% iec
220
- n = n+1
221
- o2x(ind% o2x_So_t, n) = ocn_public% t_surf(i,j) * grid% mask2dT(i,j)
222
- o2x(ind% o2x_So_s, n) = ocn_public% s_surf(i,j) * grid% mask2dT(i,j)
223
- o2x(ind% o2x_So_u, n) = ocn_public% u_surf(i,j) * grid% mask2dT(i,j)
224
- o2x(ind% o2x_So_v, n) = ocn_public% v_surf(i,j) * grid% mask2dT(i,j)
225
- end do ; end do
226
-
227
- ! ssh (make a copy in order to do a halo update)
228
- do j= grid% jsc, grid% jec ; do i= grid% isc,grid% iec
229
- ssh(i,j) = ocn_public% sea_lev(i,j)
230
- end do ; end do
222
+ do j= grid% jsc, grid% jec
223
+ jg = j + grid% jdg_offset
224
+ do i= grid% isc,grid% iec
225
+ n = n+1
226
+ ig = i + grid% idg_offset
227
+ o2x(ind% o2x_So_t, n) = ocn_public% t_surf(ig,jg) * grid% mask2dT(i,j)
228
+ o2x(ind% o2x_So_s, n) = ocn_public% s_surf(ig,jg) * grid% mask2dT(i,j)
229
+ o2x(ind% o2x_So_u, n) = ocn_public% u_surf(ig,jg) * grid% mask2dT(i,j)
230
+ o2x(ind% o2x_So_v, n) = ocn_public% v_surf(ig,jg) * grid% mask2dT(i,j)
231
+ ! Make a copy of ssh in order to do a halo update. We use the usual MOM domain
232
+ ! in order to update halos. i.e. does not use global indexing.
233
+ ssh(i,j) = ocn_public% sea_lev(ig,jg)
234
+ end do
235
+ end do
236
+
237
+ ! Update halo of ssh so we can calculate gradients
231
238
call pass_var(ssh, grid% domain)
232
239
233
240
! d/dx ssh
0 commit comments