Opened 15 years ago

Closed 15 years ago

#268 closed bug (Fixed)

3D U variables misaligned with INLINE_2DIO — at Version 1

Reported by: m.hadfield Owned by: arango
Priority: major Milestone: Release ROMS/TOMS 3.2
Component: Nonlinear Version: 3.2
Keywords: Cc:

Description (last modified by arango)

When DISTRIBUTE and INLINE_2DIO are defined (which normally happens only on the UNICOS_SN platform) there is a misalignment problem when 3D u-grid variables are written to a netCDF file: successive rows of data are out of step by 1, leading to a skewing of the fields. The same error occurs (I think) when data are read from a restart file.

I have traced this to functions mp_gather2d and mp_scatter2d in distribute.F. These have code to adjust the offset for U and V grids:

      IF ((MyType.eq.p2dvar).or.(MyType.eq.u2dvar)) Io=1
      IF ((MyType.eq.p2dvar).or.(MyType.eq.v2dvar)) Jo=1

However this doesn't anticipate the possibility that mp_gather2d and mp_scatter2d will be called for 3D variables, as happens when INLINE_2DIO is defined. To cover this case, the code should be changed to the following

      IF ((MyType.eq.p2dvar).or.(MyType.eq.u2dvar).or.                  &
     &    (MyType.eq.p3dvar).or.(MyType.eq.u3dvar)) Io=1
      IF ((MyType.eq.p2dvar).or.(MyType.eq.v2dvar).or.                  &
     &    (MyType.eq.p3dvar).or.(MyType.eq.v3dvar)) Jo=1

A modified version of distribute.F is attached.

Change History (2)

by m.hadfield, 15 years ago

Attachment: distribute.F added

comment:1 by arango, 15 years ago

Description: modified (diff)
Resolution: Fixed
Status: newclosed

Yes, good catch. All this logic will change in my next update when I release the parallel I/O capabilities. I assume that with parallel I/O you no longer need to use the INLINE_2DIO option since each node process their own tile (a smaller array).

Also corrected bug in mod_sources.F. See the following forum post for more details.

Note: See TracTickets for help on using tickets.