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
Truean emptymonitorfile 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
TBParametersorWrapParameterscan be passed here.
Attributes
logfileName of the simulation output file produced by ThunderBoltz
output_filesFiles to be read when tabular data is requested
ts_plot_paramsTime series plot parameters
particle_tablesParticle-specific times series data
kinetic_tableBanner output data
timeseriesAll tick-by-tick simulation data
vdfsParticle velocity dump data
vdf_init_dataParticle velocity data intended for particle initialization
time_convTime step at which steady-state calculations are considered converged
countsTable of collision counts
elapsed_timeElapsed wall-clock time of calculation
runtime_startDate/Time of calculation start
runtime_endDate/Time of calculation end
out_fileName for ThunderBoltz stdout file
liveRun and update time series plotting GUI during simulation.
live_rateRun and update reaction rate plotting GUI during simulation.
ts_figThe figure object for the time series plot.
rate_figThe figure object for the rate plot
callbacksList of functions that are called every time banner output is updated.
directorySimulation directory
err_stackRecorded thunderboltz warnings read in from output files
monitorOption 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.
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.
Return the cumulative reaction counts for each process and each time step.
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.
Return the energy weighted counts of each reaction computed for each time step.
Return the particle table data for each species in a list.
get_sim_param(key)Return the value of a simulation parameter.
get_ss_params([ss_func, fits])Get steady-state transport parameter values by averaging last section of time series.
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 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.
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()Return a picklable version of this object.
write_input(directory)Write all the input files into a directory with the current settings.