xso.solvers
Module Contents
Classes
Abstract base class of backend solver class, |
|
Solver backend using scipy.integrate.solve_ivp to solve model. |
|
Solver that can handle stepwise calculation built into xsimlab framework. |
Functions
|
Helper function to always have at least 1d numpy array returned. |
- xso.solvers.to_ndarray(value)[source]
Helper function to always have at least 1d numpy array returned.
- class xso.solvers.SolverABC[source]
Bases:
abc.ABCAbstract base class of backend solver class, use subclass to solve model within the XSO framework.
- class MathFunctionWrappers[source]
Default inner class providing mathematical function wrappers using numpy and math.
This nested class can be modified in any implemented solver, if it requires specific math functions.
Accessible within XSO components using self.m as defined in backendcomps.py class Backend.
- pi
- e
- abstract add_variable(label, initial_value, model)[source]
Method to reformat a variable object for use with solver, should return storage object of value.
- abstract add_parameter(label, value)[source]
Method to reformat a parameter object for use with solver.
- abstract register_flux(label, flux, model, dims)[source]
Method to reformat a flux function for use with solver, should return storage object of value.
- class xso.solvers.IVPSolver[source]
Bases:
SolverABCSolver backend using scipy.integrate.solve_ivp to solve model.
SOLVE_IVP is a variable step-size solver for ordinary differential equations, included in the SciPy Python package.
By default, it utilizes an explicit Runge-Kutta method of order 5(4).
- static return_dims_and_array(value, model_time)[source]
Helper function to expand numpy array to appropriate size for odeint solver based on value and model time.
- add_variable(label, initial_value, model)[source]
Reformats variable to comply with solver and return storage array.
- register_flux(label, flux, model, dims)[source]
Method to reformat flux function with appropriate inputs and to proper size.
- class xso.solvers.StepwiseSolver[source]
Bases:
SolverABCSolver that can handle stepwise calculation built into xsimlab framework.
Model output is computed step by step and assigned to the appropriate storage arrays in xsimlab backend.
- static return_dims_and_array(value, model_time)[source]
Helper function to create arrays of appropriate size, and assign initial value(s) to first index
- add_variable(label, initial_value, model)[source]
Method to reformat variable and return storage array.
- register_flux(label, flux, model, dims)[source]
Method to reformat flux function with appropriate inputs and to proper size.
- add_forcing(label, forcing_func, model)[source]
Compute forcing over model time and provide as array.