postgkyl.gk.particle_balance

postgkyl.gk.particle_balance(name, species, *, path='./', relative_error=False, multib='-10', fdot_file=None, source_file=None, bflux_files=None, f_file=None, dt_file=None, logy=False, absy=False, xlabel='Time (s)', ylabel=None, title=None, indent_left=0.0, add_width=0.0, show=False, saveas=None)

Plot (and compute) the particle balance of a single species.

Requires <name>-<species>_fdot_integrated_moms.gkyl; and (only if the run had sources or non-periodic boundaries) <name>-<species>_source_integrated_moms.gkyl and <name>-<species>_bflux_<direction><side>_integrated_HamiltonianMoments .gkyl files. If relative_error is requested, <name>-<species>_integrated_moms.gkyl and <name>-dt.gkyl are also required.

Parameters:
  • name – Simulation name (also the file prefix).

  • species – Species name.

  • path – Directory holding the simulation output.

  • relative_error – Plot the relative error instead of every balance term.

  • multib – "-10" (default) for a single block; "-1" to discover every block; otherwise a comma list or 'start:stop[:step]' slice of block indices.

  • fdot_file – Explicit distribution derivative moments path override.

  • source_file – Explicit source moments path override.

  • bflux_files – Optional per-boundary path overrides, keyed by "<direction><side>"; unlisted boundaries use the naming convention.

  • f_file – Explicit integrated distribution moments path override.

  • dt_file – Explicit time-step history path override. In path overrides, * stands for the block index.

  • logy – Log-scale the y axis.

  • absy – Take the absolute value of every trace before plotting.

  • xlabel – Horizontal-axis label.

  • ylabel – Vertical-axis label.

  • title – Figure title.

  • indent_left – Horizontal axes-position adjustment in figure units.

  • add_width – Axes-width adjustment in figure units.

  • show – Call plt.show() before returning.

  • saveas – If given, save the figure to this path.

Returns:

(figure, traces).

Raises:

FileNotFoundError – if a required file family is missing.

CLI: gk_particle_balance