Skip to main content

SphericalRepr

Struct SphericalRepr 

Source
pub struct SphericalRepr {
    pub data: Vec<f64>,
    pub shape: [usize; 3],
    pub r_range: (f64, f64),
    pub v_range: (f64, f64),
    pub l_range: (f64, f64),
    pub dr: f64,
    pub dv: f64,
    pub dl: f64,
    pub domain: Domain,
}
Expand description

Spherically symmetric phase-space representation on a (r, v_r, L) grid.

Fields§

§data: Vec<f64>

Distribution function values: f[ir * nv * nl + iv * nl + il].

§shape: [usize; 3]

Grid sizes [nr, nv, nl].

§r_range: (f64, f64)

Radial grid: r ∈ [r_min, r_max].

§v_range: (f64, f64)

Radial velocity grid: v_r ∈ [-v_max, v_max].

§l_range: (f64, f64)

Angular momentum grid: L ∈ [0, L_max].

§dr: f64

Cell spacings.

§dv: f64§dl: f64§domain: Domain

Domain (for PhaseSpaceRepr trait compatibility).

Implementations§

Source§

impl SphericalRepr

Source

pub fn new( domain: Domain, nr: usize, nv: usize, nl: usize, r_max: f64, v_max: f64, l_max: f64, ) -> Self

Create a new spherical representation with zero-initialized f.

r_min is set to r_max / nr to avoid the r=0 coordinate singularity.

Source

pub fn r_at(&self, ir: usize) -> f64

Get radial coordinate for cell index.

Source

pub fn vr_at(&self, iv: usize) -> f64

Get radial velocity for cell index.

Source

pub fn l_at(&self, il: usize) -> f64

Get angular momentum for cell index.

Source

pub fn index(&self, ir: usize, iv: usize, il: usize) -> usize

Flat index into the data array for grid point (ir, iv, il).

Trait Implementations§

Source§

impl PhaseSpaceRepr for SphericalRepr

Source§

fn compute_density(&self) -> DensityField

Compute spherically averaged density rho(r) by integrating f over v_r and L.

Source§

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

Radial drift sub-step: semi-Lagrangian shift along r with dr/dt = v_r.

Source§

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

Velocity kick sub-step: semi-Lagrangian shift along v_r with dv_r/dt = -dPhi/dr + L^2/r^3 (gravitational + centrifugal acceleration).

Source§

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

Velocity moment (stub – returns an empty tensor).

Source§

fn total_mass(&self) -> f64

Total mass by integrating f over the (r, v_r, L) grid with 4pir^2 Jacobian.

Source§

fn casimir_c2(&self) -> f64

Casimir C2 = integral of f^2 over the reduced phase space.

Source§

fn entropy(&self) -> f64

Entropy S = -integral of f ln f over the reduced phase space.

Source§

fn stream_count(&self) -> StreamCountField

Stream count (stub – returns zeros; not applicable in spherical coords).

Source§

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

Local velocity distribution (stub – returns empty; use radial profiles instead).

Source§

fn total_kinetic_energy(&self) -> Option<f64>

Total kinetic energy T = 0.5 * integral of f*(v_r^2 + L^2/r^2) over phase space.

Source§

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

Serialize the 3D grid into a PhaseSpaceSnapshot for checkpointing.

Source§

fn load_snapshot( &mut self, snap: PhaseSpaceSnapshot, ) -> Result<(), CausticError>

Restore the grid data from a previously saved snapshot.

Source§

fn as_any(&self) -> &dyn Any

Downcast to &dyn Any for runtime type queries.

Source§

fn as_any_mut(&mut self) -> &mut dyn Any

Downcast to &mut dyn Any for runtime type queries.

Source§

fn memory_bytes(&self) -> usize

Heap memory used by the distribution function data array.

Source§

fn set_progress(&mut self, _p: Arc<StepProgress>)

Attach shared progress state for intra-phase cell-level reporting. Implementations can use this to report progress via StepProgress::set_intra_progress.
Source§

fn can_materialize(&self) -> bool

Whether full 6D materialization fits in available memory. Default: true. Compressed representations (HT, TT) should override to check shape vs a memory threshold.

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,