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

MODULE model_mod (Lorenz_96, forced)

Contact: Jeff Anderson
Revision: $Revision: 2801 $
Source: $URL: http://subversion.ucar.edu/DAReS/DART/trunk/models/forced_lorenz_96/model_mod.html $
Change Date: $Date: 2007-04-04 22:11:48 -0600 (Wed, 04 Apr 2007) $
Change history: try "svn log" or "svn diff"

OVERVIEW

DART interface module for the forced_lorenz-96 model. The 17 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 forced_lorenz_96 model implements the standard L96 equations except that the forcing term, F, is added to the state vector and is assigned an independent value at each gridpoint. The result is a model that is twice as big as the standard L96 model. The forcing can be allowed to vary in time or can be held fixed so that the model looks like the standard L96 but with a state vector that includes the constant forcing term. An option is also included to add random noise to the forcing terms as part of the time tendency computation which can help in assimilation performance. If the random noise option is turned off (see namelist) the time tendency of the forcing terms is 0.




OTHER MODULES USED

types_mod
time_manager_mod
oned/location_mod
utilities_mod
random_seq_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
 nc_write_model_atts
 nc_write_model_vars
 pert_model_state
 get_close_maxdist_init
 get_close_obs_init
 get_close_obs
 ens_mean_for_model

NOTES

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




PUBLIC COMPONENTS

The following routines are public:


var = get_model_size( )
integer                               ::  get_model_size 

Description

Returns the length of the model state vector as an integer.


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

Description

Advances this model for a single time step using a four-step Runga-Kutta. The time argument is not used.

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 element, indexed by index_in, in the model state vector. Returns location of the state variable at the given index. If present, var_type is set to 1 for the default variable type, and set to 2 if the forcing parameter is being assimilated.

index_in Index into the state vector.
location Returned location of indexed state variable.
var_type Returns the type of the indexed state variable as an optional argument. Valid types are 1 and 2.

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 of variable itype 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.

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.
obs_val The value of the observation from the model.
istatus Quality control information about the observation of the model state.

Notes


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

Description

Returns the models base time step, or forecast length, as a time_type. In this model it defaults to 1 hour, but is namelist-settable.

Notes


call end_model( )

Description

A stub routine in this model.

Notes


call static_init_model( )

Description

Reads namelist, allocates space for state vector, initializes state variable locations and time step.

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. Set to 0 in this model.

Notes


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

Description

Returns default initial conditions for model; generally used for spinning up initial model states. Sets the entire state variable to the value of the forcing and then slightly perturbs the first element.

x Model state vector.

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 to output diagnostic information. 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. This model does not provide a model-specific routine and so it returns interf_provided as false.

state State vector to be perturbed
pert_state Perturbed state vector is returned
interf_provided Returns false to have DART perturb state

Notes


call get_close_maxdist_init(gc, maxdist)
 type(get_close_type), intent(inout) :: gc
 real(r8),             intent(in)    :: maxdist
 

Description

Pass-through to the 1-D locations module. See get_close_maxdist_init() for the documentation of this subroutine.


call get_close_obs_init(gc, num, obs)
 type(get_close_type), intent(inout) :: gc
 integer,              intent(in)    :: num
 type(location_type),  intent(in)    :: obs(num)
 

Description

Pass-through to the 1-D locations module. See get_close_obs_init() for the documentation of this subroutine.


call get_close_obs(gc, base_obs_loc, base_obs_kind, obs, obs_kind, num_close, close_ind [, dist])
 type(get_close_type), intent(in)  :: gc
 type(location_type),  intent(in)  :: base_obs_loc
 integer,              intent(in)  :: base_obs_kind
 type(location_type),  intent(in)  :: obs(:)
 integer,              intent(in)  :: obs_kind(:)
 integer,              intent(out) :: num_close
 integer,              intent(out) :: close_ind(:)
 real(r8), optional,   intent(out) :: dist(:)
 

Description

Pass-through to the 1-D locations module. See get_close_obs() for the documentation of this subroutine.


call ens_mean_for_model(ens_mean)
 real(r8), dimension(:), intent(in)  :: ens_mean
 

Description

A NULL INTERFACE in this model.

ens_mean    Ensemble mean state vector




NAMELIST

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

namelist / model_nml /  &
    num_state_vars, forcing, delta_t, &
    time_step_days, time_step_seconds, &
    reset_forcing, random_forcing_amplitude

Discussion

This namelist is read in a file called input.nml

Contents Type Description
num_state_vars 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
time_step_days real(r8) Base model time step maps to this much real time, default 0
time_step_seconds real(r8) Base model time step maps to this much real time, default 3600
reset_forcing logical If true, all forcing values are held fixed at the value specified for the forcing namelist parameter, default false
random_forcing_amplitude real(r8) Standard deviation of the gaussian noise with zero mean that is added to each forcing value's time step, default 0.0



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