BMI

new BMI()

"The Basic Model Interface (BMI) JavaScript specification." This language specification is derived from the Scientific Interface Definition Language (SIDL) file bmi.sidl located at https://github.com/csdms/bmi.

Source

Methods

(static) finalize()

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.

(static) get_component_name() → {String}

Gets name of the component.

Returns:
  • The name of the component
Type: 
String

(static) get_current_time(name) → {Number}

Current time of the model

Parameters:
NameTypeDescription
nameString

An input or output variable name, a CSDMS Standard Name

Returns:
  • The current model time.
Type: 
Number

(static) get_end_time() → {Number}

End time of the model

Returns:

-The maximum model time.

Type: 
Number

(static) get_grid_edge_count(grid) → {Number}

Get the number of edges in the grid

Parameters:
NameTypeDescription
gridNumber

A grid identifier

Returns:

The total number of grid edges

Type: 
Number

(static) get_grid_edge_nodes(grid, edge_nodes)

Get the edge-node connectivity.

Parameters:
NameTypeDescription
gridNumber

A grid identifier

edge_nodesArray.<Object>

A Number Array of (2 x n-nodes) shape to place the edge-node connectivity. For each edge, connectivity is given as node at edge tail, followed by node at edge head.

(static) get_grid_face_count(grid) → {Number}

Get the number of faces in the grid.

Parameters:
NameTypeDescription
gridNumber

A grid identifier

Returns:

The total number of grid faces.

Type: 
Number

(static) get_grid_face_edges(grid, face_edges)

Get the face-edge connectivity.

Parameters:
NameTypeDescription
gridNumber

A grid identifier

face_edgesArray.<Object>

A Number Array to place the face-edge connectivity.

(static) get_grid_face_nodes(grid, face_nodes)

Get the face-edge connectivity.

Parameters:
NameTypeDescription
gridNumber

A grid identifier

face_nodesArray.<Object>

A number Array to place the face-node connectivity. For each face, the nodes (listed in a counter-clockwise direction) that form the boundary of the face.

(static) get_grid_node_count(grid) → {Number}

Get the number of nodes in the grid.

Parameters:
NameTypeDescription
gridNumber

A grid identifier

Returns:

The total number of grid nodes

Type: 
Number

(static) get_grid_nodes_per_face(grid, nodes_per_face)

Get the face-edge connectivity.

Parameters:
NameTypeDescription
gridNumber

A grid identifier

nodes_per_faceArray.<Object>

A number Array of (n-faces)shape to place the number of nodes per face.

(static) get_grid_origin(grid, origin)

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

Parameters:
NameTypeDescription
gridNumber

A grid identifier

originArray.<Object>

A number Array of n-dim shape to hold the coordinates of the lower-left corner of the grid.

(static) get_grid_rank(grid) → {Number}

Get number of dimensions of the computational grid.

Parameters:
NameTypeDescription
gridNumber

A grid identifier

Returns:

Rank of the grid.

Type: 
Number

(static) get_grid_shape(grid, shape)

Get dimensions of the computational grid

Parameters:
NameTypeDescription
gridNumber

A grid identifier

shapeArray.<Object>

A Number Array of n-dim shape into which to place the shape of the grid.

(static) get_grid_size(grid) → {Number}

Get the total number of elements in the computational grid.

Parameters:
NameTypeDescription
gridNumber

A grid identifier

Returns:

Size of the grid.

Type: 
Number

(static) get_grid_spacing(grid, spacing)

Get dimensions of the computational grid

Parameters:
NameTypeDescription
gridNumber

A grid identifier

spacingArray.<Object>

A Number Array of n-dim shape to hold the spacing between grid rows and columns.

(static) get_grid_type(grid) → {String}

Get the grid type as a string.

Parameters:
NameTypeDescription
gridNumber

A grid identifier

Returns:

Type of grid as a string.

Type: 
String

(static) get_grid_x(grid, x)

Get coordinates of grid nodes in the x direction.

Parameters:
NameTypeDescription
gridNumber

A grid identifier

xArray.<Object>

A Number Array of n-rows shape to hold the x-coordinates of the grid node columns

(static) get_grid_y(grid, y)

Get coordinates of grid nodes in the y direction.

Parameters:
NameTypeDescription
gridNumber

A grid identifier

yArray.<Object>

A Number Array of n-cols shape to hold the y-coordinates of the grid node rows

(static) get_grid_z(grid, z)

Get coordinates of grid nodes in the z direction.

