INTERFACE / PUBLIC COMPONENTS / NAMELIST / FILES / REFERENCES / ERRORS / BUGS / PLANS / PRIVATE COMPONENTS

MODULE location_mod (oned)

Contact: Jeff Anderson
Reviewers:  
Revision: $Revision: 1.6 $
Release Name: $Name: post_iceland $
Change Date: $Date: 2005/02/22 17:03:32 $
Change history: see CVS log (cop-out, I know)

OVERVIEW

Optional arguments are enclosed in brackets [like this].

Provides a representation of a physical location on 1-D periodic domain. A type that abstracts the location is provided along with operators to compute the distance between two locations. This is a member of a class of similar location modules that provide the same abstraction for different represenations of physical space (for instance a three-dimensional spherical shell).




OTHER MODULES USED

types_mod
utilities_mod
random_seq_mod



PUBLIC INTERFACE

use location_mod, only : location_type
 get_dist
 get_location
 set_location
 write_location
 read_location
 interactive_location
 set_location_missing
 query_location
 LocationDims
 LocationName
 LocationLName

NOTES

Optional namelist interface &location_nml may be read from file input.nml.




PUBLIC COMPONENTS




type location_type
   private
   real(r8) :: x
end type location_type

Description

Provides an abstract representation of physical location on a one-dimensional periodic domain.

Component Description
x Location has range 0 to 1


var = get_location(loc)
 real(r8),            intent(inout) :: get_location
 type(location_type), intent(in)    :: loc
 

Description

Extracts the real location value, range 0 to 1, from a location type.

get_location    The real location
loc    A location type


var = set_location(x)
 type(location_type), intent(in) :: set_location
 real(r8), intent(in)            :: x
 

Description

Returns a location type with the location x.

set_location    A location type
x    Location range 0 to 1


call write_location(locfile, loc [,fform])
integer,               intent(in)      ::  locfile 
type(location_type),   intent(in)      ::  loc 
character(len=*), optional, intent(in) ::  fform 

Description

Given an integer IO channel of an open file and a location, writes the location to this file. The fform argument controls whether write is "FORMATTED" or "UNFORMATTED" with default being formatted.

locfile the unit number of the open file.
loc location type to be written.
fform Format specifier (FORMATTED or UNFORMATTED).

Notes


var = get_dist( loc1, loc2)
real(r8)                             ::  get_dist 
type(location_type),     intent(in)  ::  loc1, loc2 

Description

Returns the distance between two locations.

loc1     first location.
loc2 second location.
var distance between loc1 and loc2.


var = read_location(locfile [,fform])
 type(location_type)                    :: read_location
 integer, intent(in)                    :: locfile
 character(len=*), optional, intent(in) :: fform
 

Description

Reads a location_type from a file open on channel locfile using format fform (default is formatted).

read_location    Returned location type read from file
locfile    Integer channel opened to a file to be read
fform    Optional format specifier (FORMATTED or UNFORMATTED)


call interactive_location(location [,set_to_default])
 type(location_type), intent(out) :: location
 logical, optional, intent(in)    :: set_to_default
 

Description

Use standard input to define a location type. With set_to_default true get one with all elements set to 0.

location    Location created from standard input
set_to_default    If true, sets all elements of location type to 0


var = set_location_missing()
 type(location_type) :: set_location_missing
 

Description

Returns a location with location set to missing value from types_mod.

set_location_missing    A location set to missing value


var = query_location(loc [,attr])
 real(r8), intent(out)                  :: query_location
 type(location_type), intent(in)        :: loc
 character(len=*), optional, intent(in) :: attr
 

Description

Returns the value of x (model state component of location type) if attr = 'X' or if attr is not passed.

query_location    Returns value of x.
loc    A location type
attr    Selects 'X'


Global variable: integer :: LocationDims

Contains the number of real values in a location type. Useful for output routines that must deal transparently with many different location modules.


Global variable: character(len=129) :: LocationName

A parameter set to "loc1D" used to identify this location module in netCDF output metadata.


Global variable: character(len=129) :: LocationLName

A parameter set to "one-dimensional location" used to identify this location module in netCDF output long name metadata.


FILES


REFERENCES


ERROR CODES and CONDITIONS

RoutineMessageComment
set_location Value of x is out of 0->1 range x cannot be less than 0 or greater than 1
query_location Only x is legal attribute to request from location attr must be 'x' or 'X'
read_location Expected location header "loc1d" in input file Can only read one-dimensional location files


KNOWN BUGS

None.


FUTURE PLANS

Eventually, a more general file descriptor type should replace the use of the integer unit number.