xso.backendcomps

Module Contents

Classes

Backend

Xarray-simlab process initializing and storing model backend and solver.

Context

Inherited by all other model components to access backend.

FirstInit

Inherits model backend from context and defines initializes stage,

SecondInit

Inherits model backend from context and defines initializes stage,

ThirdInit

Inherits model backend from context and defines initializes stage,

FourthInit

Inherits model backend from context and defines initializes stage,

FifthInit

Inherits model backend from context and defines initializes stage,

RunSolver

Inherits model backend from context and calls solver to run

Time

Process defining model time and registering it in model backend.

Functions

create_time_component(time_unit)

Helper function to create a Time component with a custom unit registered through the backend.

class xso.backendcomps.Backend[source]

Xarray-simlab process initializing and storing model backend and solver.

This is the interface between the solver and model backend of XSO and the model processes, that are decorated as XSO components. As for all Xarray-simlab processes, we can define an initialize and finalize method to execute at different stages of model runtime.

solver_type

a string argument passed at model setup, that defines which solver is used

Type:

xarray-simlab variable

core

stores the XSOCore class initialized with passed solver_type

Type:

xarray-simlab any_object

m

store for math function wrappers supplied with Solver contained in XSOCore

Type:

xarray-simlab any_object

initialize()[source]

Creates model backend objects at the start of model runtime.

finalize()[source]

Calls the cleanup function implemented in XSOCore, relevant to some solvers.

solver_type
core
m
initialize()[source]

Initializes model backend at the start of model runtime.

Creates core attribute to hold XSOCore, and m attribute to hold math function wrappers.

finalize()[source]

Runs finally after model solve to call cleanup function in core

class xso.backendcomps.Context[source]

Inherited by all other model components to access backend.

core

Link to core object defined in Backend class

Type:

xarray-simlab foreign variable

m

Link to math functions wrapper in Backend class

Type:

xarray-simlab foreign variable

label

Stores label supplied at model setup

Type:

xarray-simlab variable

initialize()[source]

Assigns label given to component, to be referenced in model backend

core
m
label
initialize()[source]

Every XSO component is initialized with a label attribute storing the name supplied at model setup.

class xso.backendcomps.FirstInit[source]

Bases: Context

Inherits model backend from context and defines initializes stage, given to init_stage argument in xso.component decorator.

This is a hack using xsimlab’s group variables to force component initialization order.

group
initialize()[source]

Every XSO component is initialized with a label attribute storing the name supplied at model setup.

class xso.backendcomps.SecondInit[source]

Bases: Context

Inherits model backend from context and defines initializes stage, given to init_stage argument in xso.component decorator.

firstinit
group
initialize()[source]

Every XSO component is initialized with a label attribute storing the name supplied at model setup.

class xso.backendcomps.ThirdInit[source]

Bases: Context

Inherits model backend from context and defines initializes stage, given to init_stage argument in xso.component decorator.

firstinit
secondinit
group
initialize()[source]

Every XSO component is initialized with a label attribute storing the name supplied at model setup.

class xso.backendcomps.FourthInit[source]

Bases: Context

Inherits model backend from context and defines initializes stage, given to init_stage argument in xso.component decorator.

firstinit
secondinit
thirdinit
group
initialize()[source]

Every XSO component is initialized with a label attribute storing the name supplied at model setup.

class xso.backendcomps.FifthInit[source]

Bases: Context

Inherits model backend from context and defines initializes stage, given to init_stage argument in xso.component decorator.

firstinit
secondinit
thirdinit
fourthinit
group
initialize()[source]

Every XSO component is initialized with a label attribute storing the name supplied at model setup.

class xso.backendcomps.RunSolver[source]

Bases: Context

Inherits model backend from context and calls solver to run as final initialization stage of model runtime.

firstinit
secondinit
thirdinit
fourthinit
fifthinit
initialize()[source]

After all other xso.components were initialized, the model can be assembled in core.

run_step(dt)[source]
class xso.backendcomps.Time[source]

Bases: FirstInit

Process defining model time and registering it in model backend.

Xsimlab does not provide a time variable by default, but since XSO focuses on differential equation modeling, this process is included by default.

time_input
time
initialize()[source]

Initializing Time process as fully functional XSO component.

time_flux(**kwargs)[source]

Simple linear flux, that represents time within model. Necessary for external solvers like odeint.

xso.backendcomps.create_time_component(time_unit)[source]

Helper function to create a Time component with a custom unit registered through the backend.