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

Module numerics_mod

Contact:  Christopher Milly
Reviewers:  Elena Shevliakova Sergey Malyshev
Change History: WebCVS Log


OVERVIEW

A collection of useful general-purpose numerical routines, including a bisect function and linear interpolation routines.



OTHER MODULES USED

fms_mod

PUBLIC INTERFACE

lin_int:
Linear interpolation.
numerics_init:
Initializes the numerics module.
bisect:
Finds a position of point in array of bounds.
my_error:
Reports error, including file name and line.


PUBLIC DATA

None.


PUBLIC ROUTINES

  1. lin_int

    subroutine lin_int(data, xx, x, res)
    
      real, intent(in) :: data(:)    ! data to interpolate
      real, intent(in) :: xx(:)      ! coord. corresponding to data
      real, intent(in) :: x          ! coord to interpolate to
      real, intent(inout) :: res     ! result of interpolation
    subroutine lin_int(data, xx, x, res)
    
      real, intent(in) :: data(:,:)    ! data to interpolate
      real, intent(in) :: xx(:)        ! coord. corresponding to data
      real, intent(in) :: x            ! coord to interpolate to
      real, intent(inout) :: res(:)    ! result of interpolation
    subroutine lin_int(data, tt, t, res)
    
      real, intent(in) :: data(:,:,:)  ! data to interpolate
      real, intent(in) :: tt(:)        ! time moments corresponding to data points
      real, intent(in) :: t            ! time to interpolate to
      real, intent(inout) :: res(:,:)  ! result
    subroutine lin_int(data, xx, x, res, mask)
    
      real, intent(in) :: data(:,:)    ! data to interpolate
      real, intent(in) :: xx(:)        ! coord. corresponding to data
      real, intent(in) :: x            ! coord to interpolate to
      real, intent(inout) :: res(:)    ! result of interpolation
      logical, intent(in) :: mask(:)   ! valid data mask
    subroutine lin_int(data, tt, t, res, mask)
    
      real, intent(in) :: data(:,:,:)  ! data to interpolate
      real, intent(in) :: tt(:)        ! time moments corresponding to data points
      real, intent(in) :: t            ! time to interpolate to
      real, intent(inout) :: res(:,:)  ! result
      logical, intent(in) :: mask(:,:) ! interpolation mask

    DESCRIPTION
    Linear interpolation.


  2. numerics_init

    DESCRIPTION
    Initializes the numerics module.


  3. bisect

    function bisect(xx, x1, periodic)
    
      real, intent(in)              :: xx(:)     ! array of boundaries
      real, intent(in)              :: x1        ! point to locate
      logical, intent(in), optional :: periodic  ! if present and true, the data
                                                 ! domain is assumed to be periodic
    value= bisect ( xx, x1, periodic )
    DESCRIPTION
    Finds a position of point in array of bounds. Returns i, so that x is between xx(i) and xx(i+1).


  4. my_error

    subroutine my_error(mod_name, message, mode, file, line)
    
      character(len=*), intent(in) :: mod_name
      character(len=*), intent(in) :: message
      integer,          intent(in) :: mode
      character(len=*), intent(in) :: file
      integer,          intent(in) :: line
    call my_error (mod_name, message, mode, file, line)
    DESCRIPTION
    Reports error, including file name and line.



DATA SETS

None.


ERROR MESSAGES

FATAL in bisect
Periodic bisect: period equal to zero
Period is equal to zero, [ (xx(n)-xx(1)) / = 0 ]
FATAL in lin_int
Coordinate is out of range
Coordinate corresponding to data is out of range.
FATAL in lin_int
Coordinate is out of range
Time moments corresponding to data points is out of range.
FATAL in lin_int
Coordinate is out of range
Coordinate corresponding to data is out of range.
FATAL in lin_int
Coordinate is out of range
Time moments corresponding to data points is out of range.


top