4.7. pde.trackers package

Classes for tracking simulation results in controlled intervals

Trackers are classes that periodically receive the state of the simulation to analyze, store, or output it. The trackers defined in this module are:

CallbackTracker

Tracker calling a function periodically

ProgressTracker

Tracker showing the progress of the simulation

PrintTracker

Tracker printing data to a stream (default: stdout)

PlotTracker

Tracker plotting data on screen, to files, or writes a movie

LivePlotTracker

PlotTracker with defaults for live plotting

DataTracker

Tracker storing custom data obtained by calling a function

SteadyStateTracker

Tracker interrupting the simulation once steady state is reached

RuntimeTracker

Tracker interrupting the simulation once a duration has passed

ConsistencyTracker

Tracker interrupting the simulation when the state is not finite

InteractivePlotTracker

Tracker showing the state interactively in napari

Some trackers can also be referenced by name for convenience when using them in simulations. The lit of supported names is returned by get_named_trackers().

Multiple trackers can be collected in a TrackerCollection, which provides methods for handling them efficiently. Moreover, custom trackers can be implemented by deriving from TrackerBase. Note that trackers generally receive a view into the current state, implying that they can adjust the state by modifying it in-place. Moreover, trackers can interrupt the simulation by raising the special exception StopIteration.

For each tracker, the interval at which it is called can be decided using one of the following classes:

ConstantIntervals

class representing equidistantly spaced time intervals

LogarithmicIntervals

class representing logarithmically spaced time intervals

RealtimeIntervals

class representing time intervals spaced equidistantly in real time