pub struct FftPoisson {
pub shape: [usize; 3],
pub dx: [f64; 3],
/* private fields */
}Expand description
Periodic-boundary-condition Poisson solver using 3D FFTs, O(N^3 log N).
Solves nabla^2 Phi = 4piG*rho spectrally: forward-transform rho, multiply by the Green’s function -1/k^2, and inverse-transform to obtain Phi. The z-axis exploits Hermitian symmetry via R2C/C2R transforms; x and y use full C2C.
Best suited for cosmological periodic boxes where the domain wraps on all axes.
FFT plans are precomputed at construction and reused across all solve() calls.
Fields§
§shape: [usize; 3]Number of grid cells along each spatial axis [nx, ny, nz].
dx: [f64; 3]Grid spacing along each spatial axis [dx, dy, dz].
Implementations§
Trait Implementations§
Source§impl PoissonSolver for FftPoisson
impl PoissonSolver for FftPoisson
Source§fn solve(&self, density: &DensityField, g: f64) -> PotentialField
fn solve(&self, density: &DensityField, g: f64) -> PotentialField
Solve nabla^2 Phi = 4piG*rho with periodic BC via spectral Green’s function.
Forward-transforms rho (R2C), divides by -k^2 in Fourier space (zeroing the DC mode to remove the mean), and inverse-transforms (C2R) to obtain the potential.
Source§fn compute_acceleration(&self, potential: &PotentialField) -> AccelerationField
fn compute_acceleration(&self, potential: &PotentialField) -> AccelerationField
Compute the gravitational acceleration g = -grad(Phi) via spectral differentiation.
Forward-transforms Phi, multiplies each component by -i*k_j, and inverse-transforms to obtain gx, gy, gz. All three components are computed in a single parallel pass.
Source§fn set_progress(&mut self, p: Arc<StepProgress>)
fn set_progress(&mut self, p: Arc<StepProgress>)
Auto Trait Implementations§
impl !Freeze for FftPoisson
impl !RefUnwindSafe for FftPoisson
impl Send for FftPoisson
impl Sync for FftPoisson
impl Unpin for FftPoisson
impl UnsafeUnpin for FftPoisson
impl !UnwindSafe for FftPoisson
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