Contact: | Jeff Anderson |
Reviewers: | |
Revision: | $Revision: 1.2 $ |
Change Date: | $Date: 2004/04/29 23:48:34 $ |
Change history: | see CVS log |
DART interface module for the Lorenz-96 model. The 13 public interfaces are standardized for all DART compliant models. These interfaces allow DART to advance the model, get the model state and metadata describing this state, find state variables that are close to a given location, and do spatial interpolation for model state variables. Other models can be added to DART by providing a module with these interfaces.
types_mod time_manager_mod location_mod utilities_mod
fill in text here
integer :: var
Returns the length of the model state vector as an integer.
real(r8), dimension(:), intent(inout) :: x type(time_type), intent(in) :: time
Advances a model for a single time step if this operation is defined. The time associated with the initial model state is also required. This interface is only required if `synchronous' model state advance is supported (the model is called directly as a Fortran90 subroutine from the assimilation programs). This is generally not the preferred method for large models which can provide a stub for this interface.
x | State vector of length model_size. |
time | Gives time of the initial model state. Needed for models that have real time state requirements, for instance the computation of radiational parameters. Note that DART provides a time_manager_mod module that is used to support time computations throughout the facility. |
integer, intent(in) :: index_in type(location_type), intent(out) :: location integer, optional, intent(out) :: var_type
Returns metadata about a given element, indexed by index_in, in the model state vector. The location defines where the state variable is located (at present, a variety of simple location models for support of gridpoint models are provided) while the type of the variable (for instance temperature, or u wind component) is returned by var_type. The integer values used to indicate different variable types in var_type are themselves defined as public interfaces to model_mod if required. Low order models in which var_type is not necessarily meaningful should simply return a single integer value.
index_in | Index into the long state vector. |
location | Returns location of indexed state variable. The location should use a location_mod that is appropriate for the model domain. For realistic atmospheric models, for instance, a three-dimensional spherical location module that can represent height in a variety of ways is provided. |
var_type | Returns the type of the indexed state variable as an optional argument. |
real(r8), dimension(:), intent(in) :: x type(location_type), intent(in) :: location integer, intent(in) :: itype real(r8) :: var
Given model state, returns the value of variable type interpolated to a given location by a method of the model's choosing. At present, this is the only support for forward operators that is required from the model_mod. As observations with more complex forward operators are explored a significant additional complexity may be required for forward operator interfaces.
x | Model state vector. |
location | Location to which to interpolate. |
itype | Integer indexing which type of state variable is to be interpolated. Can be ignored for low order models with a single type of variable. |
var | Value interpolated to location. |
type(time_type) :: var
Returns the models base time step as a time_type. In the long run, a more general extended interface may be required that specifies the models range of time stepping possibilities.
Called when use of a model is completed to clean up storage, etc. Can be a stub for most applications.
Used for runtime initialization of a model, for instance calculating storage requirements, intializing model parameters, etc. This is the first call made to a model by any DART compliant assimilation routine.
type(time_type), intent(in) :: time
Returns the time at which the model will start if no input initial conditions are to be used. This is frequently used to spin-up models from rest, but is often not meaningfully supported in comprehensive GCMs.
real(r8), dimension(:), intent(out) :: x
Returns default initial conditions for model; generally used for spinning up initial model states. For GCMs can conceivably just return 0's if initial state is always to be provided from input files.
x | Model state vector. |
type(location_type), intent(in) :: oloc real(r8), intent(in) :: radius integer, intent(out) :: inum integer, dimension(:), intent(out) :: indices real(r8), dimension(:), intent(out) :: dist
Returns the number of state variables that are within a given radius (the units for the radius depend upon the location_mod module being used by the model) of an observation at location o_loc. The indices in the long state vector as well as the distance between each close state variable and the observation are also returned, provided there is sufficient storage available for them in the arrays indices and dist. This tends to be the most complicated routine for large models because it must be implemented in a very efficient fashion to support a number of assimilation algorithms.
oloc | Location of observation. |
radius | Maximum distance between state and observation. |
inum | Number of close state variables. |
indices | Indices of close state variables found in long model state vector. If allocated size of this array is too small, only a subset of the close indices is returned. The model_mod gets to decide what subset this is.. |
dist | Distance between observation and state variables indexed in indices array.. |
integer, intent(in) :: ncFileId integer, :: ierr
Function to write model specific attributes to a netCDF file. At present, DART is using the NetCDF format to output diagnostic information. This is not a requirement, and models could choose to provide output in other formats. This function writes the metadata associated with the model to a NetCDF file opened to a file identified by ncFileID.
ncFileId | Integer file descriptor opened to NetCDF file. |
ierr | Returned error code. |
integer, intent(in) :: ncFileID real(r8), dimension(:), intent(in) :: statevec integer, intent(in) :: copyindex integer, intent(in) :: timeindex integer :: ierr
Writes a copy of the state variables to a NetCDF file. Multiple copies of the state for a given time are supported, allowing, for instance, a single file to include multiple ensemble estimates of the state.
ncFileID | Integer file descriptor opened to NetCDF file. |
statevec | State vector. |
copyindex | Integer index to which copy is to be written. |
timeindex | Integer index of which time in the file is being written. |
ierr | Returned error code. |
real(r8), dimension(:), intent(in) :: state real(r8), dimension(:), intent(out) :: pert_state logical, intent(out) :: interf_provided
Given a model state, produces a perturbed model state. This is used to generate initial ensemble conditions perturbed around some control trajectory state when one is preparing to spin-up ensembles. A DART compliant model can choose not to provide an implementation of this algorithm and use the default mechanism in DART by simply returning .false. as a returned value for the interf_provided argument. In this case, DART perturbs the state to generate ensemble members by adding a random sample from a N(0.0, 0.002) distribution independently to each state variable. Models should override this if some structure is required for perturbations or if the magnitude of perturbations in DART is too large. For instance, the CAM GCM moisture fields have values that are generally much smaller than 0.002 and perturbing them by this magnitude can cause serious model errors.
state | State vector to be perturbed. |
pert_state | Perturbed state vector is returned. |
interf_provided | Return false to have DART perturb state . |
We adhere to the F90 standard of starting a namelist with an ampersand '&' and terminating with a slash '/'.
namelist / model_nml / & model_size, forcing, delta_t
This namelist is read in a file called input.nml
Contents | Type | Description |
---|---|---|
model_size | integer | Number of variables in model, default is 40. |
forcing | real(r8) | Forcing, F, for model, default 8.0 |
delta_t | real(r8) | Non-dimensional timestep, default 0.05 |