!
! An example of field table entries could be
!
!"tracer","atmos_mod","sphum"/
!
!"tracer","atmos_mod","sf6"
!"longname","sulf_hex"
!"advection_scheme_horiz","2nd_order"
!"Profile_type","Fixed","surface_value = 0.0E+00"/
!
!"prog_tracers","ocean_mod","age_global"
!horizontal-advection-scheme = mdfl_sweby
!vertical-advection-scheme = mdfl_sweby
!restart_file = ocean_age.res.nc
!
!
! The field table consists of entries in the following format.
!
! The first line of an entry should consist of three quoted strings.
!
! The first quoted string will tell the field manager what type of
! field it is.
!
! The second quoted string will tell the field manager which model the
! field is being applied to.
! The supported types at present are
!
! "coupler_mod" for the coupler,
! "atmos_mod" for the atmosphere model,
! "ocean_mod" for the ocean model,
! "land_mod" for the land model, and,
! "ice_mod" for the ice model.
!
! The third quoted string should be a unique name that can be used as a
! query.
!
! The second and following lines of each entry are called methods in
! this context. Methods can be developed within any module and these
! modules can query the field manager to find any methods that are
! supplied in the field table.
!
! These lines can be coded quite flexibly.
!
! The line can consist of two or three quoted strings or a simple unquoted
! string.
!
! If the line consists two or three quoted strings, then the first string will
! be an identifier that the querying module will ask for.
!
! The second string will be a name that the querying module can use to
! set up values for the module.
!
! The third string, if present, can supply parameters to the calling module that can be
! parsed and used to further modify values.
!
! If the line consists of a simple unquoted string then quotes are not allowed
! in any part of the line.
!
! An entry is ended with a backslash (/) as the final character in a
! row.
!
! Comments can be inserted in the field table by having a # as the
! first character in the line.
!
! In the example above we have three field entries.
!
! The first is a simple declaration of a tracer called "sphum".
!
! The second is for a tracer called "sf6". In this case a field named
! "longname" will be given the value "sulf_hex". A field named
! "advection_scheme_horiz" will be given the value "2nd_order". Finally a field
! name "Profile_type" will be given a child field called "Fixed", and that field
! will be given a field called "surface_value" with a real value of 0.0E+00.
!
! The third entry is an example of a oceanic age tracer. Note that the
! method lines are formatted differently here. This is the flexibility mentioned
! above.
!
! With these formats, a number of restrictions are required.
!
! The following formats are equally valid.
!
! "longname","sulf_hex"
! "longname = sulf_hex"
! longname = sulf_hex
!
! However the following is not valid.
!
! longname = "sulf_hex"
!
!
! In the SF6 example above the last line of the entry could be written in the
! following ways.
!
! "Profile_type","Fixed","surface_value = 0.0E+00"/
! Profile_type/Fixed/surface_value = 0.0E+00/
!
!
! Values supplied with fields are converted to the various types with the
! following assumptions.
!
! Real values : These values contain a decimal point or are in exponential format.
! These values only support e or E format for exponentials.
! e.g. 10.0, 1e10 and 1E10 are considered to be real numbers.
!
! Integer values : These values only contain numbers.
! e.g 10 is an integer. 10.0 and 1e10 are not.
!
! Logical values : These values are supplied as one of the following formats.
! T, .T., TRUE, .TRUE.
! t, .t., true, .true.
! F, .F., FALSE, .FALSE.
! f, .f., false, .false.
! These will be converted to T or F in a dump of the field.
!
! Character strings : These values are assumed to be strings if a character
! other than an e (or E) is in the value. Numbers can be suppled in the value.
! If the value does not meet the criteria for a real, integer or logical type,
! it is assumed to be a character type.
!
! The entries within the field table can be designed by the individual
! authors of code to allow modification of their routines.
!
!
use mpp_mod, only : mpp_error, &
FATAL, &
NOTE, &
WARNING, &
mpp_pe, &
mpp_root_pe, &
stdlog, &
stdout
use mpp_io_mod, only : mpp_io_init, &
mpp_open, &
mpp_close, &
MPP_ASCII, &
MPP_RDONLY
use fms_mod, only : lowercase, &
file_exist, &
write_version_number
implicit none
private
character(len=128) :: version = '$Id: field_manager.F90,v 17.0 2009/07/21 03:19:13 fms Exp $'
character(len=128) :: tagname = '$Name: mom4p1_pubrel_dec2009_nnz $'
logical :: module_is_initialized = .false.
!+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
! Public routines
! Interface definitions (optional arguments are in [brackets]):
!+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
public :: field_manager_init ! (nfields, [table_name]) returns number of fields
public :: field_manager_end ! ()
public :: find_field_index ! (model, field_name) or (list_path)
public :: find_field_index_old ! (model, field_name) returns index of field_name in
public :: find_field_index_new ! (list_path) returns index of field_name in
! component model model
public :: get_field_info ! (n,fld_type,fld_name,model,num_methods)
! Returns parameters relating to field n.
public :: get_field_method ! (n, m, method) Returns the m-th method of field n
public :: get_field_methods ! (n, methods) Returns the methods related to field n
public :: parse ! (text, label, values) Overloaded function to parse integer,
! real or character. Parse returns the number of values
! decoded (> 1 => an array of values)
public :: fm_change_list ! (list) return success
public :: fm_change_root ! (list) return success
public :: fm_dump_list ! (list [, recursive]) return success
public :: fm_exists ! (field) return success
public :: fm_get_index ! (field) return index
public :: fm_get_current_list ! () return path
public :: fm_get_length ! (list) return length
public :: fm_get_type ! (field) return string
public :: fm_get_value ! (entry, value [, index]) return success !! generic
public :: fm_get_value_integer ! as above (overloaded function)
public :: fm_get_value_logical ! as above (overloaded function)
public :: fm_get_value_real ! as above (overloaded function)
public :: fm_get_value_string ! as above (overloaded function)
public :: fm_intersection ! (lists, num_lists) return fm_array_list pointer
public :: fm_loop_over_list ! (list, name, type, index) return success
public :: fm_new_list ! (list [, create] [, keep]) return index
public :: fm_new_value ! (entry, value [, create] [, index]) return index !! generic
public :: fm_new_value_integer ! as above (overloaded function)
public :: fm_new_value_logical ! as above (overloaded function)
public :: fm_new_value_real ! as above (overloaded function)
public :: fm_new_value_string ! as above (overloaded function)
public :: fm_reset_loop ! ()
public :: fm_return_root ! () return success
public :: fm_modify_name ! (oldname, newname) return success
public :: fm_query_method ! (name, method_name, method_control) return success and
! name and control strings
public :: fm_find_methods ! (list, methods, control) return success and name and
! control strings.
public :: fm_copy_list ! (list, suffix, [create]) return index
public :: fm_set_verbosity ! ([verbosity])
!+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
! Private routines
! Interface definitions (optional arguments are in [brackets]):
!+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
private :: create_field ! (list_p, name) return field pointer
private :: dump_list ! (list_p, recursive, depth) return success
private :: find_base ! (field, path, base)
private :: find_field ! (field, list_p) return field pointer
private :: find_head ! (field, head, rest)
private :: find_list ! (list, list_p, create) return field pointer
private :: get_field ! (field, list_p) return field pointer
private :: initialize ! ()
private :: make_list ! (list_p, name) return field pointer
!+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
! Public parameters
!+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
integer, parameter, public :: fm_field_name_len = 48
!