INTERFACE / PUBLIC COMPONENTS / NAMELIST / FILES / REFERENCES / ERRORS / BUGS / PLANS / PRIVATE COMPONENTS

MODULE model_mod (9-variable)

Contact: Jeff Anderson
Reviewers:  
Revision: $Revision: 1.1 $
Release Name: $Name: iceland $
Change Date: $Date: 2005/06/12 17:19:33 $
Change history: see CVS log

OVERVIEW

DART interface module for the 9-variable 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. This model provides interesting transient off-attractor behavior that is something like gravity waves.




OTHER MODULES USED

types_mod
time_manager_mod
oned/location_mod
utilities_mod



PUBLIC INTERFACE

use model_mod, only : get_model_size
 adv_1step
 get_state_meta_data
 model_interpolate
 get_model_time_step
 end_model
 static_init_model
 init_time
 init_conditions
 model_get_close_states
 nc_write_model_atts
 nc_write_model_vars
 pert_model_state

NOTES

Optional namelist interface &model_mod_nml may be read from file input.nml.




PUBLIC COMPONENTS


var = get_model_size( )
integer                               ::  get_model_size 

Description

Returns the length of the model state vector, 9.


call adv_1step(x, time)
real(r8), dimension(:),   intent(inout) ::  x 
type(time_type),          intent(in)    ::  time 

Description

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.


call get_state_meta_data (index_in, location, [,var_type] )
integer,                  intent(in)    ::  index_in 
type(location_type),      intent(out)   ::  location 
integer, optional,        intent(out)   ::  var_type 

Description

Returns metadata about a given state vector element, indexed by index_in, in the model state vector. The location defines where the state variable is located. For 9-variable, the three X variables are at 0, 1/9, and 2/9, the three Y variables at 3/9, 4/9 and 5/9, and the three z variables at 6/9, 7/9, and 8/9 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.

Notes


call model_interpolate(x, location, itype, obs_val, istatus)
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 

Description

Given model state, returns the value interpolated to a given location in [0, 1] by linear interpolation. Variable locations are at i/9, i = 0, 1, ...,8, in the cyclic [0, 1] domain. So, a value of 1/18 is an average of the X1 and X2 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.

Notes


var = get_model_time_step( )
type(time_type)                       ::  get_model_time_step 

Description

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.

Notes


call end_model( )

Description

A stub since 9-variable requires no clean up.

Notes


call static_init_model( )

Description

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.

Notes


call init_time(time)
type(time_type),          intent(out)    ::  time 

Description

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.

Notes


call init_conditions( x )
real(r8), dimension(:),   intent(out)   ::  x 

Description

Returns default initial conditions for the model; generally used for spinning up initial model states. Values chosen here are 0.1 for all nine state variables.

x Model state vector.

Notes


call model_get_close_states( o_loc, radius, inum, indices, dist, x)
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 

Description

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 9-variable.

Notes


ierr = nc_write_model_atts(ncFileId)
integer,                              ::  nc_write_model_atts 
integer,                  intent(in)  ::  ncFileId 

Description

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.

Notes


ierr = nc_write_model_vars(ncFileID, statevec, copyindex, timeindex)
integer                               ::  nc_write_model_vars 
integer,                  intent(in)  ::  ncFileID 
real(r8), dimension(:),   intent(in)  ::  statevec 
integer,                  intent(in)  ::  copyindex
integer,                  intent(in)  ::  timeindex 

Description

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.

Notes


call pert_model_state(state, pert_state, interf_provided)
real(r8), dimension(:),   intent(in)    ::  state 
real(r8), dimension(:),   intent(out)   ::  pert_state 
logical,                  intent(out)   ::  interf_provided 

Description

Given a model state, produces a perturbed model state. 9-variable 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.

Notes




NAMELIST

We adhere to the F90 standard of starting a namelist with an ampersand '&' and terminating with a slash '/'.

namelist / model_nml /  &
    g, delta_t, time_step_days, time_step_seconds

Discussion

This namelist is read in a file called input.nml

Contents Type Description
g real(r8) Model parameter, see comp_dt in code for equations. Default: 8.
delta_t real(r8) Non-dimensional timestep, default 1/12. 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



FILES




REFERENCES


ERROR CODES and CONDITIONS

RoutineMessageComment
nc_write_model_atts
nc_write_model_vars
Various NetCDF-f90 interface error messages From one of the NetCDF calls in the named routine



KNOWN BUGS




FUTURE PLANS