pub struct Diagnostics {
pub history: Vec<GlobalDiagnostics>,
}Expand description
Accumulates time series of GlobalDiagnostics.
Fields§
§history: Vec<GlobalDiagnostics>Implementations§
Source§impl Diagnostics
impl Diagnostics
Sourcepub fn compute(
&mut self,
repr: &dyn PhaseSpaceRepr,
potential: &PotentialField,
time: f64,
dx3: f64,
) -> GlobalDiagnostics
pub fn compute( &mut self, repr: &dyn PhaseSpaceRepr, potential: &PotentialField, time: f64, dx3: f64, ) -> GlobalDiagnostics
Compute all global diagnostics from the current representation and potential.
dx3 is the spatial cell volume dx1dx2dx3.
Sourcepub fn compute_with_density(
&mut self,
repr: &dyn PhaseSpaceRepr,
density: &DensityField,
potential: &PotentialField,
time: f64,
dx3: f64,
) -> GlobalDiagnostics
pub fn compute_with_density( &mut self, repr: &dyn PhaseSpaceRepr, density: &DensityField, potential: &PotentialField, time: f64, dx3: f64, ) -> GlobalDiagnostics
Compute all global diagnostics using a pre-computed density field.
This avoids redundant compute_density() calls when the caller
already has the density (e.g. from a Poisson solve in the same step).
Sourcepub fn kinetic_energy(repr: &dyn PhaseSpaceRepr) -> f64
pub fn kinetic_energy(repr: &dyn PhaseSpaceRepr) -> f64
Total kinetic energy T = ½∫fv² dx³dv³.
Returns 0.0 if the representation does not support kinetic energy computation.
Sourcepub fn potential_energy(
density: &DensityField,
potential: &PotentialField,
dx3: f64,
) -> f64
pub fn potential_energy( density: &DensityField, potential: &PotentialField, dx3: f64, ) -> f64
Total potential energy W = ½∫ρΦ dx³.
dx3 is the spatial cell volume.
Sourcepub fn virial_ratio(t: f64, w: f64) -> f64
pub fn virial_ratio(t: f64, w: f64) -> f64
Virial ratio 2T/|W|. Equals 1.0 at equilibrium.
Sourcepub fn max_relative_drift<F: Fn(&GlobalDiagnostics) -> f64>(
&self,
quantity: F,
) -> f64
pub fn max_relative_drift<F: Fn(&GlobalDiagnostics) -> f64>( &self, quantity: F, ) -> f64
Maximum relative drift of a conserved quantity over the full history.
Returns |Q(t) - Q(0)| / |Q(0)| for the worst timestep, or 0 if history is empty.
Sourcepub fn conservation_summary(&self) -> ConservationSummary
pub fn conservation_summary(&self) -> ConservationSummary
Conservation summary: max relative drifts in mass, energy, and Casimir C₂.
Sourcepub fn density_profile(density: &DensityField, dx: [f64; 3]) -> Vec<(f64, f64)>
pub fn density_profile(density: &DensityField, dx: [f64; 3]) -> Vec<(f64, f64)>
Spherically averaged density profile ρ(r) at current timestep. Bins density cells by radius from domain centre, returns (r_bin, ρ_avg) pairs.
Auto Trait Implementations§
impl Freeze for Diagnostics
impl RefUnwindSafe for Diagnostics
impl Send for Diagnostics
impl Sync for Diagnostics
impl Unpin for Diagnostics
impl UnsafeUnpin for Diagnostics
impl UnwindSafe for Diagnostics
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more