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

MODULE model_mod (Lorenz_04)

Contact: Jeff Anderson
Revision: $Revision: 2801 $
Source: $URL: http://subversion.ucar.edu/DAReS/DART/trunk/models/lorenz_04/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 Lorenz-05 models II and III. 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 reference for these models is Lorenz, E.N., 2005: Designing chaotic models. J. Atmos. Sci., 62, 1574-1587.

Model II is a single-scale model, similar to Lorenz 96, but with spatial continuity in the waves. Model III is a two-scale model. It is fudamentally different from the Lorenz 96 two-scale model because of the spatial continuity and the fact that both scales are projected onto a single variable of integration. The scale separation is achived by a spatial filter and is therefore not perfect (i.e. there is leakage). The slow scale in model III is model II, and thus model II is a deficient form of model III. The basic equations are documented in Lorenz (2005) and also in the model_mod.f90 code. The user is free to choose model II or III with a Namelist variable.




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
 nc_write_model_atts
 nc_write_model_vars
 nc_read_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

Public routines in this model are:




var = get_model_size( )
integer                               :: var

Description

Returns the length of the model state vector as an integer. Settable by namelist, the default is 960.




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

Description

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

x State vector of length model_size.
time Gives time of the initial model state. Not used by this model.



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. 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. In this model there are no types so it always returns 1.

index_in Index into the state vector.
location Returns location of indexed state variable
var_type If present always returns 1

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),                 intent(out) ::  obs_val 
integer,                  intent(out) ::  istatus 

Description

Given model state, returns the value of variable itype interpolated to a given location.

x Model state vector.
location Location to which to interpolate.
itype Integer indexing which type of state variable is to be interpolated. Is ignored for this model since there is only 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. 0 == successful.

Notes




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

Description

Returns the model time_step, which is settable by namelist.

var The base time step of the model. The forecast length.

Notes




call end_model( )

Description

A stub routine in this model.

Notes




call static_init_model( )

Description

Reads the namelist, allocates space for the state vector, initializes the locations, generates some initial parameters.

Notes




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

Description

Returns the time at which the model will start if no input initial conditions are to be used. This model sets initial time to 0.

time The time at which the model will start if no input initial conditions are to be used.

Notes




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

Description

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,                              :: ierr
integer,                  intent(in)  :: ncFileId

Description

Function to write model specific attributes to a netCDF file. 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. 0 == normal termination

Notes




ierr = nc_write_model_vars(ncFileID, statevec, copyindex, timeindex)
integer                               :: ierr
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 connected to NetCDF file.
statevec State vector.
copyindex Integer index to which copy in the file is to be written.
timeindex Integer index of which time in the file is being written.
ierr Returned error code. 0 == normal termination.

Notes




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

Description

A general interface routine to read the state vector at a particular time for a particular ensemble member.

ierr Returned error code. 0 == normal termination.
ncFileID     Integer file descriptor connected to NetCDF file.
statevec State vector.
copyindex Integer index to designate copy to be read.
timeindex Integer index of desired time to be read.

Notes

This interface is essentially untested in the Lorenz 04/05 model. It began life as a stub, but there is so little to it ... TJH 05 Aug 2005.




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 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. This model returns .false. for interf_provided and uses the default DART perturbation routine.

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

Notes

The Lorenz 04/05 model relies implicitly on the default DART perturbation mechanism, i.e. this routine always returns .false..


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 '/'. If the namelist extends over more than one F90 line, the F90 continuation character must be used, this is also an ampersand (just to confuse things).

namelist / model_nml /       &
   model_size, forcing, delta_t, space_time_scale, &
   coupling, K, smooth_steps,                      &
   time_step_days, time_step_seconds, model_number

Discussion

This namelist is read in a file called input.nml

Contents Type Description
model_size integer Number of variables in model, default is 960.
forcing real(r8) Forcing, F, for model, default 15.0
delta_t real(r8) Non-dimensional timestep, default 0.001
space_time_scale real(r8) Determines temporal and spatial relationship between fast and slow variables (model III), default 10.0
coupling real(r8) Linear coupling between fast and slow variables (model III), default 3.0
K integer Determines the wavenumber of the slow variables (K=1, smooth_steps=0 reduces model II to Lorenz 96), default 32
smooth_steps integer Determines filter length to separate fast and slow scales, default 12
time_step_days integer Arbitrary real time step days, default 0
time_step_seconds integer Arbitrary real time step seconds (could choose this for proper scaling), default 3600
model_number integer 2 = single-scale, 3 = 2-scale. (This follows the notation in the paper.) default 3



FILES




REFERENCES

The reference for these models is Lorenz, E.N., 2005: Designing chaotic models. J. Atmos. Sci., 62, 1574-1587.


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