Contact: | Jeff Anderson |
Reviewers: | |
Revision: | $Revision: 1.1 $ |
Release Name: | $Name: $ |
Change Date: | $Date: 2005/06/12 17:18:08 $ |
Change history: | see CVS log |
DART interface module for the Lorenz-63 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. The distinctive part of the model interfaces is the namelist.
types_mod time_manager_mod oned/location_mod utilities_mod
Optional namelist interface &model_mod_nml may be read from file input.nml.
integer :: get_model_size
Returns the length of the model state vector, 3.
real(r8), dimension(:), intent(inout) :: x type(time_type), intent(in) :: time
Advances the model for a single time step. The time associated with the initial model state is also input although it is not used for the computation.
x | State vector of length model_size. |
time | Gives time of the initial model state. |
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. For lorenz-63, the variable 1 (x) is at 0.0, the variable 2 (y) at 1/3, and the variable 3 (z) at 2/3 on a cyclic [0, 1] domain. The variable type is always returned as 1.
index_in | Index into the long state vector. |
location | Returns location of indexed state variable. |
var_type | Returns the type (always 1) 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 real(r8), intent(out) :: obs_val integer, intent(out) :: istatus
Given model state, returns the value interpolated to a given location in [0, 1] by linear interpolation. Variable locations are at 0, 1/3 and 2/3 in the cyclic [0, 1] domain. So, a value of 1/6 is an average of the x and y variables. The type variable is not used here and istatus is always returned as 0 (successful interpolation).
x | Model state vector. |
location | Location to which to interpolate. |
itype | Not used. |
obs_val | The interpolated value from the model. |
istatus | Quality control information, always returned 0. |
type(time_type) :: get_model_time_step
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.
A stub since lorenz-63 requires no clean up.
Used for runtime initialization of model; reads namelist, initializes model parameters, etc. This is the first call made to the model by any DART compliant assimilation routine.
type(time_type), intent(out) :: time
Returns the time at which the model will start if no input initial conditions are to be used. This is used to spin-up the model from rest.
real(r8), dimension(:), intent(out) :: x
Returns default initial conditions for the model; generally used for spinning up initial model states. Values chosen here are 0.1 for all three state variables.
x | Model state vector. |
type(location_type), intent(in) :: o_loc real(r8), intent(in) :: radius integer, intent(out) :: inum integer, dimension(:), intent(out) :: indices real(r8), dimension(:), intent(out) :: dist real(r8), dimension(:), intent(in) :: x
Returns the number of state variables that are within a given radius 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.
o_loc | 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. |
dist | Distance between observation and state variables indexed in indices array.. |
x | Model state vector. Not used in lorenz-63. |
integer, :: nc_write_model_atts integer, intent(in) :: ncFileId
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 :: nc_write_model_vars integer, intent(in) :: ncFileID real(r8), dimension(:), intent(in) :: statevec integer, intent(in) :: copyindex integer, intent(in) :: timeindex
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. Lorenz-63 does not implement an interface for this and so just returns .false. for interf_provided.
state | State vector to be perturbed. |
pert_state | Perturbed state vector: NOT returned. |
interf_provided | Returned false; interface is not implemented. |
We adhere to the F90 standard of starting a namelist with an ampersand '&' and terminating with a slash '/'.
namelist / model_nml / & sigma, r, b, delta_t, time_step_days, time_step_seconds
This namelist is read in a file called input.nml
Contents | Type | Description |
---|---|---|
sigma | real(r8) | Model parameter, see comp_dt in code for equations. Default: 10. |
r | real(r8) | Model parameter, see comp_dt in code for equations. Default: 28. |
b | real(r8) | Model parameter, see comp_dt in code for equations. Default: 8/3. |
delta_t | real(r8) | Non-dimensional timestep, default 0.05. This is mapped to the dimensional timestep specified by time_step_days and time_step_seconds. |
time_step_days | real(r8) | Number of days for dimensional timestep, mapped to delta_t. Default: 0. |
time_step_seconds | real(r8) | Number of seconds for dimensional timestep, mapped to delta_t. Default: 3600 |
Routine | Message | Comment |
---|---|---|
nc_write_model_atts nc_write_model_vars |
Various NetCDF-f90 interface error messages | From one of the NetCDF calls in the named routine |