Parameters:
NameTypeDescription
gridNumber

A grid identifier

zArray.<Object>

A Number Array of n-layers shape to hold the z-coordinates of the grid nodes layers.

(static) get_input_item_count() → {Number}

Count of a model's input variables.

Returns:
  • The number of input variables.
Type: 
Number

(static) get_input_var_names() → {Array.<Object>}

Gets an Array of names for the variables the model can use from other models implementing a BMI.

Returns:
  • The names are returned from the function in an Array, a standard container in the language.
Type: 
Array.<Object>

(static) get_output_item_count() → {Number}

Count of a model's output variables.

Returns:
  • The number of output variables.
Type: 
Number

(static) get_output_var_names() → {Array.<Object>}

Gets an Array of names for the variables the model can provide to other models implementing a BMI.

Returns:
  • The names are returned from the function in an Array, a standard container in the language.
Type: 
Array.<Object>

(static) get_start_time() → {Number}

Start time of the model. Model times should be of type float

Returns:

-The model start time.

Type: 
Number

(static) get_time_step() → {Number}

Current time step of the model. The model time step should be of type Number

Returns:

-The time step used in model.

Type: 
Number

(static) get_time_units() → {String}

Time units of the model

Returns:

-The model time unit; e.g., 'days' or 's'.

Type: 
String

(static) get_value(name, dest) → {Array.<Object>}

Get a copy of values of the given variable. This is a method 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.

Parameters:
NameTypeDescription
nameString

An input or output variable name, a CSDMS Standard Name

destArray.<Object>

An Array into which to place the values

Returns:

-The same Array that was passed as an input.

Type: 
Array.<Object>

(static) get_value_at_indices(name, dest, inds) → {Array.<Object>}

Get values at particular indices.

Parameters:
NameTypeDescription
nameString

An input or output variable name, a CSDMS Standard Name

destArray.<Object>

An Array into which to place the values

indsArray.<Object>

The indices into the variable Array

Returns:

-Value of the model variable at the given location.

Type: 
Array.<Object>

(static) get_value_ptr(name) → {Array.<Object>}

Get a reference to values of the given variable. This is a method 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.

Parameters:
NameTypeDescription
nameString

An input or output variable name, a CSDMS Standard Name

Returns:

-A reference to a model variable.

Type: 
Array.<Object>

(static) get_var_grid(name) → {Number}

Get grid identifier for the given variable.

Parameters:
NameTypeDescription
nameString

An input or output variable name, a CSDMS Standard Name

Returns:
  • The grid identifier.
Type: 
Number

(static) get_var_itemsize(name) → {Number}

Provides the size, in bytes, of a single element of the variable

Parameters:
NameTypeDescription
nameString

An input or output variable name, a CSDMS Standard Name

Returns:
  • Item size in bytes.
Type: 
Number

(static) get_var_location(name) → {String}

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.

Parameters:
NameTypeDescription
nameString

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".
Type: 
String

(static) get_var_nbytes(name) → {Number}

The function provides the total amount of memory used to store a variable; i.e., the number of items multiplied by the size of each item

Parameters:
NameTypeDescription
nameString

An input or output variable name, a CSDMS Standard Name

Returns:
  • the total amount of memory used by the variable is returned from the function.
Type: 
Number

(static) get_var_type(name) → {String}

Get data type of the given variable.

Parameters:
NameTypeDescription
nameString

An input or output variable name, a CSDMS Standard Name

Returns:
  • The variable type; e.g., "str", "int", "float".
Type: 
String

(static) get_var_units(name) → {String}

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.

Parameters:
NameTypeDescription
nameString

An input or output variable name, a CSDMS Standard Name

Returns:
  • The variable units.
Type: 
String

(static) initialize(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".

Parameters:
NameTypeDescription
config_fileString

The path to the model configuration file

Source

(static) set_value(name, src)

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 src, a new value for a model variable, with the type, size and rank of src dependent on the variable.

Parameters:
NameTypeDescription
nameString

An input or output variable name, a CSDMS Standard Name

srcArray.<Object>

The new value for the specified variable

(static) set_value_at_indices(name, inds, src)

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

Parameters:
NameTypeDescription
nameString

An input or output variable name, a CSDMS Standard Name

indsArray.<Object>

The indices into the variable Array

srcArray.<Object>

The new value for the specified variable

(static) update()

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 :function:initialize method and this method can return with no action.

(static) update_until(time)

Advance model state until the given time.

Parameters:
NameTypeDescription
timeNumber

A model time.