PUBLIC INTERFACE ~ PUBLIC DATA ~ PUBLIC ROUTINES ~ NAMELIST ~ DIAGNOSTIC FIELDS ~ ERROR MESSAGES ~ REFERENCES ~ NOTES

Module grids_util_mod

Contact: Z. Liang
Reviewers: S. M. Griffies
Change History: WebCVS Log


OVERVIEW

grids_util_mod contains some public interface used by several modules in generate_ocean_grid package.



OTHER MODULES USED

      fms_mod
mpp_mod
mpp_io_mod
constants_mod

PUBLIC INTERFACE

write_field_data:
Write data to corresponding grid file.
gcell:
grid cell construction.
get_file_unit:
returns the io unit corresponding to filename.
write_field_meta:
Write meta data of a field to a netcdf file.
set_grid:
set the axis grid information.


PUBLIC DATA

None.


PUBLIC ROUTINES

  1. write_field_data

      subroutine write_field_data(filename, fieldname, fielddata)

    DESCRIPTION
    For the purpose of generating higher resolution grid. There is a 2 GB limit of each grid file. The interface will allow the grid information be stored at multiple files.


    INPUT
    filename    The name of the grid file to be generated. If the grid file is over 2 GB limit, it will break into several files with file name filename, filename2, filename3 ....
       [character(len=*)]
    fieldname    name of the field to be written into the file filename
       [character(len=*)]
    fielddata    data of fieldname to be written to the file filename.
       [real, dimension(:,:)]
       [real, dimension(:,:,:)]

  2. gcell

    call gcell (maxlen, n_bounds, bounds, d_bounds, nbpts, num, deltat, deltau, stretch)
    DESCRIPTION
    A domain is composed of one or more regions: Build "num" T cells with resolution "deltat(n) n=1,num" within the domain composed of regions bounded by "bounds". Also construct "num" C-cells of resolution "deltau(n) n=1,num" with the relation between T and U cells given by: deltat(n) = 0.5*(deltau(n-1) + deltau(n)). Resolution may be constant or smoothly varying within each region AND there must be an integral number of grid cells within each region. The domain is the sum of all regions.


    INPUT
    maxlen    maximum length of "deltat" and "deltau"
       [integer]
    n_bounds    number of bounds needed to define the regions
       [integer]
    bounds    latitude, longitude, or depth at each bound
       [real, dimension(n_bounds)]
    d_bounds    delta (resolution) at each of the "bounds"
       [real, dimension(n_bounds)]
    nbpts    number of extra boundary cells to add to the domain. (usually one at the beginning and end)
       [integer]
    stretch    stretching factor for last region (should only be used in the vertical) to provide increased stretching of grid points. "stretch" = 1.0 gives no increased stretching. "stretch" = 1.2 gives increased stretching...etc
       [real]
    debug    flag that controls standard output.
       [logical, optional]

    OUTPUT
    num    total number of grid cells within the domain
       [integer]
    deltat    resolution of T grid cells: n=1,num
       [real, dimension(1-nbpts:maxlen)]
    deltau    resolution of C grid cells: n=1,num
       [real, dimension(1-nbpts:maxlen)]

  3. get_file_unit

     
    get_file_unit (filename)
    DESCRIPTION
    If the file filename is already open, return the io unit of this opened file. Otherwise will open the file and return the io unit.


    INPUT
    filename    The name of the grid file to be generated.
       [character(len=*)]

  4. write_field_meta

    call write_field_meta (filename, fieldname, units, field_longname, fielddim, x_pos, y_pos)
    DESCRIPTION
    It will check if the grid file will over the 2 GB limit. If do, will open a new file with name filename? (? is 1, 2, 3 ....) and write axis metadata to the new file.


    INPUT
    filename    The name of the grid file to be generated. If the grid file is over 2 GB limit, it will break into several files with file name filename, filename1, filename2, filename3 ....
       [character(len=*)]
    fieldname    name of the field to be written into the file filename
       [character(len=*)]
    units    units of field fieldname.
       [character(len=*)]
    field_longname    longname of fielname.
       [character(len=*)]
    fielddim    Indicate the dimension of fieldname. fielddim should be either 2 or 3.
       [integer]
    x_pos, y_pos    To indicate the cell position. its value can be "T" or "C".
       [character(len=1)]

  5. set_grid

    call set_grid (grid_xt, grid_yt, grid_xc, grid_yc)
    DESCRIPTION


    INPUT
    grid_xt, grid_yt    longitude and latitude of the T-cell grid.
       [real, dimension(:)]
    grid_xc, grid_yc    longitude and latitude of the C-cell grid.
       [real, dimension(:)]


DATA SETS

None.


ERROR MESSAGES

None.


top