MODULE model_mod (simple_advection)

DART project logo

Jump to DART Documentation Main Index
version information for this file:
$Id: model_mod.html 6382 2013-08-07 20:45:16Z nancy $

NAMELIST / INTERFACES / FILES / REFERENCES / ERRORS / PLANS / PRIVATE COMPONENTS / TERMS OF USE

Overview

DART interface module for the simple advection 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.

This model is on a periodic one-dimensional domain. A wind field is modeled using Burger's Equation with an upstream semi-lagrangian differencing. This diffusive numerical scheme is stable and forcing is provided by adding in random gaussian noise to each wind grid variable independently at each timestep. The domain mean value of the wind is relaxed to a constant fixed value set by the namelist parameter mean_wind. The random forcing magnitude is set by namelist parameter wind_random_amp and the damping of the mean wind is controlled by parameter wind_damping_rate. An Eulerian option with centered in space differencing is also provided and can be used by setting namelist parameter lagrangian_for_wind to .false. The Eulerian differencing is both numerically unstable and subject to shock formation. However, it can sometimes be made stable in assimilation mode (see recent work by Majda and collaborators).

The model state includes a single passive tracer that is advected by the wind field using semi-lagrangian upstream differencing. The state also includes a tracer source value at each gridpoint. At each time step, the source is added into the concentration at each gridpoint. There is also a constant global destruction of tracer that is controlled by the namelist parameter destruction_rate. The appropriate percentage of tracer is destroyed at each gridpoint at each timestep.

The model also includes an associated model for the tracer source rate. At each gridpoint, there is a value of the time mean source rate and a value of the phase offset for a diurnal component of the source rate. The diurnal source rate has an amplitude that is proportional to the source rate (this proportion is controlled by namelist parameter source_diurnal_rel_amp). At each grid point, the source is the sum of the source rate plus the appropriate diurnally varying component. The phase_offset at the gridpoint controls the diurnal phase. The namelist parameter source_phase_noise controls the amplitude of random gaussian noise that is added into the source phase at each time step. If source_phase_noise is zero then the phase offset is fixed. Finally, the time mean source rate is constant in time in the present model version. The time mean source rate controls the amplitude of the diurnal cycle of the tracer source.

[top]

NAMELIST

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.

&model_nml
   num_grid_points        = 10,
   grid_spacing_meters    = 100000.0,
   time_step_days         = 0,
   time_step_seconds      = 3600,  
   mean_wind              = 20.0, 
   wind_random_amp        = 0.00027778,
   wind_damping_rate      = 0.0000027878, 
   lagrangian_for_wind    = .true., 
   destruction_rate       = 0.000055556,
   source_random_amp_frac = 0.00001,
   source_damping_rate    = 0.0000027878,
   source_diurnal_rel_amp = 0.05,
   source_phase_noise     = 0.0,
   output_state_vector  = .false.
/


Item Type Description
num_grid_points integer Number of grid points in model. State vector size is 5 times this number.
grid_spacing_meters integer Grid spacing in meters.
time_step_days real(r8) Number of days for dimensional timestep, mapped to delta_t.
time_step_seconds real(r8) Number of seconds for dimensional timestep, mapped to delta_t.
mean_wind real(r8) Base wind velocity (expected value over time) in meters/second.
wind_random_amp real(r8) Random walk amplitude for wind in meters/second2.
wind_damping_rate real(r8) Rate of damping towards mean wind value in fraction/second.
lagrangian_for_wind logical Can use Lagrangian (stable) or Eulerian (unstable) scheme for wind.
destruction_rate real(r8) Tracer destruction rate in fraction/second.
source_random_amp_frac real(r8) Random walk amplitude for source as a fraction of mean source (per second)2.
source_damping_rate real(r8) Damping towards mean source rate in fraction/second.
source_diurnal_rel_amp real(r8) Relative amplitude of diurnal cycle of source (dimensionless).
source_phase_noise real(r8) Amplitude of gaussian noise to be added to source phase offset (per second).
output_state_vector logical Controls the output to netCDF files. If .true., output the raw dart state vector. If .false. output the prognostic version (gridded data) for easier plotting (recommended).


[top]

OTHER MODULES USED

types_mod
time_manager_mod
oned/location_mod
utilities_mod
obs_kind_mod
random_seq_mod
[top]

PUBLIC INTERFACES

use model_mod, only : get_model_size
 adv_1step
 get_state_meta_data
 model_interpolate
 get_model_time_step
 static_init_model
 end_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

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. For this model, the length is 5 times the number of grid points. The number of grid points is settable by namelist and defaults to 10, giving a total default size of 50.

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 a model for a single time step. The time associated with the initial model state is also input although it is not used in this model.

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 the simple advection model with the default grid size, variable 1 is at 0.0, variable 2 is at 1/10., variable 3 is at 2/10., etc. on a cyclic [0, 1] domain. The variable type, if specified, is an integer kind between 1 and 5. The types are indexed as follows:

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. The type variable selects which type (tracer concentration, tracer source, velocity) is being interpolated. istatus is returned as 0 for a 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 (0 is a good return). This model stops on error, since it should never fail to generate an interpolated value.


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

In this case, it reads the namelist values, allocates space for the state vector, and initializes module variables needed during the run.



call end_model()

A stub since the simple advection model requires no cleanup.



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 model; generally used for spinning up initial model states. This model sets all concentrations to 0, sets up one source, and sets the wind and time/phase defaults to the namelist-specified values.

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. 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. Generates random gaussian values for the tracer concentrations, the U field, the mean source field and the phase.

state State vector to be perturbed.
pert_state Perturbed state vector
interf_provided    Return .true. because it has code to generate the perturbed state


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.

[top]

FILES

[top]

REFERENCES

  1. none
[top]

ERROR CODES and CONDITIONS

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

KNOWN BUGS

none at this time

[top]

FUTURE PLANS

none at this time

[top]

PRIVATE COMPONENTS

N/A

[top]

Terms of Use

DART software - Copyright 2004 - 2013 UCAR.
This open source software is provided by UCAR, "as is",
without charge, subject to all terms of use at
http://www.image.ucar.edu/DAReS/DART/DART_download

Contact: DART core group
Revision: $Revision: 6382 $
Source: $URL: https://svn-dares-dart.cgd.ucar.edu/DART/releases/Lanai/models/simple_advection/model_mod.html $
Change Date: $Date: 2013-08-07 14:45:16 -0600 (Wed, 07 Aug 2013) $
Change history:  try "svn log" or "svn diff"