Contact: | Jeff Anderson |
Revision: | $Revision: 2801 $ |
Source: | $URL: http://subversion.ucar.edu/DAReS/DART/trunk/models/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" |
DART interface module for the 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.
Quoting from the Lorenz 1998 paper:
... the authors introduce a model consisting of 40 ordinary differential equations, with the dependent variables representing values of some atmospheric quantity at 40 sites spaced equally about a latitude circle. The equations contain quadratic, linear, and constant terms representing advection, dissipation, and external forcing. Numerical integration indicates that small errors (differences between solutions) tend to double in about 2 days. Localized errors tend to spread eastward as they grow, encircling the globe after about 14 days.
...
We have chosen a model with J variables, denoted by X1, ..., XJ; in most of our experiments we have let J = 40. The governing equations are:
dXj/dt = (Xj+1 - Xj-2)Xj-1 - Xj + F (1)for j = 1, ..., J. To make Eq. (1) meaningful for all values of j we define X-1 = XJ-1, X0 = XJ, and XJ+1 = X1, so that the variables form a cyclic chain, and may be looked at as values of some unspecified scalar meteorological quantity, perhaps vorticity or temperature, at J equally spaced sites extending around a latitude circle. Nothing will simulate the atmosphere's latitudinal or vertical extent.
See the references section for more details.
types_mod time_manager_mod oned/location_mod utilities_mod
Optional namelist interface &model_nml may be read from file input.nml.
The following routines are public:
integer :: get_model_size
Returns the length of the model state vector, which is settable by namelist and defaults to 40.
real(r8), dimension(:), intent(inout) :: x type(time_type), intent(in) :: time
Advances a model for a single time step. The time associated with the initial model state is also input although is it not used in this model.
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-96, variable 1 is at 0.0, variable 2 is at 1/40., variable 3 is at 2/40., etc. 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 | If present, always returns 1 as the type |
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. 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 (OK) |
type(time_type) :: get_model_time_step
Returns the models base time step, or forecast length, as a time_type. This is settable via namelist and defaults to 1 hour.
A stub since lorenz 96 requires no cleanup.
Used for runtime initialization of a model, for instance calculating storage requirements, initializing model parameters, etc. This is the first call made to a 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 model sets the time to 0.
real(r8), dimension(:), intent(out) :: x
Returns default initial conditions for model; generally used for spinning up initial model states. This model sets all state variables to the forcing value and then perturbs the first variable slightly.
x | Model state vector. |
integer, :: nc_write_model_atts integer, intent(in) :: ncFileId
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. |
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-96 does not implement an interface for this and returns .false. for interf_provided.
state | State vector to be perturbed |
pert_state | Perturbed state vector is NOT returned |
interf_provided | Return false to have DART perturb state |
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.
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.
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.
real(r8), dimension(:), intent(in) :: ens_mean
A NULL INTERFACE in this model.
ens_mean | Ensemble mean state vector |
We adhere to the F90 standard of starting a namelist with an ampersand '&' and terminating with a slash '/'.
namelist / model_nml / & model_size, forcing, delta_t, time_step_days, time_step_seconds
This namelist is read in a file called input.nml
Contents | Type | Description |
---|---|---|
model_size | 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 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 |
Lorenz, E. N., 1995: Predictability: A Problem Partly Solved. Proc. Seminar on Predictability. 1, ECMWF, Reading, Berkshire, UK, 1-18.
Lorenz, E. N., and K. A. Emanuel, 1998: Optimal sites for supplementary weather observations: Simulations with a small model. J. Atmos. Sci., 55, 399-414.
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 |