MODULE model_mod (Lorenz_63)

DART project logo

Jump to DART Documentation Main Index
version information for this file:
$Id: model_mod.html 11626 2017-05-11 17:27:50Z $



DART interface module for the Lorenz-63 model. The 16 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 is the 3-variable model as described in:

Lorenz, E. N. 1963. Deterministic nonperiodic flow. J. Atmos. Sci. 20, 130-141.

It was developed as a simplified model to study convection rolls in the atmosphere. Plotting the location of the X, Y, Z values as they progress through time traces out the classic 'butterfly' attractor plot which has become an iconic image of chaotic systems:

plot of Lorenz 63 attractor

The system of equations is:

X' = -sigma*X + sigma*Y
Y' = -XZ + rX - Y
Z' =  XY -bZ
The values for the constants are settable by namelist (see below). The default values are:
      r = 28.0_r8
  sigma = 10.0_r8
      b = 8.0_r8 / 3.0_r8

 runga-kutta delta t:    0.01 seconds
 assimilation time step: 60 minutes

This model is an interesting data assimilation test in that different ensemble members may bifurcate over to the other lobe of the attractor on different cycles. Also, as they diverge from each other they do not spread out uniformly in 3D space, but spread along the linear attractor lines.



This namelist is read from the file input.nml. Namelists start with an ampersand '&' and terminate with a slash '/'. Character strings that contain a '/' must be enclosed in quotes to prevent them from prematurely terminating the namelist.

   sigma  = 10.0, 
   r      = 28.0, 
   b      = 2.6666666666667,
   deltat = 0.01,
   time_step_days = 0,
   time_step_seconds = 3600  

Item Type Description
sigma real(r8) Model parameter.
r real(r8) Model parameter.
b real(r8) Model parameter.
deltat real(r8) Non-dimensional timestep. This is mapped to the dimensional timestep specified by time_step_days and time_step_seconds.
time_step_days integer Number of days for dimensional timestep, mapped to deltat.
time_step_seconds integer Number of seconds for dimensional timestep, mapped to deltat.





use model_mod, only : get_model_size

A note about documentation style. Optional arguments are enclosed in brackets [like this].

model_size = get_model_size( )
integer :: get_model_size

Returns the length of the model state vector. Required.

model_size The length of the model state vector.

call adv_1step(x, time)
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 Specifies 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 

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 of state vector element about which information is requested.
location The location of state variable element.
var_type Returns the type (always 1) of the indexed state variable as an optional argument.

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

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 A 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.

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

Returns the time step (forecast length) of the model; The time step defaults to 1 hour but is settable by namelist.

var Smallest time step of model.

call static_init_model()

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.

call end_model()

A stub since lorenz-63 requires no clean up.

call init_time(time)
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. Sets time to 0 in this model.

time Initial model time.

call init_conditions(x)
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 Initial conditions for state vector.

ierr = nc_write_model_atts(ncFileID)
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 to previously-opened netCDF file.
ierr Returns a 0 for successful completion.

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

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 file descriptor to previously-opened netCDF file.
statevec A model state vector.
copyindex Integer index of copy to be written.
timeindex The timestep counter for the given state.
ierr Returns 0 for normal completion.

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

Given a model state, produces a perturbed model state. This particular model does not implement an interface for this and so 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.

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

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)

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(:)

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

A NULL INTERFACE in this model.

ens_mean State vector containing the ensemble mean.



filename purpose
input.nml to read the model_mod namelist the time-history of the model state before assimilation the time-history of the model state after assimilation
dart_log.out [default name] the run-time diagnostic output
dart_log.nml [default name] the record of all the namelists actually USED - contains the default values


  1. Lorenz, E.N., 1963: Deterministic nonperiodic flow. J. Atmos. Sci., 20, 130-141.


Routine Message Comment
Various netCDF-f90 interface error messages From one of the netCDF calls in the named routine


none at this time



none at this time





Terms of Use

DART software - Copyright UCAR. This open source software is provided by UCAR, "as is", without charge, subject to all terms of use at

Contact: DART core group
Revision: $Revision: 11626 $
Source: $URL: $
Change Date: $Date: 2017-05-11 11:27:50 -0600 (Thu, 11 May 2017) $
Change history: try "svn log" or "svn diff"