PUBLIC INTERFACE / ROUTINES / ERRORS / NOTES


module bgrid_halo_mod

     Contact:   B. Wyman
     Reviewers:
     Change history: WebCVS Log for bgrid_halo.f90


OVERVIEW


     Provides an interface for updating the B-grid dynamical core
     halo rows and columns, including the polar halo rows.
     See the notes section for a description of the polar 
     boundary condition.

     Optional arguments allow for customized halo updates.


OTHER MODULES USED


    horiz_grid_mod
     utilities_mod
   mpp_domains_mod


PUBLIC INTERFACE


   use bgrid_halo_mod [, only: update_halo,
                               vel_flux_boundary,
                               TEMP, UWND, VWND, WIND,
                               SOUTH, NORTH, WEST, EAST,
                               NOPOLE, POLEONLY ]

   update_halo
        Updates all requested rows in the halo region for a requested
        field of type: TEMP, UWND, or VWND.  By default all boundaries
        will be updated.  To update only specific boundaries use the
        public parameters: SOUTH, NORTH, WEST, EAST, NOPOLE, and POLEONLY.

   vel_flux_boundary
        Zeros-out the sub-polar row of meridional velocity flux fields.
        This routine is needed by several dynamics routines for conservation,
        but should not normally be needed by the user.

   TEMP, UWND, VWND, WIND
        Integer parameters to be used for the "field" argument to
        interface update_halo.  The VWND value will result in a sign flip
        beyond the polar rows.  Data at auxilary mass flux points can
        also use these values: UFLX points use TEMP and VFLX points use
        either UWND or VWND depending whether a sign flip is desired.
        The WIND value is used with the 4D version to process the
        u,v components together.

   SOUTH, NORTH, WEST, EAST
        Integer parameters to be used with the optional "halos" argument to
        interface update_halo. By default all halos are updated.

   NOPOLE, POLEONLY
        Integer parameters to be used with the optional "flags" argument to
        interface update_halo. NOPOLE applies only to fields UWND, VWND, 
        and WIND. POLEONLY applies south and north halo updates only
        at the polar boundaries.


PUBLIC ROUTINES



call update_halo ( Hgrid, field, data [, halos, flags] )

INPUT
   field     Specifies which field/grid the data is on.
             You must use the publicly accessible parameters: 
             TEMP, UWND, VWND, or WIND.
             See the notes below and the description of 
             these parameters above.
                [integer,scalar]

INPUT/OUTPUT
   Hgrid     The derived-type variable returned by a previous call to horiz_grid_init.
             See the module horiz_grid_mod for details.
                [type(horiz_grid_type)]

   data      Data array on any valid grid, may have 2, 3, or 4 dimensions.
             The dimensions correspond to the x, y and z axes, and tracer number.
                [real, dimension(Hgrid%ilb:,Hgrid%jlb:)]
                [real, dimension(Hgrid%ilb:,Hgrid%jlb:,:)]
                [real, dimension(Hgrid%ilb:,Hgrid%jlb:,:,:)]

OPTIONAL INPUT
   halos     Integer flag that describes which halo regions should be updated.
             The value of "halos" should be some combination of the public
             parameters: SOUTH, NORTH, WEST, EAST. By default all halo regions
             are updated. For example, to only update the north and east halo 
             regions set halos=NORTH+EAST.
                [integer]

   flags     Can be set to either: NOPOLE or POLEONLY.
             The NOPOLE flag suppresses the halo update of velocity
             components at the pole row only.
             The POLEONLY flag is used to update only the north and
             south polar halos rows without updating the interior
             halo rows. This kind of update will require no
             processor to processor communication.
                [integer]

NOTE
   The field identifier WIND can only be used with the 4D version
   of this interface. The 4th dimension must have size=2, corresponding
   to the UWND and VWND components, respectively.

------------------------------------------------------------------------


call vel_flux_boundary ( Hgrid, data )

INPUT
   Hgrid     Data structure returned by a previous call to horiz_grid_init.
             See the module horiz_grid_mod for details.
                [type(horiz_grid_type)]
INPUT/OUTPUT
   data      Real data array located between velocity points along
             the y-axis (on the UFLX grid). The data in the sub-polar
             row will be set to zero.
                [real,dimension(:,Hgrid%jlb:) or dimension(:,Hgrid%jlb:,:)]


ERROR MESSAGES


Fatal errors in update_halo

    i dimension has wrong size
        The 1st (i) dimension of input/output argument data must
          have a size equal to Hgrid % isize (the entire i dimension).

    j dimension has wrong size
        The 2nd (j) dimension of input/output argument data must
          have a size equal to Hgrid % jsize (the entire j dimension).

    invalid field
        The input argument "field" has an incorrect value.  Make sure
          you are using one of public parameters: TEMP, UWND, VWND, or WIND.

    4th dimension must have size 2 for wind components
        If WIND fields are specified then the 4th dimension of
          data array must have size of 2.


KNOWN BUGS


     None.


NOTES

   At the north-south polar boundaries the following 
   boundary conditions are applied:

      a) Velocities at the poles are equal to zero

             u(i,p) = 0
             v(i,p) = 0

      b) Halo points along the north and south polar boundaries
         are set as follows:

             T(i,p+1/2) =  T(i,p-1/2)
             u(i,p+1)   =  u(i,p-1)
             v(i,p+1)   = -v(i,p-1)
      
         where p + # is a halo row and p - # is a row within 
         the computational domain.


FUTURE PLANS


     Implement realistic cross-polar flow boundary condition.