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_aandT_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_bholds more energy thanT_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 fromT_coldtoT_hotstores.- Parameters:
model (
pytes.BaseModel) – The model. It must have apytes.submodels.DeviceEnergysubmodel.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:
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).
plot_summary(): inlet and outlet temperature, power and discharged energy against time.plot_power_against_energy(): power against discharged energy, the key comparison plot.plot_fluid_profiles(): the fluid temperature along the flow path at given times.
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
THERMALandTHERMAL_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.plottingis 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.Solutionorlistofthem) – The solutions to plot.labels (
listofstr, optional) – A label for each solution (default: the model names).
- Returns:
fig (
matplotlib.figure.Figure)axes (
numpy.ndarrayofmatplotlib.axes.Axes) – Temperatures, power, and discharged energy.
- 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.Solutionorlistofthem) – The solutions to plot.labels (
listofstr, optional) – A label for each solution (default: the model names).
- Returns:
fig (
matplotlib.figure.Figure)ax (
matplotlib.axes.Axes)
- 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.label (
str, optional) – Title of the plot (default: the model name).
- Returns:
fig (
matplotlib.figure.Figure)ax (
matplotlib.axes.Axes)