thunderboltz.ThunderBoltz

class thunderboltz.ThunderBoltz(directory=None, cs=None, out_file=None, monitor=None, live=None, live_rate=None, ts_plot_params=None, **params)[source]

ThunderBoltz 0D DSMC simulation wrapper.

Parameters:
  • directory (str) – The path to a directory that will host ThunderBoltz compiled, source, input, and output files.

  • cs (CrossSections) – The set of cross section information required for this simulation. Optionally supplied as an alternative to indeck, default is an empty CrossSections object.

  • out_file (str) – Optional file base name for ThunderBoltz stdout buffer, default is "thunderboltz".

  • monitor (bool) – Runtime flag, when set to True an empty monitor file will be generated in the simulation directory. Deleting this file will cause the ThunderBoltz process to exit, but allow the wrapper to continue execution. This is useful performing several simulation calculations sequentially, but manual exit is required for each one, or if post processing is required immediately after ThunderBoltz exits.

  • live (bool) – Run and update time series plotting GUI during simulation.

  • ts_plot_params (list[str]) – The default output parameters to be plotted by plot_timeseries().

  • **params – ThunderBoltz simulation parameters. Any attributes of TBParameters or WrapParameters can be passed here.

Attributes

logfile

Name of the simulation output file produced by ThunderBoltz

output_files

Files to be read when tabular data is requested

ts_plot_params

Time series plot parameters

particle_tables

Particle-specific times series data

kinetic_table

Banner output data

timeseries

All tick-by-tick simulation data

vdfs

Particle velocity dump data

vdf_init_data

Particle velocity data intended for particle initialization

time_conv

Time step at which steady-state calculations are considered converged

counts

Table of collision counts

elapsed_time

Elapsed wall-clock time of calculation

runtime_start

Date/Time of calculation start

runtime_end

Date/Time of calculation end

out_file

Name for ThunderBoltz stdout file

live

Run and update time series plotting GUI during simulation.

live_rate

Run and update reaction rate plotting GUI during simulation.

ts_fig

The figure object for the time series plot.

rate_fig

The figure object for the rate plot

callbacks

List of functions that are called every time banner output is updated.

directory

Simulation directory

err_stack

Recorded thunderboltz warnings read in from output files

monitor

Option to create temp file during run that causes safe exit upon deletion

Methods

add_callback(f)

Add a function to the list of functions that will be called during banner output.

compile_debug()

Prepare all files and compile ThunderBoltz with -g debug flag.

compile_from(src_path[, debug])

Copy TB files from src_path and compile in simulation directory.

compute_fit(x_)

Get the slope and associated error of the line of best fit.

describe_dist([steps, sample_cap])

Generate percentile and count statistics of the electron velocity / energy distribution for various time steps.

get_counts()

Return the cumulative reaction counts for each process and each time step.

get_directory()

Return the path of the current simulation.

get_edfs([steps, sample_cap])

Read the electron velocity distribution functions and return the component and total energy distributions within a ThunderBoltz calculation.

get_etrans()

Return the energy weighted counts of each reaction computed for each time step.

get_particle_tables()

Return the particle table data for each species in a list.

get_sim_param(key)

Return the value of a simulation parameter.

get_slope_fit()

get_ss_params([ss_func, fits])

Get steady-state transport parameter values by averaging last section of time series.

get_timeseries()

Collect the relevant time series data from a ThunderBoltz simulation directory and add input parameter columns.

get_vdfs([steps, sample_cap, particle_type, v])

Read the electron velocities arrays within a ThunderBoltz calculation.

plot_cs([ax, legend, vsig, thresholds, save])

Plot the cross sections models.

plot_edf_comps([steps, sample_cap, bins, ...])

Plot the directional components of the energy distribution function.

plot_edfs([steps, sample_cap, bins, ...])

Plot the electron total energy distribution function, optionally include the provided cross sections for comparison.

plot_rates([save, stamp, v, update])

Create a diagnostic plot of ThunderBoltz time series data.

plot_timeseries([series, save, stamp, v, update])

Create a diagnostic plot of ThunderBoltz time series data.

plot_vdfs([steps, save, bins, sample_cap])

Plot the joint distribution heat map between the x-y and x-z velocities.

read([directory, read_input, read_cs_data, only])

Read the simulation directory of a ThunderBoltz run, possibly all of its input and output files.

read_log(logfile)

Read json file from simulation directory.

read_particle_table(i)

Read species specific output data, including density, velocity, displacement, energy, and temperature.

read_stdout(fname)

Read the banner output data.

read_tb_params(fname[, ignore])

Takes file name of an input deck, updates the simulation parameters and returns the simulation parameters which were read from the file fname.

reset()

Reset output data for a new run.

run([src_path, bin_path, out_file, monitor, ...])

Execute with the current parameters in the simulation directory.

set_(**p)

Update parameters, call appropriate functions ensuring input parameters are self-consistent.

set_fixed_tracking()

Change all reaction species indices of differing reactant values to be between only particle 0 and 1 (e.g. 0+1->0+2 is changed to 0+1->0+1).

set_ts_plot_params(params)

Set the default series plotted by plot_timeseries()

to_pickleable()

Return a picklable version of this object.

write_input(directory)

Write all the input files into a directory with the current settings.