EntityTools
Documentation for EntityTools.
EntityTools.EntityDataEntityTools.EntityDataEntityTools.EntityUnitsEntityTools.EntityUnitsEntityTools.EntityUnitsEntityTools.FieldInfoEntityTools.ParticleInfoEntityTools.SimOutputEntityTools.SpectrumInfoEntityTools.StepDataBase.sumEntityTools.adios2_throughputEntityTools.bp_to_vtkEntityTools.compute_fieldlinesEntityTools.construct_bins_and_centersEntityTools.construct_timesEntityTools.dipole_samplingEntityTools.find_closest_timeEntityTools.find_idxsEntityTools.get_TempEntityTools.get_histogramsEntityTools.monopole_samplingEntityTools.omega_iEntityTools.parse_compound_timeEntityTools.parse_outputEntityTools.parse_timingEntityTools.phase_mapEntityTools.polar_contour!EntityTools.polar_fieldlines!EntityTools.polar_pcolor!EntityTools.power_spectrumEntityTools.power_spectrumEntityTools.power_spectrum_2DEntityTools.power_spectrum_2DEntityTools.power_spectrum_3DEntityTools.power_spectrum_3DEntityTools.rLiEntityTools.read_fieldEntityTools.read_fieldEntityTools.read_field_infoEntityTools.read_fields_reducedEntityTools.read_particle_infoEntityTools.read_particlesEntityTools.read_particles_reducedEntityTools.read_run_settingsEntityTools.read_spectrumEntityTools.read_spectrum_infoEntityTools.read_timesEntityTools.reduce_read_positionsEntityTools.reinterpret_timeEntityTools.select_first_fileEntityTools.spectrumEntityTools.substep_seriesEntityTools.summary_tableEntityTools.vA
EntityTools.EntityData — Type
struct EntityData
path::String
steps::Vector{Int64}
times::Vector{Float64}
settings::Dict{String, Any}
fields::Union{FieldInfo, Nothing}
particles::Union{ParticleInfo, Nothing}
spectra::Union{SpectrumInfo, Nothing}
endStruct to store metadata of an Entity simulation.
EntityTools.EntityData — Method
EntityData(sim_path::String; verbose=false)Reads an overview of the simulation into an EntityData struct.
EntityTools.EntityUnits — Type
EntityUnits{T <: Real}A struct to hold the normalized units for a plasma simulation. The fields are:
skindepth0: The skin depth in normalized units.larmor0: The Larmor radius in normalized units.sigma0: The magnetization parameter, calculated as (skindepth0/larmor0)^2.B0: The magnetic field strength in normalized units, calculated as 1/larmor0.omegaB0: The cyclotron frequency in normalized units, calculated as B0.q0: The charge normalization factor, calculated as 1/(n0 * skindepth0^2).V0: The volume normalization factor, calculated as dx0^size(extent, 1).n0: The number density normalization factor, calculated as ppc0 / V0.
EntityTools.EntityUnits — Method
EntityUnits(data::EntityData)Constructs the units from the simulation settings stored in data. Returns an EntityUnits struct containing the normalized units for the simulation.
EntityTools.EntityUnits — Method
EntityUnits(toml_path::String)Reads the normalized units from the simulations' parameter file at the specified path.
EntityTools.FieldInfo — Type
struct FieldInfo <: DataInfo
fields::Vector{String}
endStruct to store info on field output.
EntityTools.ParticleInfo — Type
struct ParticleInfo <: DataInfo
species::Vector{Int64}
properties::Vector{String}
endStruct to store info on particle output.
EntityTools.SimOutput — Type
SimOutputContainer for all per-step records parsed from a .out file. Iterable and indexable by step index. The set of substep and species names observed across the whole run is kept in substep_names / species_labels.
EntityTools.SpectrumInfo — Type
struct SpectrumInfo <: DataInfo
species::Vector{Int64}
endStruct to store info on output spectra.
EntityTools.StepData — Type
StepDataPer-step record from an entity .out file. All times are in seconds. Substep timings are accessible by name: step["CurrentDeposit"].
Base.sum — Method
sum(sim::SimOutput) -> seconds
sum(sim::SimOutput, name) -> seconds
maximum(sim::SimOutput, name) -> seconds
minimum(sim::SimOutput, name) -> seconds
mean(sim::SimOutput) -> seconds
mean(sim::SimOutput, name) -> secondsAggregate over the simulation. With no name, the aggregate runs over the per-step Total line. With a name, it runs over the named substep (e.g. "CurrentDeposit"); steps where the substep is absent are skipped.
EntityTools.adios2_throughput — Method
adios2_throughput(path::AbstractString)Read an ADIOS2 BP5 profiling.json and return a NamedTuple with:
aggregate_TBps: Σwbytes(all ranks) / max(durable_us) [decimal TB/s]per_rank_mean_GBps: mean over writer ranks of wbytes / durable_us [decimal GB/s]per_rank_std_GBps: stddev of the sameper_rank_raw_GBps: mean of wbytes / Σwrite.mus over writer ranks [decimal GB/s] — the raw POSIX write() rate, kept for reference; this measures the rate of memcpy into the page/client cache and overstates durable bandwidth, often above the filesystem specn_writers: number of ranks that issued writes (BP5 aggregators)n_ranks: total ranks in the profile
durable_us per rank is ES + ES_close + DC_WaitOnAsync1 + DC_WaitOnAsync2, i.e. the EndStep window plus the Close-time drain of BP5's async writer thread. With AsyncWrite=ON, EndStep returns before bytes are durable; the drain shows up as DC_WaitOnAsync* at Close. Using this window gives bandwidth bounded by what actually reached storage.
Aggregate throughput uses max(durable_us) over all ranks (writers and non-writers) — non-writer ranks still block at Close waiting for the aggregator, and the wall clock is bounded by the slowest rank.
EntityTools.bp_to_vtk — Method
bp_to_vtk(data::EntityData, vtk_file::String, i_step::Integer)Writes the fields of a given time step from an EntityData object to a VTK file.
EntityTools.compute_fieldlines — Method
compute_fieldlines(r_coords, th_coords, fr_data, fth_data, start_points; kwargs...)Computes field lines of a vector field defined by radial (fr) and azimuthal (fth) components.
EntityTools.construct_bins_and_centers — Method
construct_bins_and_centers(bin_min, bin_max, Nbins)Returns the bins and their center points.
EntityTools.construct_times — Function
construct_times(sim_path, subfolder, read_steps=false)Finds all available output times for a given subfolder. If read_steps=true is set it also returns an array of the output steps constructed from file names.
EntityTools.dipole_sampling — Method
dipole_sampling(; nth::Int=30, pole::Float64=1/16)Returns an array of angles sampled from a dipole distribution.
EntityTools.find_closest_time — Method
find_closest_time(run_info::EntityData, t::Real)Finds the time in the available outputs that is closest to the requested one
EntityTools.find_idxs — Method
find_idxs(run_info, i_step, t, i, reduction_function, verbose)Find requested output file(s) based on single/array of steps i_step, time t or file number i. If a reduction_function is provided, options are interpreted as arrays.
EntityTools.get_Temp — Method
get_Temp(N::T, T00::T, V1::T, V2::T, V3::T; adiabatic_index::Real=5/3) where T <: RealCompute the temperature based on Sridhar et al. (2021, https://arxiv.org/pdf/2107.00263), Appendix C. It uses the number density N, total energy T00, and velocity components V1, V2, and V3. The function uses a root-finding method to solve for the internal energy and then converts it to temperature using the relation T = (2/3) * E_int.
EntityTools.get_histograms — Method
get_histograms(bins, Q)Computes the histograms for M_s of all shocked particles
EntityTools.monopole_sampling — Method
monopole_sampling(; nth::Int=30)Returns an array of angles sampled from a monopole distribution.
EntityTools.omega_i — Method
omega_p = sqrt(4pin*q^2/m)
EntityTools.parse_compound_time — Method
parse_compound_time(str)Parse compound durations like "10s 143ms", "3min 39s", "286ms 625µs" into seconds.
EntityTools.parse_output — Method
parse_output(path) -> SimOutputParse an entity .out log file. The number and names of substeps are discovered dynamically. All times are stored in seconds.
EntityTools.parse_timing — Function
parse_timing(filename)Reads the output log file and returns a tuple of Arrays of (step_number, timing, active_p).
EntityTools.phase_map — Method
phase_map(x_q, y_q, x_lim, y_lim;
xbins::Int=400, ybins::Int=50,
show_progress::Bool=true)Get a 2D histogram of x_q and y_q in the limits x_lim, y_lim over a number if bins xbins and ybins.
EntityTools.polar_contour! — Method
polar_contour!(ax, r_coords, th_coords, data_values; kwargs...)Plots standard contours for 2D polar data on rectilinear axes.
EntityTools.polar_fieldlines! — Method
polar_fieldlines!(ax, r_coords, th_coords, fr_data, fth_data; kwargs...)Plots field lines on an existing Makie axis.
EntityTools.polar_pcolor! — Method
polar_pcolor!(ax, r_coords, th_coords, data_values; kwargs...)Plots a pseudocolor plot of 2D polar data onto a rectilinear projection. Creates a triangular mesh to cleanly handle non-uniform cells.
EntityTools.power_spectrum — Method
power_spectrum(field_x::AbstractArray, field_y::AbstractArray, field_z::AbstractArray; cells_per_skindepth = 1.0)Computes the power spectrum of the given fields. The fields are expected to be 3D arrays with dimensions (nx, ny, nz) or 2D arrays with dimensions (nx, ny). The cells_per_skindepth parameter is used to scale the frequencies appropriately.
EntityTools.power_spectrum — Method
power_spectrum(field::AbstractArray; cells_per_skindepth = 1.0)Computes the power spectrum of a single scalar field. The field is expected to be a 3D array with dimensions (nx, ny, nz) or a 2D array with dimensions (nx, ny). The cells_per_skindepth parameter is used to scale the frequencies appropriately.
EntityTools.power_spectrum_2D — Method
power_spectrum_2D(field_x::AbstractArray, field_y::AbstractArray, field_z::AbstractArray; cells_per_skindepth = 1.0)Computes the 2D power spectrum of the given fields. The fields are expected to be 3D arrays with dimensions (nx, ny, nz) or 2D arrays with dimensions (nx, ny). The cells_per_skindepth parameter is used to scale the frequencies appropriately.
EntityTools.power_spectrum_2D — Method
power_spectrum_2D(field::AbstractArray; cells_per_skindepth = 1.0)Computes the 2D power spectrum of a single scalar field. The field is expected to be a 2D array with dimensions (nx, ny). The cells_per_skindepth parameter is used to scale the frequencies appropriately.
EntityTools.power_spectrum_3D — Method
power_spectrum_3D(field_x::AbstractArray, field_y::AbstractArray, field_z::AbstractArray; k_norm = 1.0)Computes the 3D power spectrum of the given fields. The fields are expected to be 3D arrays with dimensions (nx, ny, nz). The cells_per_skindepth parameter is used to scale the frequencies appropriately.
EntityTools.power_spectrum_3D — Method
power_spectrum_3D(field::AbstractArray; cells_per_skindepth = 1.0)Computes the 3D power spectrum of a single scalar field. The field is expected to be a 3D array with dimensions (nx, ny, nz). The cells_per_skindepth parameter is used to scale the frequencies appropriately.
EntityTools.rLi — Method
rLi(unit::EntityUnits, mi, me)Larmor radius of a particle with mass mi in normalized units.
EntityTools.read_field — Method
read_field(run_info::EntityData, field_name::String;
i_step=nothing, t=nothing, i=nothing,
reduction_function=nothing,
verbose::Bool=false)Reads a single field for an individual file. If reduction_function is provied the reduced field is computed for the requested output or a range of outputs.
EntityTools.read_field — Method
read_field(run_info::EntityData, field_names::Vector{String};
i_step=nothing, t=nothing, i=nothing,
reduction_function=nothing,
slice=nothing,
verbose::Bool=false)Read fields with given field_names at a requested step i_step, time t or index i. If a reduction_function it is applied to the fields in the requested step, time or index range.
EntityTools.read_field_info — Method
read_field_info(sim_path)Reads the info on what fields are stored in the particles files.
EntityTools.read_fields_reduced — Method
read_fields_reduced(run_info::EntityData, field_names::Vector{String};
i, reduction_function, slice, verbose)Reads fields over an output range and computes a reduction based on reduction_function.
EntityTools.read_particle_info — Method
read_particle_info(sim_path)Reads the info on what fields are stored in the particles files.
EntityTools.read_particles — Method
read_particles( run_info::EntityData, species::Integer,
properties::Vector{String};
i_step=nothing, t=nothing, i=nothing,
reduction_function=nothing,
slice=nothing,
verbose=true )Read properties for particle species. Give either file number i, time t or step number i_step. If a reduction_function is given it computes the reduction per timestep. In this case you can also give i, t or i_step as arrays to read time series.
EntityTools.read_particles_reduced — Method
read_particles_reduced(run_info::EntityData, species::Integer,
properties::Vector{String};
i=nothing, reduction_function=nothing,
slice=nothing,
verbose=false)Read properties for particle species and apply reduction_function to the data.
EntityTools.read_run_settings — Method
read_run_settings(sim_path, subfolder)Read the general settings of a run from the first file in a subfolder.
EntityTools.read_spectrum — Method
read_spectrum(run_info::EntityData, species::Integer;
i_step=nothing, t=nothing, i=nothing,
verbose=true)Read spectrum for particle species. Give either file number i, time t or step number i_step.
EntityTools.read_spectrum_info — Method
read_spectrum_info(sim_path)Reads the info on what fields are stored in the spectrum files.
EntityTools.read_times — Function
read_times(sim_path, subfolder, read_steps=false)Finds all available output times for a given subfolder. If read_steps=true is set it also returns an array of the output steps constructed from file names.
EntityTools.reduce_read_positions — Method
reduce_read_positions(sel)Reduces the individual read positions by finding sub-ranges. Returns an array of read indices and an array with the number of entries per index.
EntityTools.reinterpret_time — Method
reinterpret_time(time_string)Takes the time string and computes the duration in seconds
EntityTools.select_first_file — Method
select_first_file(sim_path, subfolder)Selects the first available file in a subfolder or throws an error
EntityTools.spectrum — Method
spectrum(Q, spec_min, spec_max; Nbins=100)Constructs a spectrum dQ/dx between x values between spec_min and spec_max. Uses a number of Nbins=100 by default.
EntityTools.substep_series — Method
substep_series(sim, name)Per-step time series (seconds) for substep name. Steps where the substep is absent return NaN.
EntityTools.summary_table — Method
summary_table(sim) -> Vector{NamedTuple}One row per substep with (sum, mean, min, max) in seconds, in the order the substeps first appeared in the file.
EntityTools.vA — Method
vA(unit::EntityUnits)Alfvén speed in normalized units.