xso.core.XSOCore
- 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.
- __init__(solver)[source]
Initializes XSO Model and XSO Solver, and stores solve start and end for diagnostics.
- Parameters:
solver ({'stepwise', 'solve_ivp'} or subclass of SolverABC) – Solver name as str, has to be built into xso. Alternatively can be passed a custom subclass of xso.solver.SolverABC.
Methods
__init__(solver)Initializes XSO Model and XSO Solver, and stores solve start and end for diagnostics.
add_flux(process_label, var_label, flux_label)Method to add a flux with the model backend, via implemented function in Solver.
add_forcing(label, forcing_func)Method to register add forcing with the model backend, via implemented function in Solver.
add_parameter(label, value)Method to add a parameter with the model backend, via implemented function in solver.
add_variable(label[, initial_value])Adding a variable to the model.
assemble()Method to assemble model upon full initialization, necessary for some solvers.
cleanup()Method to remove temporary files after solving, necessary for some solvers.
register_flux(label, flux[, dims])Method to register a flux with the model backend, via implemented function in Solver.
solve(time_step)Method to start model solve, calls appropriate function in Solver.