bloc.plot#

Attributes#

Functions#

plot_speciesPie(gas[, quantity, thresh])

Plot a pie chart of the species composition of a Cantera gas object.

plot_psr_temperature_vs_t(states[, xscale, xmin, ...])

Plot PSR temperature as a function of time.

plot_psr_composition_vs_t(states[, s_to_plot, ...])

Plot PSR composition as a function of time.

plot_simu_vs_t(states[, quantity, s_to_plot, xscale, ...])

Plot the temperature and composition as a function of time starting from a Cantera states object.

plot_simu_vs_x(states, qm, S[, quantity, s_to_plot, ...])

get_top_species_by_mole(states[, n])

Return top-N species names by final mole fraction from a states object.

get_top_species_by_mass(states[, n])

Return top-N species names by final mass fraction from a states object.

plot_pfr_composition_dual_axis(states, qm, S[, ...])

Plot PFR composition with dual x-axes (time and distance), linear scale.

plot_pfr_temperature_dual_axis(states, qm, S[, save_path])

Plot PFR temperature with dual x-axes (time and distance), linear scale.

plot_pfr_composition_dual_axis_log(states, qm, S[, ...])

Plot PFR composition with dual x-axes (time and distance), log scale.

plot_pfr_temperature_dual_axis_log(states, qm, S[, ...])

Plot PFR temperature with dual x-axes (time and distance), log scale.

Module Contents#

bloc.plot.color_H2 = '#B481FF'#
bloc.plot.color_Cs = '#000000'#
bloc.plot.color_CH4 = '#E63946'#
bloc.plot.color_others = '#607D8B'#
bloc.plot.color_hhv_others = '#8B0000'#
bloc.plot.SPECIES_COLORS#
bloc.plot.plot_speciesPie(gas, quantity='mole', thresh=0.005)#

Plot a pie chart of the species composition of a Cantera gas object.

FIgure is displayed in an Excel sheet

bloc.plot.plot_psr_temperature_vs_t(states, xscale='log', xmin=0, xmax=None, save=False, save_name=None)#

Plot PSR temperature as a function of time.

Parameters:
  • states (SolutionArray) – PSR reactor states (time-series).

  • xscale (str) – “log” or “linear” scale for x-axis.

  • xmin (float or None) – X-axis limits.

  • xmax (float or None) – X-axis limits.

  • save (bool) – If True, save figure to file.

  • save_name (str or None) – Base name for saving (without extension).

Returns:

Path to saved figure, or None if not saved.

Return type:

str or None

bloc.plot.plot_psr_composition_vs_t(states, s_to_plot=None, quantity='mole', xscale='log', yscale='linear', xmin=0, xmax=None, save=False, save_name=None)#

Plot PSR composition as a function of time.

Parameters:
  • states (SolutionArray) – PSR reactor states (time-series).

  • s_to_plot (list of str or None) – Species to plot. If None, top 8 by final mole or mass fraction.

  • quantity (str) – “mole” or “mass” fraction.

  • xscale (str) – “log” or “linear” scale for x-axis.

  • yscale (str) – “log” or “linear” scale for y-axis.

  • xmin (float or None) – X-axis limits.

  • xmax (float or None) – X-axis limits.

  • save (bool) – If True, save figure to file.

  • save_name (str or None) – Base name for saving (without extension).

Returns:

Path to saved figure, or None if not saved.

Return type:

str or None

bloc.plot.plot_simu_vs_t(states, quantity='mole', s_to_plot=None, xscale='log', yscale='linear', xmin=0, xmax=None, n_sheet=1, save=False, save_name=None)#

Plot the temperature and composition as a function of time starting from a Cantera states object.

The figure is displayed in an Excel sheet.

bloc.plot.plot_simu_vs_x(states, qm, S, quantity='mole', s_to_plot=None, xscale='log', yscale='linear', xmin=0, xmax=None, n_sheet=1, save=False, save_name=None)#
bloc.plot.get_top_species_by_mole(states, n=8)#

Return top-N species names by final mole fraction from a states object.

Parameters:
  • states (SolutionArray) – Cantera time-series states object.

  • n (int) – Maximum number of species to return.

Returns:

Species names sorted by descending final mole fraction, capped at n.

Return type:

list of str

bloc.plot.get_top_species_by_mass(states, n=8)#

Return top-N species names by final mass fraction from a states object.

Parameters:
  • states (SolutionArray) – Cantera time-series states object.

  • n (int) – Maximum number of species to return.

Returns:

Species names sorted by descending final mass fraction, capped at n.

Return type:

list of str

bloc.plot.plot_pfr_composition_dual_axis(states, qm, S, s_to_plot=None, save_path=None, quantity='mole')#

Plot PFR composition with dual x-axes (time and distance), linear scale.

Parameters:
  • states (SolutionArray) – PFR reactor states (time-series).

  • qm (float) – Total mass flow rate in kg/s.

  • S (float) – Reactor cross-section area in m2.

  • s_to_plot (list of str or None) – Species to plot. If None, top 8 by final mole or mass fraction.

  • save_path (str or None) – If provided, save figure to this path (PNG).

  • quantity (str) – "mole" or "mass".

Returns:

Path to saved figure, or None if not saved.

Return type:

str or None

bloc.plot.plot_pfr_temperature_dual_axis(states, qm, S, save_path=None)#

Plot PFR temperature with dual x-axes (time and distance), linear scale.

Parameters:
  • states (SolutionArray) – PFR reactor states (time-series).

  • qm (float) – Total mass flow rate in kg/s.

  • S (float) – Reactor cross-section area in m2.

  • save_path (str or None) – If provided, save figure to this path (PNG).

Returns:

Path to saved figure, or None if not saved.

Return type:

str or None

bloc.plot.plot_pfr_composition_dual_axis_log(states, qm, S, s_to_plot=None, save_path=None, quantity='mole')#

Plot PFR composition with dual x-axes (time and distance), log scale.

Parameters:
  • states (SolutionArray) – PFR reactor states (time-series).

  • qm (float) – Total mass flow rate in kg/s.

  • S (float) – Reactor cross-section area in m2.

  • s_to_plot (list of str or None) – Species to plot. If None, top 8 by final mole or mass fraction.

  • save_path (str or None) – If provided, save figure to this path (PNG).

  • quantity (str) – "mole" or "mass".

Returns:

Path to saved figure, or None if not saved.

Return type:

str or None

bloc.plot.plot_pfr_temperature_dual_axis_log(states, qm, S, save_path=None)#

Plot PFR temperature with dual x-axes (time and distance), log scale.

Parameters:
  • states (SolutionArray) – PFR reactor states (time-series).

  • qm (float) – Total mass flow rate in kg/s.

  • S (float) – Reactor cross-section area in m2.

  • save_path (str or None) – If provided, save figure to this path (PNG).

Returns:

Path to saved figure, or None if not saved.

Return type:

str or None

bloc.plot.SOLID_LINESTYLES = ['-', '--', '-.']#
bloc.plot.OTHER_LINESTYLE = ':'#