xso.core
Module Contents
Classes
Backend core class that initializes solver and model, and |
Attributes
- xso.core._built_in_solvers
- class xso.core.XSOCore(solver)[source]
Backend core class that initializes solver and model, and translates between the two for model construction and solving.
This core class is necessary to allow an abstract model based on differential equations to be constructed, without being limited to the strict framework of xsimlab. Currently, all xsimlab variables are used as value stores, instead of meaningful components of the model. The XSOCore object is shared between all XSO components via a Xsimlab xs.any_object variable.
Note: The logical division between Core and Solver might be unnecessary, but was chosen to simplify switching or modifying either component.
- add_variable(label, initial_value=0)[source]
Adding a variable to the model.
Function that takes the variable label and initial value as input and calls the solver add_variable function. The output is assigned to the Model variables dict, from where the variable is returned. This method is called within component decorator function, where the output is assigned to the appropriate Xsimlab variable.
- Parameters:
label (string) – This is the reference string to be used across the model.
initial_value (numerical, optional) – The initial value of the variable within the model, a default value is 0, if none is supplied.
- add_parameter(label, value)[source]
Method to add a parameter with the model backend, via implemented function in solver.
- register_flux(label, flux, dims=None)[source]
Method to register a flux with the model backend, via implemented function in Solver.
- add_flux(process_label, var_label, flux_label, negative=False, list_input=False)[source]
Method to add a flux with the model backend, via implemented function in Solver.