Skip to main content

PhaseSpaceRepr

Trait PhaseSpaceRepr 

Source
pub trait PhaseSpaceRepr: Send + Sync {
Show 13 methods // Required methods fn compute_density(&self) -> DensityField; fn advect_x(&mut self, displacement: &DisplacementField, dt: f64); fn advect_v(&mut self, acceleration: &AccelerationField, dt: f64); fn moment(&self, position: &[f64; 3], order: usize) -> Tensor; fn total_mass(&self) -> f64; fn casimir_c2(&self) -> f64; fn entropy(&self) -> f64; fn stream_count(&self) -> StreamCountField; fn velocity_distribution(&self, position: &[f64; 3]) -> Vec<f64>; fn as_any(&self) -> &dyn Any; // Provided methods fn total_kinetic_energy(&self) -> f64 { ... } fn to_snapshot(&self, time: f64) -> PhaseSpaceSnapshot { ... } fn load_snapshot(&mut self, snap: PhaseSpaceSnapshot) { ... }
}
Expand description

Central trait for all phase-space storage and manipulation strategies.

Implementations differ in memory layout and algorithmic complexity:

  • UniformGrid6D: O(N⁶) brute-force grid
  • TensorTrain: O(N³r³) low-rank decomposition
  • SheetTracker: O(N³) Lagrangian cold sheet

Required Methods§

Source

fn compute_density(&self) -> DensityField

Integrate f over all velocities: ρ(x) = ∫f dv³. This is the coupling moment to the Poisson equation.

Source

fn advect_x(&mut self, displacement: &DisplacementField, dt: f64)

Drift sub-step: advect f in spatial coordinates by displacement Δx = v·dt. Pure translation in x at constant v.

Source

fn advect_v(&mut self, acceleration: &AccelerationField, dt: f64)

Kick sub-step: advect f in velocity coordinates by Δv = g·dt. Pure translation in v at constant x.

Source

fn moment(&self, position: &[f64; 3], order: usize) -> Tensor

Compute velocity moment of order n at given spatial position. Order 0 = density, 1 = mean velocity, 2 = dispersion tensor.

Source

fn total_mass(&self) -> f64

Total mass M = ∫f dx³dv³. Should be conserved to machine precision.

Source

fn casimir_c2(&self) -> f64

Casimir invariant C₂ = ∫f² dx³dv³. Increase over time indicates numerical diffusion.

Source

fn entropy(&self) -> f64

Boltzmann entropy S = −∫f ln f dx³dv³. Should be exactly conserved; growth = numerical error.

Source

fn stream_count(&self) -> StreamCountField

Number of distinct velocity streams at each spatial point. Detects caustic surfaces (sheet folds).

Source

fn velocity_distribution(&self, position: &[f64; 3]) -> Vec<f64>

Extract the local velocity distribution f(v|x) at a given spatial position. Used for dark matter detection predictions.

Source

fn as_any(&self) -> &dyn Any

Downcast to concrete type for implementation-specific queries (e.g. HT rank data).

Provided Methods§

Source

fn total_kinetic_energy(&self) -> f64

Total kinetic energy T = ½∫fv² dx³dv³.

Source

fn to_snapshot(&self, time: f64) -> PhaseSpaceSnapshot

Extract a full 6D snapshot of the current state.

Source

fn load_snapshot(&mut self, snap: PhaseSpaceSnapshot)

Replace the current state with data from a dense 6D snapshot.

Required for unsplit (method-of-lines) time integration, which manipulates the distribution function directly rather than through drift/kick sub-steps. Default implementation panics; not all representations support this efficiently.

Implementors§