new HLM(configfile) → {Object}
Class definition of the HLM model that is BMI-compliant. Creates an HLM
instance. If no configuration file given, then it only initializes an empty shell. Otherwise, passes config string to initialize
method.
Name | Type | Description |
---|---|---|
configfile | String | string path to json configuration file. |
- Source
creates a new instance of an HLM model
- Type:
- Object
Extends
Methods
(static) current_time(name) → {Number}
Current time of the model
Name | Type | Description |
---|---|---|
name | String | An input or output variable name, a CSDMS Standard Name |
- Source
- The current model time.
- Type:
- Number
(static) end_time() → {Number}
End time of the model
- Source
-The maximum model time.
- Type:
- Number
(static) finalize()
Perform all tasks that take place after exiting model time loop (ie. memory cleanup, closing files, reporting)
- Source
- To Do
- Potential Tasks: - garbage collection stuff - provide outputs in even intervals
(static) get_component_name() → {String}
Gets name of the component.
- Source
- The name of the component
- Type:
- String
(static) get_grid_edge_count(grid) → {Number}
Get the number of edges in the grid
Name | Type | Description |
---|---|---|
grid | Number | A grid identifier |
- Source
The total number of grid edges
- Type:
- Number
(static) get_grid_edge_nodes(grid, edge_nodes) → {Array.<Object>}
Get the edge-node connectivity.
Name | Type | Description |
---|---|---|
grid | Number | A grid identifier |
edge_nodes | Array. | An array of Number, shape *(2 x nnodes,) to place the edge-node connectivity. For each edge, connectivity is given as node at edge tail, followed by node at edge head. |
- Source
The input array that holds the edge-node connectivity.
- Type:
- Array.
<Object>
(static) get_grid_face_count(grid) → {Number}
Get the number of faces in the grid.
Name | Type | Description |
---|---|---|
grid | Number | A grid identifier |
- Source
The total number of grid faces.
- Type:
- Number
(static) get_grid_face_edges(grid, face_edges) → {Array.<Object>}
Get the face-edge connectivity.
Name | Type | Description |
---|---|---|
grid | Number | A grid identifier |
face_edges | Array. | An array to place the face-edge connectivity. |
- Source
The input array that holds the face-edge connectivity.
- Type:
- Array.
<Object>
(static) get_grid_face_nodes(grid, face_nodes) → {Array.<Object>}
Get the face-edge connectivity.
Name | Type | Description |
---|---|---|
grid | Number | A grid identifier |
face_nodes | Array. | An 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. |
- Source
The input array that holds the face-node connectivity.
- Type:
- Array.
<Object>
(static) get_grid_node_count(grid) → {Number}
Get the number of nodes in the grid.
Name | Type | Description |
---|---|---|
grid | Number | A grid identifier |
- Source
The total number of grid nodes
- Type:
- Number
(static) get_grid_nodes_per_face(grid, nodes_per_face) → {Array.<Object>}
Get the face-edge connectivity.
Name | Type | Description |
---|---|---|
grid | Number | A grid identifier |
nodes_per_face | Array. | An array of Number, shape *(nfaces,) to place the number of nodes per face. |
- Source
The input array that holds the number of nodes per face.
- Type:
- Array.
<Object>
(static) get_grid_origin(grid, origin) → {Array.<Object>}
Get coordinates for the lower-left corner of the computational grid.
Name | Type | Description |
---|---|---|
grid | Number | A grid identifier |
origin | Array. | An array of Number, shape *(ndim,) to hold the coordinates of the lower-left corner of the grid. |
- Source
The input array that holds the coordinates of the grid's lower-left corner.
- Type:
- Array.
<Object>
(static) get_grid_rank(grid) → {Number}
Get number of dimensions of the computational grid.
Name | Type | Description |
---|---|---|
grid | Number | A grid identifier |
- Source
Rank of the grid.
- Type:
- Number
(static) get_grid_shape(grid, shape) → {Array.<Object>}
Get dimensions of the computational grid
Name | Type | Description |
---|---|---|
grid | Number | A grid identifier |
shape | Array. | A array of Number, shape *(ndim,) into which to place the shape of the grid. |
- Source
The input array that holds the grid's shape.
- Type:
- Array.
<Object>
(static) get_grid_size(grid) → {Number}
Get the total number of elements in the computational grid.
Name | Type | Description |
---|---|---|
grid | Number | A grid identifier |
- Source
Size of the grid.
- Type:
- Number
(static) get_grid_spacing(grid, spacing) → {Array.<Object>}
Get dimensions of the computational grid
Name | Type | Description |
---|---|---|
grid | Number | A grid identifier |
spacing | Array. | A array of Number, shape *(ndim,) to hold the spacing between grid rows and columns. |
- Source
The input array that holds the grid's spacing.
- Type:
- Array.
<Object>
(static) get_grid_type(grid) → {String}
Get the grid type as a string. HLM grid is an unstructured grid per BMI grid specifications
HLM models are formulated as directed trees
Name | Type | Description |
---|---|---|
grid | Number | A grid identifier |
- Source
Type of grid as a string.
- Type:
- String
(static) get_grid_x(grid, x) → {Array.<Object>}
Get coordinates of grid nodes in the x direction.
Name | Type | Description |
---|---|---|
grid | Number | A grid identifier |
x | Array. | An array of Number, shape *(nrows,) to hold the x-coordinates of the grid node columns |
- Source
The input array that holds the grid's column x-coordinates.
- Type:
- Array.
<Object>
(static) get_grid_y(grid, y) → {Array.<Object>}
Get coordinates of grid nodes in the y direction.
Name | Type | Description |
---|---|---|
grid | Number | A grid identifier |
y | Array. | An array of Number, shape *(ncols,) to hold the y-coordinates of the grid node rows |
- Source
The input array that holds the grid's row y-coordinates
- Type:
- Array.
<Object>
(static) get_grid_z(grid, z) → {Array.<Object>}
Get coordinates of grid nodes in the z direction.
Name | Type | Description |
---|---|---|
grid | Number | A grid identifier |
z | Array. | An array of Number, shape *(nlayers,) to hold the z-coordinates of the grid nodes layers. |
- Source
The input array that holds the grid's layer z-coordinates.
- Type:
- Array.
<Object>
(static) get_input_item_count() → {Number}
Count of a model's input variables.
- Source
- The number of input variables. Number of variables model can use from other models implementing a BMI.
- 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. The length of the array is given by get_input_item_count. The names are preferably in the form of CSDMS Standard Names.
- Source
array with string names
- Type:
- Array.
<Object>
(static) get_output_item_count() → {Number}
Count of a model's output variables.
- Source
- 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. The length of the array is given by get_output_item_count. The names are preferably in the form of CSDMS Standard Names.
- Source
array with string names
- Type:
- Array.
<Object>
(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.
Name | Type | Description |
---|---|---|
name | String | An input or output variable name, a CSDMS Standard Name |
dest | Array. | A array into which to place the values |
- Source
-The same array that was passed as an input buffer.
- Type:
- Array.
<Object>
(static) get_value_at_indices(name, dest, inds) → {Array.<Object>}
Get values at particular indices.
Name | Type | Description |
---|---|---|
name | String | An input or output variable name, a CSDMS Standard Name |
dest | Array. | An array into which to place the values |
inds | Array. | The indices into the variable array |
- Source
-Value of the model variable at the given location.
- Type:
- Array.
<Object>
(static) get_value_ptr(name) → {Array.<Object>}
NOT IMPLEMENTED IN JS 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.
Name | Type | Description |
---|---|---|
name | String | An input or output variable name, a CSDMS Standard Name |
- Source
-A reference to a model variable.
- Type:
- Array.
<Object>
(static) get_var_grid(name) → {Number}
Returns an identifier of the grid upon which the 'var_name' is defined. HLM only uses one grid. Grids indexed from 0
Name | Type | Description |
---|---|---|
name | String | An input or output variable name, a CSDMS Standard Name |
- Source
- The grid identifier.
- Type:
- Number
(static) get_var_ind(var_name) → {number}
Helper method to provide the index of a variable can parse all variables, regardles of input names or output names.
Name | Type | Description |
---|---|---|
var_name | string |
- Source
- the variable index
- Type:
- number
(static) get_var_itemsize(name) → {Number}
Get memory use for each array element in bytes
Name | Type | Description |
---|---|---|
name | String | An input or output variable name, a CSDMS Standard Name |
- Source
- 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.
Name | Type | Description |
---|---|---|
name | String | An input or output variable name, a CSDMS Standard Name |
- Source
- 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}
Get size, in bytes, of the given variable
Name | Type | Description |
---|---|---|
name | String | An input or output variable name, a CSDMS Standard Name |
- Source
- The size of the variable, counted in bytes.
- Type:
- Number
(static) get_var_type(name) → {String}
Get data type of the given variable.
Name | Type | Description |
---|---|---|
name | String | An input or output variable name, a CSDMS Standard Name |
- Source
- 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.
Name | Type | Description |
---|---|---|
name | String | An input or output variable name, a CSDMS Standard Name |
- Source
- The variable units.
- Type:
- String
(static) getLinkForces(data, target) → {Object}
Get and organize forcing data for an individual link
Name | Type | Description |
---|---|---|
data | Object | forcing data |
target | String | link id to get forcing for |
- Source
Throws error if data object provided is not properly formatted.
object of forcing data
- Type:
- Object
(static) getLinkOrder() → {Array.<Object>}
Return link order to step the solution of the links. Could house a variety of different logics. Would be helpful to find a post-order DFS alg in JS to plug into here.
- Source
array of numbers.
- Type:
- Array.
<Object>
(static) handleModelConfig(models)
Attaches proper mathematical models and supporting functions for the hydrological model designated in the configuration file. Sets BMI-compliant standard names for specifica variables in _inNames
and _outNames
.
Name | Type | Description |
---|---|---|
models | Object | object holding mathematical models. Fetched from |
- Source
(static) handleModelConfig(solvers)
Attaches to the HLM
instance functions associated to the numerical engine.
Name | Type | Description |
---|---|---|
solvers | Object |
- Source
Currently throws if DOPRI solver is chosen.
(static) initialize(configfile)
Intialize the HLM instance with data.
Name | Type | Description |
---|---|---|
configfile | string | string path to json configuration file. |
- Source
Will throw an error if no path is provided to configuration file.
(static) makeLinks(simFileURLs)
Fetches model input data and builds link objects
Name | Type | Description |
---|---|---|
simFileURLs | Object | object of file paths. |
- Source
Throws error if one of the key input types are missing.
simFileURLs should have the following key-value pairs: 'prm' : <parameter data input filepath>.json
'rvr' : <network topology data input filepath>.json
'str' : <forcing data filepath>.json
'ics' : <initial conditions data filepath>.json
(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.
Name | Type | Description |
---|---|---|
name | String | An input or output variable name, a CSDMS Standard Name |
src | Array. | The new value for the specified variable |
- Source
(static) set_value_at_indices(name, inds, src)
Specify a new value for a model variable at particular indices.
Name | Type | Description |
---|---|---|
name | String | An input or output variable name, a CSDMS Standard Name |
inds | Array. | The indices into the variable array |
src | Array. | The new value for the specified variable |
- Source
(static) start_time() → {Number}
Start time of the model. Model times should be of type float
- Source
-The model start time.
- Type:
- Number
(static) time_step() → {Number}
Current time step of the model. HLM implementation is the DEFAULT time step.
- Source
-The time step used in model.
- Type:
- Number
(static) time_units() → {String}
Time units of the model
- Source
-The model time unit; e.g., 'days' or 's'.
- Type:
- String
(static) update()
Advance model by one DEFAULT timestep Default timestep is set in the config file.
default timestep is meant to standardize the timesteps of each hillslope link over all of the dynamically stepping links
- Source
(static) update_until(tGoal)
Steps model until a specified time, tGoal
. tGoal
unit is seconds since beginning of simulation
Name | Type | Description |
---|---|---|
tGoal | number |
- Source