The fms module provides routines that are commonly used by most FMS modules.
mpp_mod
mpp_domains_mod
mpp_io_mod
fms_io_mod
call fms_init ( )
call fms_end ( )
file_exist ( file_name )
file_name | A file name (or path name) that is checked for existence. [character] |
This function returns a logical result. If file_name exists the result
is true, otherwise false is returned.
If the length of character string "file_name" is zero or the first
character is blank, then the returned value will be false.
When reading a file, this function is often used in conjunction with
routine open_file. [] |
call error_mesg ( routine, message, level )
routine | Routine name where the warning or error has occurred. [character] |
message | Warning or error message to be printed. [character] |
level | Level of severity; set to NOTE, WARNING, or FATAL Termination always occurs
for FATAL, never for NOTE, and is settable for WARNING (see namelist). [integer] |
use fms_mod, only: error_mesg, FATAL, NOTE call error_mesg ('fms_mod', 'initialization not called', FATAL) call error_mesg ('fms_mod', 'fms_mod message', NOTE)
check_nml_error ( iostat, nml_name )
iostat | The iostat value returned when reading a namelist record. [integer] |
nml_name | The name of the namelist. This name will be printed if an error is
encountered, otherwise the name is not used. [character] |
This function returns the input iostat value (integer) if it is an
allowable error code. If the iostat error code is not
allowable, an error message is printed and the program terminated. [integer] |
integer :: unit, ierr, io if ( file_exist('input.nml') ) then unit = open_namelist_file ( ) ierr=1 do while (ierr /= 0) read (unit, nml=moist_processes_nml, iostat=io, end=10) ierr = check_nml_error(io,'moist_processes_nml') enddo 10 call close_file (unit) endif
call write_version_number ( version [, tag, unit] )
version | string that contains routine name and version number. [character(len=*)] |
tag | The tag/name string, this is usually the Name string
returned by CVS when checking out the code. [character(len=*)] |
unit | The Fortran unit number of an open formatted file. If this unit number
is not supplied the log file unit number is used (stdlog). [integer] |
id = mpp_clock_init ( name, level [, flags] )
name | A unique name string given to the code segment to be timed.
The length should not exceed 32 characters. [character] |
level | Level of timing. When level > timing_level, which is
set by namelist &fms_nml, an identifier
of zero is returned.
This will turn off performance timing for the code section. [integer] |
flags | Use the flags published via the mpp_mod to control whether
synchronization or extra detail is desired. (flags =
MPP_CLOCK_SYNC, MPP_CLOCK_DETAILED) [integer] |
id | The identification index returned by mpp_clocks_id. A zero value is
returned (turning clocks off) when input argument level > namelist
variable timing_level. [integer] |
level example code section 1 main program 2 components models 3 atmosphere dynamics or physicsExamples:
use fms_mod, only: mpp_clock_init, mpp_clock_begin, & mpp_clock_end. MPP_CLOCK_SYNC integer :: id_mycode integer :: timing_level = 5 id_mycode = mpp_clock_init ('mycode loop', timing_level, & flags=MPP_CLOCK_SYNC) call mpp_clock_begin (id_mycode) : : ~~ this code will be timed ~~ : : call mpp_clock_end (id_mycode)
string = lowercase ( cs )
cs | Character string that may contain upper case letters. [character(len=*), scalar] |
string | Character string that contains all lower case letters. The
length of this string must be the same as the input string. [character(len=len(cs)), scalar] |
string = uppercase ( cs )
cs | Character string that may contain lower case letters. [character(len=*), scalar] |
string | Character string that contains all upper case letters. The
length of this string must be the same as the input string. [character(len=len(cs)), scalar] |
string_array_index ( string, string_array [, index] )
string | Character string of arbitrary length. [character(len=*), scalar] |
string_array | Array/list of character strings. [character(len=*), dimension(:)] |
index | The index of string_array where the first match was found. If
no match was found then index = 0. [] |
found | If an exact match was found then TRUE is returned, otherwise FALSE is returned. [logical] |
string = "def" string_array = (/ "abcd", "def ", "fghi" /) string_array_index ( string, string_array, index ) Returns: TRUE, index = 2
monotonic_array ( array [, direction] )
array | An array of real values. If the size(array) < 2 this function
assumes the array is not monotonic, no fatal error will occur. [real, dimension(:)] |
direction | If the input array is:
>> monotonic (small to large) then direction = +1.
>> monotonic (large to small) then direction = -1.
>> not monotonic then direction = 0. [integer] |
If the input array of real values either increases or decreases monotonically
then TRUE is returned, otherwise FALSE is returned. [logical] |
Namelist error checking may not work correctly with some compilers.
Users should beware when mixing Fortran reads and read_data calls. If a
Fortran read follows read_data and namelist variable read_all_pe = FALSE
(not the default), then the code will fail. It is safest if Fortran reads
precede calls to read_data.
NetCDF facilities for reading and writing restart files and (IEEE32) data files.
May possible split the FMS module into two modules.
i.general utilities (FMS_MOD)
ii.I/O utilities (FMS_IO_MOD)