The Basic Model Interface (BMI) defines an interface for converting a standalone model into an integrated modeling framework component.
Basic Model Interface for the Dakota iterative systems analysis toolkit.
dakotathon.bmi.
BmiDakota
[source]¶Bases: bmipy.bmi.Bmi
The BMI implementation for the CSDMS Dakota interface.
finalize
()[source]¶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.
get_grid_edge_count
(grid)[source]¶Get the number of edges in the grid.
get_grid_edge_nodes
(grid, edge_nodes)[source]¶Get the edge-node connectivity.
get_grid_face_count
(grid)[source]¶Get the number of faces in the grid.
get_grid_face_nodes
(grid, face_nodes)[source]¶Get the face-node connectivity.
get_grid_node_count
(grid)[source]¶Get the number of nodes in the grid.
get_grid_nodes_per_face
(grid, nodes_per_face)[source]¶Get the number of nodes for each face.
get_grid_origin
(grid, origin)[source]¶Get coordinates for the lower-left corner of the computational grid.
get_grid_rank
(grid)[source]¶Get number of dimensions of the computational grid.
get_grid_shape
(grid, shape)[source]¶Get dimensions of the computational grid.
get_grid_size
(grid)[source]¶Get the total number of elements in the computational grid.
get_grid_spacing
(grid, spacing)[source]¶Get distance between nodes of the computational grid.
get_grid_type
(grid)[source]¶Get the grid type as a string.
get_grid_x
(grid, x)[source]¶Get coordinates of grid nodes in the x direction.
get_grid_y
(grid, y)[source]¶Get coordinates of grid nodes in the y direction.
get_grid_z
(grid, z)[source]¶Get coordinates of grid nodes in the z direction.
get_input_var_names
()[source]¶List of a model’s input variables.
Input variable names must be CSDMS Standard Names, also known as long variable names.
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.
get_output_var_names
()[source]¶List of a model’s output variables.
Output variable names must be CSDMS Standard Names, also known as long variable names.
get_start_time
()[source]¶Start time of the model.
Model times should be of type float.
get_time_step
()[source]¶Current time step of the model.
The model time step should be of type float.
get_time_units
()[source]¶Time units of the model.
CSDMS uses the UDUNITS standard from Unidata.
get_value
(name, dest)[source]¶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.
get_value_at_indices
(name, dest, inds)[source]¶Get values at particular indices.
get_value_ptr
(name)[source]¶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.
get_var_grid
(name)[source]¶Get grid identifier for the given variable.
get_var_itemsize
(name)[source]¶Get memory use for each array element in bytes.
get_var_location
(name)[source]¶Get the grid element type that the a given variable is defined on.
The grid topology can be composed of nodes, edges, and faces.
CSDMS uses the ugrid conventions to define unstructured grids.
get_var_nbytes
(name)[source]¶Get size, in bytes, of the given variable.
get_var_type
(name)[source]¶Get data type of the given variable.
str
, int
, float
.get_var_units
(name)[source]¶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.
CSDMS uses the UDUNITS standard from Unidata.
initialize
(config_file)[source]¶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 filename.
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.
set_value
(name, values)[source]¶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.
set_value_at_indices
(name, inds, src)[source]¶Specify a new value for a model variable at particular indices.
update
()[source]¶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 initialize()
method and this
method can return with no action.
dakotathon.bmi.
CenteredParameterStudy
[source]¶Bases: dakotathon.bmi.BmiDakota
BMI implementation of a Dakota centered parameter study.
dakotathon.bmi.
MultidimParameterStudy
[source]¶Bases: dakotathon.bmi.BmiDakota
BMI implementation of a Dakota multidim parameter study.
dakotathon.bmi.
PolynomialChaos
[source]¶Bases: dakotathon.bmi.BmiDakota
BMI implementation of a Dakota study with the polynomial chaos method.
dakotathon.bmi.
PsuadeMoat
[source]¶Bases: dakotathon.bmi.BmiDakota
BMI implementation of a Dakota study with the PSUADE MOAT method.
dakotathon.bmi.
Sampling
[source]¶Bases: dakotathon.bmi.BmiDakota
BMI implementation of a Dakota sampling study.
dakotathon.bmi.
StochasticCollocation
[source]¶Bases: dakotathon.bmi.BmiDakota
BMI implementation of a Dakota study with the stochastic collocation method.
dakotathon.bmi.
VectorParameterStudy
[source]¶Bases: dakotathon.bmi.BmiDakota
BMI implementation of a Dakota vector parameter study.