pub struct SphericalHarmonicsPoisson {
pub l_max: usize,
pub n_radial: usize,
pub r_max: f64,
pub shape: [usize; 3],
pub dx: [f64; 3],
}Expand description
Spherical-harmonics expansion Poisson solver.
Best suited for nearly-spherical density distributions (isolated halos,
stellar systems). The expansion is truncated at degree l_max, and the
radial direction is discretized into n_radial bins from 0 to r_max.
Fields§
§l_max: usize§n_radial: usize§r_max: f64§shape: [usize; 3]§dx: [f64; 3]Implementations§
Source§impl SphericalHarmonicsPoisson
impl SphericalHarmonicsPoisson
Sourcepub fn new(
l_max: usize,
n_radial: usize,
shape: [usize; 3],
dx: [f64; 3],
) -> Self
pub fn new( l_max: usize, n_radial: usize, shape: [usize; 3], dx: [f64; 3], ) -> Self
Create a new spherical-harmonics Poisson solver.
l_max: maximum spherical harmonic degree (0 = monopole only).
n_radial: number of radial bins for the 1D Poisson solve.
shape: grid dimensions [nx, ny, nz].
dx: cell spacings [dx, dy, dz].
Trait Implementations§
Source§impl PoissonSolver for SphericalHarmonicsPoisson
impl PoissonSolver for SphericalHarmonicsPoisson
Source§fn solve(&self, density: &DensityField, g: f64) -> PotentialField
fn solve(&self, density: &DensityField, g: f64) -> PotentialField
Solve nabla^2 Phi = 4 pi G rho via spherical harmonic decomposition.
Steps:
- Decompose density into radial profiles rho_lm(r) for each (l,m).
- Solve the radial Poisson equation for each mode.
- Reconstruct the Cartesian potential by summing Phi_lm(r) Y_lm(theta,phi).
Source§fn compute_acceleration(&self, potential: &PotentialField) -> AccelerationField
fn compute_acceleration(&self, potential: &PotentialField) -> AccelerationField
Compute gravitational acceleration g = -nabla Phi via centered finite differences on the Cartesian grid.
Auto Trait Implementations§
impl Freeze for SphericalHarmonicsPoisson
impl RefUnwindSafe for SphericalHarmonicsPoisson
impl Send for SphericalHarmonicsPoisson
impl Sync for SphericalHarmonicsPoisson
impl Unpin for SphericalHarmonicsPoisson
impl UnsafeUnpin for SphericalHarmonicsPoisson
impl UnwindSafe for SphericalHarmonicsPoisson
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
Mutably borrows from an owned value. Read more
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>
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 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>
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