pub struct ZeldovichIC {
pub mean_density: Decimal,
pub h0: Decimal,
pub omega_m: Decimal,
pub omega_lambda: Decimal,
pub scale_factor_init: Decimal,
pub random_seed: u64,
/* private fields */
}Expand description
Multi-mode Zel’dovich pancake IC: cold dark matter sheet with random perturbations.
The exact distribution is f(x,v,t_0) = rho_bar * delta^3(v - v_0(x)) where v_0 is the Zel’dovich velocity field derived from a Harrison-Zel’dovich-like power spectrum. On a grid this is represented as a thin Gaussian in velocity centred on v_0(x).
Fields§
§mean_density: DecimalMean comoving matter density rho_bar.
h0: DecimalHubble constant H_0 in km/s/Mpc.
omega_m: DecimalPresent-day matter density parameter Omega_m.
omega_lambda: DecimalPresent-day dark energy density parameter Omega_Lambda.
scale_factor_init: DecimalInitial cosmological scale factor a(t_init).
random_seed: u64RNG seed for Fourier-space Gaussian random field generation.
Implementations§
Source§impl ZeldovichIC
impl ZeldovichIC
Sourcepub fn new(mean_density: f64, cosmology: CosmologyParams, seed: u64) -> Self
pub fn new(mean_density: f64, cosmology: CosmologyParams, seed: u64) -> Self
Create from f64 parameters via CosmologyParams (backward-compatible).
Sourcepub fn new_decimal(
mean_density: Decimal,
h0: Decimal,
omega_m: Decimal,
omega_lambda: Decimal,
scale_factor_init: Decimal,
seed: u64,
) -> Self
pub fn new_decimal( mean_density: Decimal, h0: Decimal, omega_m: Decimal, omega_lambda: Decimal, scale_factor_init: Decimal, seed: u64, ) -> Self
Create from Decimal parameters for exact config round-tripping.
Caches f64 conversions internally for hot-path computation.
Sourcepub fn new_single_mode(
mean_density: f64,
amplitude: f64,
wavenumber: f64,
sigma_v: f64,
) -> ZeldovichSingleMode
pub fn new_single_mode( mean_density: f64, amplitude: f64, wavenumber: f64, sigma_v: f64, ) -> ZeldovichSingleMode
Create a simple single-mode Zel’dovich pancake for testing.
v₀(x) = -A·sin(k·x₁) f(x,v) = (ρ̄/S) · exp(-(v - v₀(x))² / (2σ_v²))
where S normalises the Gaussian to unity over velocity space.
Sourcepub fn displacement_field(&self, domain: &Domain) -> [Vec<f64>; 3]
pub fn displacement_field(&self, domain: &Domain) -> [Vec<f64>; 3]
Generate the Zel’dovich displacement field s(q) from P(k) via FFT.
Uses Xorshift64 RNG with Box-Muller transform for Gaussian random
field generation in Fourier space, then IFFT to real space.
Sourcepub fn velocity_field(&self, domain: &Domain) -> [Vec<f64>; 3]
pub fn velocity_field(&self, domain: &Domain) -> [Vec<f64>; 3]
Zel’dovich velocity v₀(q) = a·H(a)·f(a)·s(q) (growing mode).
f(a) ≈ Ω_m(a)^{0.55} is the logarithmic growth rate.
Sourcepub fn sample_on_grid(
&self,
domain: &Domain,
progress: Option<&StepProgress>,
) -> PhaseSpaceSnapshot
pub fn sample_on_grid( &self, domain: &Domain, progress: Option<&StepProgress>, ) -> PhaseSpaceSnapshot
Sample onto 6D grid as a thin Gaussian in velocity centred on v₀(x).
f(x,v) = ρ̄ / ((2π)^{3/2} σ_v³) · exp(-|v - v₀(x)|² / (2σ_v²)) where σ_v = 0.3 · max(Δv) keeps the distribution cold but resolved.
Auto Trait Implementations§
impl Freeze for ZeldovichIC
impl RefUnwindSafe for ZeldovichIC
impl Send for ZeldovichIC
impl Sync for ZeldovichIC
impl Unpin for ZeldovichIC
impl UnsafeUnpin for ZeldovichIC
impl UnwindSafe for ZeldovichIC
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