Skip to main content

SheetTracker

Struct SheetTracker 

Source
pub struct SheetTracker {
    pub particles: Vec<SheetParticle>,
    pub shape: [usize; 3],
    pub domain: Domain,
    pub stream_threshold: f64,
    pub particle_mass: f64,
}
Expand description

Lagrangian cold dark matter sheet tracker.

Stores N³ particles on a Lagrangian grid. Each particle tracks its initial coordinate q, current position x, and velocity v. The distribution function is a sum of delta functions — a cold (zero-entropy) system.

Fields§

§particles: Vec<SheetParticle>§shape: [usize; 3]§domain: Domain§stream_threshold: f64§particle_mass: f64

Implementations§

Source§

impl SheetTracker

Source

pub fn new(domain: Domain) -> Self

Create a new sheet tracker with N³ particles at spatial cell centers, v = 0.

Domain spans [−L_k, L_k] in each dimension. Particles are placed at x_k = −L_k + (i_k + 0.5) * dx_k, with q = x (identity mapping).

Source

pub fn from_zeldovich(ic: &ZeldovichIC, domain: &Domain) -> Self

Place one particle at each Lagrangian grid point, displaced by s(q).

Uses ZeldovichIC::displacement_field() and velocity_field() to set x = q + s(q), v = v₀(q).

Source

pub fn detect_caustics(&self) -> StreamCountField

Detect stream crossings by counting the number of particles per spatial cell.

In a single-stream region each cell contains at most one particle. When the sheet folds (caustic formation), multiple Lagrangian elements map to the same Eulerian cell, so the count exceeds 1.

Source

pub fn interpolate_density(&self, domain: &Domain) -> DensityField

Cloud-in-Cell (CIC) density deposition from particle positions.

Each particle of mass particle_mass at position x is distributed to the 8 surrounding grid nodes using trilinear weights. The result is divided by cell volume to give density ρ(x).

Trait Implementations§

Source§

impl PhaseSpaceRepr for SheetTracker

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 total_kinetic_energy(&self) -> f64

Total kinetic energy T = ½∫fv² dx³dv³.
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 to_snapshot(&self, time: f64) -> PhaseSpaceSnapshot

Extract a full 6D snapshot of the current state.
Source§

fn as_any(&self) -> &dyn Any

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

fn load_snapshot(&mut self, snap: PhaseSpaceSnapshot)

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

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

Source§

impl<T> DistributionExt for T
where T: ?Sized,

Source§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,