Event

class pybamm.Event(name, expression, event_type=EventType.TERMINATION)[source]

Defines an event for use within a pybamm model

name

A string giving the name of the event.

Type:

str

expression

An expression that defines when the event occurs.

Type:

pybamm.Symbol

event_type

An enum defining the type of event. By default it is set to TERMINATION.

Type:

pybamm.EventType (optional)

evaluate(t=None, y=None, y_dot=None, inputs=None)[source]

Acts as a drop-in replacement for pybamm.Symbol.evaluate()

class pybamm.EventType(value)[source]

Defines the type of event, see pybamm.Event

TERMINATION indicates an event that will terminate the solver, the expression should return 0 when the event is triggered

DISCONTINUITY indicates an expected discontinuity in the solution, the expression should return the time that the discontinuity occurs. The solver will integrate up to the discontinuity and then restart just after the discontinuity.

INTERPOLANT_EXTRAPOLATION indicates that a pybamm.Interpolant object has been evaluated outside of the range.

SWITCH indicates an event switch that is used in CasADI “fast with events” model.