ROMS 3.1, Private Automatic Arays

ROMS Code Release Announcements

Moderators: arango, robertson

Post Reply
Message
Author
User avatar
arango
Site Admin
Posts: 1081
Joined: Wed Feb 26, 2003 4:41 pm
Location: IMCS, Rutgers University
Contact:

ROMS 3.1, Private Automatic Arays

#1 Post by arango » Fri Aug 08, 2008 6:10 pm

This is a complete update of ROMS private storage arrays that are automatically allocated when entering the _tile routines. These arrays needed to be redesigned to allow the different types of nesting: refinement, composite, and mosaics grids. These arrays where intentionally and temporarily changed to global dimensions in revision 168 (:arrow: src:ticket:142) but I forgot to change them back. Well, it happens...sorry :oops: The change was correct in distributed-memory applications since we only allocate the tile plus the ghost points. However, the private storage was much larger than needed in shared-memory and serial with partitions applications. This is not a bug but the model required larger memory in such applications. Perhaps, you didn't notice...

Four new variables are introduced in tile.h to set the size of the private storage arrays for each nested grid:

Code: Select all

!
!  Set horizontal starting and ending indices for automatic private storage
!  arrays.
!
      IminS=BOUNDS(ng)%Istr(tile)-3
      ImaxS=BOUNDS(ng)%Iend(tile)+3
      JminS=BOUNDS(ng)%Jstr(tile)-3
      JmaxS=BOUNDS(ng)%Jend(tile)+3
So now each tiled routine has the following additional arguments: IminS, ImaxS, JminS, and JmaxS, for example:

Code: Select all

     
      CALL xxxxx_tile (ng, tile,                                        &
     &                 LBi, UBi, LBj, UBj,                              &
     &                 IminS, ImaxS, JminS, JmaxS,                      &
     &                 ...)
The values of IminS, ImaxS, JminS, and JmaxS will change in the future to allow for the different size of the contact areas. However, the change will be limited to tile.h. Notice that the numerous additions and subtractions per time-step that we did before are eliminated. The CPP tokens in globaldefs.h now look like:

Code: Select all

#define PRIVATE_1D_SCRATCH_ARRAY IminS:ImaxS
#define PRIVATE_2D_SCRATCH_ARRAY IminS:ImaxS,JminS:JmaxS
These definitions are kept for compatibility but not used in the new version :!:

Warning:

If you added additional routines to the model or have customized analytical (ana_xxx.h) routines that require private storage, you need to add the new four arguments:

Code: Select all

#include "tile.h"

      CALL my_routine_tile (ng, tile,                                   &
     &                      LBi, UBi, LBj, UBj,                         &
     &                      IminS, ImaxS, JminS, JmaxS,                 &  ! <= insert
     &                      ...)

      END SUBROUTINE my_routine

      SUBROUTINE my_routine_tile (ng, tile,                             &
     &                            LBi, UBi, LBj, UBj,                   &
     &                            IminS, ImaxS, JminS, JmaxS,           &  ! <= insert
     &                            ...)

      ...

      integer, intent(in) :: ng, tile
      integer, intent(in) :: LBi, UBi, LBj, UBj
      integer, intent(in) :: IminS, ImaxS, JminS, JmaxS                    ! <= insert

      END SUBROUTINE my_routine_tile
The other thing that you may do is a string replace during editing in your routine: replace PRIVATE_1D_SCRATCH_ARRAY with IminS:ImaxS and replace PRIVATE_2D_SCRATCH_ARRAY with IminS:ImaxS,JminS:JmaxS. You can look at any ROMS tiled routine for guidance. This is a very simple change.

Notice that the following ROMS routines do not required these four additional arguments:
  • bc_r2d_tile, bc_u2d_tile, and bc_u3d_tile
  • bc_r3d_tile, bc_u3d_tile, bc_u3d_tile, and bc_w3d_tile
  • exchange_p2d_tile, exchange_r2d_tile, exchange_u2d_tile, and exchange_v2d_tile
  • exchange_p3d_tile, exchange_r3d_tile, exchange_u3d_tile, exchange_v3d_tile, and exchange_w3d_tile
  • mp_exchange2d, mp_exchange3d, and mp_exchange4d
and the respective adjoint-based routines. Notice that we sometimes pass private variables to these routines.

Good luck :!:

Post Reply