Post-processing and plots#

Post-processing#

Post-processing (toolkit, DESIGN D15): quantities derived from a model and its parameter values, rather than model outputs.

pytes.energy_between(model, T_a, T_b, parameter_values=None, var_pts=None)[source]#

Total thermal energy [J] between the uniform states at T_a and T_b (DESIGN D13).

Each uniform state is the equilibrium state at its temperature, as for the initial state (for a sharp melting point, solid at the melting temperature). The result is positive when T_b holds more energy than T_a. It is derived from the materials and geometry on the model’s mesh, so it equals the difference in the model’s “Total thermal energy [J]” between those two states. For example, energy_between(model, T_cold, T_hot) is the energy a full charge from T_cold to T_hot stores.

Parameters:
  • model (pytes.BaseModel) – The model. It must have a pytes.submodels.DeviceEnergy submodel.

  • T_a (float) – Temperatures of the two uniform states [K].

  • T_b (float) – Temperatures of the two uniform states [K].

  • parameter_values (pybamm.ParameterValues, optional) – Parameter values (default: the model’s).

  • var_pts (dict, optional) – Mesh points (default: the model’s). Use the mesh of the simulation the result is compared with.

Returns:

float

Plots#

Standard plots (toolkit, DESIGN D15), for one solution or several to compare. They use only the outputs every model provides, so they work for any model and family, and need the plot extra (matplotlib).

Each returns the figure and its axes, for further styling.

The PyTES plot colours (DESIGN D15) are available, not yet the default:

  • the colour cycles THERMAL and THERMAL_DARK, also as the matplotlib styles "pytes.thermal" and "pytes.thermal_dark" (plt.style.use("pytes.thermal"));

  • the colourmaps "pytes.ember" (sequential) and "pytes.thaw" (diverging), and their reversals "pytes.ember_r" and "pytes.thaw_r", registered with matplotlib when this module is imported (cmap="pytes.ember").

pytes.plotting.THERMAL = ('#E8590C', '#1F4E9C', '#14A08A', '#F0A930', '#A23B72', '#88C7F0', '#36312E')#

The colour cycle “PyTES Thermal”, for light backgrounds (style "pytes.thermal")

pytes.plotting.THERMAL_DARK = ('#F76707', '#6785F9', '#04B68B', '#FFC66C', '#B06C99', '#B2D5F8', '#D9D0C7')#

The colour cycle “PyTES Thermal (dark)”, for dark backgrounds (style "pytes.thermal_dark")

pytes.plotting.COLOURMAPS = ('pytes.ember', 'pytes.thaw')#

The colourmaps registered with matplotlib, each also reversed (name ending in _r)

pytes.plotting.register_colourmaps()[source]#

Register the PyTES colourmaps (COLOURMAPS) and their reversals with matplotlib.

Done when pytes.plotting is imported, if matplotlib is installed; registering again does nothing.

pytes.plotting.plot_summary(solutions, labels=None)[source]#

Inlet and outlet temperature, power and discharged energy against time.

Parameters:
  • solutions (pybamm.Solution or list of them) – The solutions to plot.

  • labels (list of str, optional) – A label for each solution (default: the model names).

Returns:

pytes.plotting.plot_power_against_energy(solutions, labels=None)[source]#

Power against discharged energy (DESIGN D15), the key comparison between designs: how the power a device delivers falls as it gives up its energy.

Parameters:
  • solutions (pybamm.Solution or list of them) – The solutions to plot.

  • labels (list of str, optional) – A label for each solution (default: the model names).

Returns:

pytes.plotting.plot_fluid_profiles(solution, times, label=None)[source]#

The fluid temperature along the flow path at given times.

Parameters:
  • solution (pybamm.Solution) – The solution.

  • times (list of float) – Times [s].

  • label (str, optional) – Title of the plot (default: the model name).

Returns: