BasicModelInterface.finalizeFunction
finalize(model)

Perform tear-down tasks for the model.

Perform all tasks that take place after exiting the model's time loop. This typically includes deallocating memory, closing files and printing reports.

BasicModelInterface.get_grid_edge_nodesFunction
get_grid_edge_nodes(model, grid, edge_nodes)

Get the edge-node connectivity.

Arguments

  • grid: A grid identifier.
  • edge_nodes: An array of integers to place the edge-node connectivity. For each edge, connectivity is given as node at edge tail, followed by node at edge head. Therefore this array must be twice the number of nodes long.

Returns the filled edge_nodes array.

BasicModelInterface.get_grid_face_edgesFunction
get_grid_face_edges(model, grid, face_edges)

Get the face-edge connectivity.

Arguments

  • grid: A grid identifier.
  • face_edges: An array of integers in which to place the face-edge connectivity.

Returns the filled face_edges array.

BasicModelInterface.get_grid_face_nodesFunction
get_grid_face_nodes(model, grid, face_nodes)

Get the face-node connectivity.

Arguments

  • grid: A grid identifier.
  • face_nodes: An array of integers in which to place the face-node connectivity. For each face, the nodes (listed in a counter-clockwise direction) that form the boundary of the face.

Returns the filled face_nodes array.

BasicModelInterface.get_grid_nodes_per_faceFunction
get_grid_nodes_per_face(model, grid, nodes_per_face)

Get the number of nodes for each face.

Arguments

  • grid: A grid identifier.
  • nodes_per_face: An array in which to place the number of edges per face.

Returns the filled nodes_per_face array.

BasicModelInterface.get_grid_originFunction
get_grid_origin(model, grid, origin)

Get coordinates for the lower-left corner of the computational grid.

Arguments

  • grid: A grid identifier.
  • origin: An array to hold the coordinates of the lower-left corner of the grid.

Returns the filled origin array.

BasicModelInterface.get_grid_spacingFunction
get_grid_spacing(model, grid, spacing)

Get distance between nodes of the computational grid.

Arguments

  • grid: A grid identifier.
  • spacing: An array to hold the spacing between grid rows and columns.

Returns the filled spacing array.

BasicModelInterface.get_grid_xFunction
get_grid_x(model, grid, x)

Get coordinates of grid nodes in the x direction.

Arguments

  • grid: A grid identifier.
  • x: An array to hold the x-coordinates of the grid nodes.

Returns the filled x array.

BasicModelInterface.get_grid_yFunction
get_grid_y(model, grid, y)

Get coordinates of grid nodes in the y direction.

Arguments

  • grid: A grid identifier.
  • y: An array to hold the y-coordinates of the grid nodes.

Returns the filled y array.

BasicModelInterface.get_grid_zFunction
get_grid_z(model, grid, z)

Get coordinates of grid nodes in the z direction.

Arguments

  • grid: A grid identifier.
  • z: An array to hold the z-coordinates of the grid nodes.

Returns the filled z array.

BasicModelInterface.get_input_var_namesFunction
get_input_var_names(model)

List of a model's input variables.

Input variable names must be CSDMS Standard Names, also known as long variable names.

Notes

Standard Names enable the CSDMS framework to determine whether an input variable in one model is equivalent to, or compatible with, an output variable in another model. This allows the framework to automatically connect components.

Standard Names do not have to be used within the model.

BasicModelInterface.get_output_var_namesFunction
get_output_var_names(model)

List of a model's output variables.

Output variable names must be CSDMS Standard Names, also known as long variable names.

BasicModelInterface.get_valueFunction
get_value(model, name, dest)

Get a copy of values of the given variable.

This is a getter for the model, used to access the model's current state. It returns a copy of a model variable, with the return type, size and rank dependent on the variable.

Arguments

  • name: An input or output variable name, a CSDMS Standard Name.
  • dest: An array into which to place the values.

Returns

The same array that was passed as an input buffer.

BasicModelInterface.get_value_at_indicesFunction
get_value_at_indices(model, name, dest, inds)

Get values at particular indices.

