The fms module provides routines that are commonly used by most FMS modules.
mpp_mod
mpp_domains_mod
mpp_io_mod
fms_io_mod
memutils_mod
constants_mod
call fms_init ( )
call fms_end ( )
file_exist
file_name | A file name (or path name) that is checked for existence. [character] |
field_name | A field name that is checked for existence. [character] |
This function returns a logical result. If field exists in the
file file_name, the result is true, otherwise false is returned.
If the length of character string "field_name" is zero or the first
character is blank, then the returned value will be false.
if the file file_name don't exist, return a false result. [logical] |
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. [logical] |
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] |
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. [integer] |
string_array_index | 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] |
monotonic_array | 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.
mpp_clock_id, mpp_clock_begin, mpp_clock_endand associated parameters that are published:
MPP_CLOCK_SYNC, MPP_CLOCK_DETAILED, CLOCK_COMPONENT, CLOCK_SUBCOMPONENT, CLOCK_MODULE_DRIVER, CLOCK_MODULE, CLOCK_ROUTINE, CLOCK_LOOP, CLOCK_INFRA4) Here is an example of how to time a section of code.
use fms_mod, only: mpp_clock_id, mpp_clock_begin, & mpp_clock_end. MPP_CLOCK_SYNC, & CLOCK_MODULE_DRIVER integer :: id_mycode id_mycode = mpp_clock_id ('mycode loop', flags=MPP_CLOCK_SYNC, grain=CLOCK_MODULE_DRIVER) call mpp_clock_begin (id_mycode) : : ~~ this code will be timed ~~ : : call mpp_clock_end (id_mycode)Note: CLOCK_MODULE_DRIVER can be replaced with CLOCK_COMPONENT, CLOCK_SUBCOMPONENT, CLOCK_MODULE_DRIVER, CLOCK_MODULE, CLOCK_ROUTINE, CLOCK_LOOP, or CLOCK_INFRA.
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)