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()

to_json()[source]#

Method to serialise an Event object into JSON.

The expression is written out seperately, See pybamm.Serialise._SymbolEncoder.default()

class pybamm.EventType(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[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.

Extends: enum.Enum

View inheritance diagram for this model

Inheritance diagram of pybamm.models.event.EventType