Arguments

  • name: An input or output variable name, a CSDMS Standard Name.
  • dest: An array into which to place the values.
  • inds: The indices into the variable array.

Returns

array_like Value of the model variable at the given location.

BasicModelInterface.get_value_ptrFunction
get_value_ptr(model, name)

Get a reference to values of the given variable.

This is a getter for the model, used to access the model's current state. It returns a reference to a model variable, with the return type, size and rank dependent on the variable.

The name can be an input or output variable name, a CSDMS Standard Name.

Returns a reference to a model variable.

BasicModelInterface.get_var_gridFunction
get_var_grid(model, name)

Get grid identifier integer for the given variable.

The name can be an input or output variable name, a CSDMS Standard Name.

BasicModelInterface.get_var_itemsizeFunction
get_var_itemsize(model, name)

Get memory use for each array element in bytes.

The name can be an input or output variable name, a CSDMS Standard Name.

BasicModelInterface.get_var_locationFunction
get_var_location(model, name)

Get the grid element type that the a given variable is defined on.

The grid topology can be composed of nodes, edges, and faces.

  • node: A point that has a coordinate pair or triplet: the most basic element of the topology.
  • edge: A line or curve bounded by two nodes.
  • face: A plane or surface enclosed by a set of edges. In a 2D horizontal application one may consider the word "polygon", but in the hierarchy of elements the word "face" is most common.

The name can be an input or output variable name, a CSDMS Standard Name.

Returns

The grid location on which the variable is defined. Must be one of "node", "edge", or "face".

Notes

CSDMS uses the ugrid conventions to define unstructured grids.

BasicModelInterface.get_var_nbytesFunction
get_var_nbytes(model, name)

Get size, in bytes, of the given variable.

The name can be an input or output variable name, a CSDMS Standard Name.

BasicModelInterface.get_var_typeFunction
get_var_type(model, name)

Get data type of the given variable.

The name can be an input or output variable name, a CSDMS Standard Name.

BasicModelInterface.get_var_unitsFunction
get_var_units(model, name)

Get units of the given variable.

Standard unit names, in lower case, should be used, such as $meters$ or $seconds$. Standard abbreviations, like $m$ for meters, are also supported. For variables with compound units, each unit name is separated by a single space, with exponents other than 1 placed immediately after the name, as in $m s-1$ for velocity, $W m-2$ for an energy flux, or $km2$ for an area.

The name can be an input or output variable name, a CSDMS Standard Name.

Notes

CSDMS uses the UDUNITS standard from Unidata.

BasicModelInterface.initializeFunction
initialize(model, [config_file])

Perform startup tasks for the model.

Perform all tasks that take place before entering the model's time loop, including opening files and initializing the model state. Model inputs are read from a text-based configuration file, specified by config_file.

Arguments

config_file : str, optional The path to the model configuration file.

Notes

Models should be refactored, if necessary, to use a configuration file. CSDMS does not impose any constraint on how configuration files are formatted, although YAML is recommended. A template of a model's configuration file with placeholder values is used by the BMI.

BasicModelInterface.set_valueFunction
set_value(model, name, value)

Specify a new value for a model variable.

This is the setter for the model, used to change the model's current state. It accepts, through value, a new value for a model variable, with the type, size and rank of value dependent on the variable.

Arguments

  • name: An input or output variable name, a CSDMS Standard Name.
  • value: The new value for the specified variable.
BasicModelInterface.set_value_at_indicesFunction
set_value_at_indices(model, name, inds, value)

Specify a new value for a model variable at particular indices.

Arguments

  • name: An input or output variable name, a CSDMS Standard Name.
  • inds: The indices into the variable array.
  • value: The new value for the specified variable.
BasicModelInterface.updateFunction
update(model)

Advance model state by one time step.

Perform all tasks that take place within one pass through the model's time loop. This typically includes incrementing all of the model's state variables. If the model's state variables don't change in time, then they can be computed by the :func:initialize method and this method can return with no action.

BasicModelInterface.update_untilFunction
update_until(model, time)

Advance model state until the given time.

The given time must be a model time later than the current model time.