Expand description
§caustic
A trait-based 6D Vlasov–Poisson solver for collisionless gravitational dynamics.
caustic evolves the distribution function f(x,v,t) under the coupled Vlasov–Poisson system:
df/dt + v . grad_x f - grad Phi . grad_v f = 0 (Vlasov equation)
laplacian Phi = 4 pi G rho (Poisson equation)
rho = integral f dv^3 (density coupling)The library uses a pluggable trait architecture: each component
(PhaseSpaceRepr, PoissonSolver, Advector, TimeIntegrator,
ExitCondition) is a trait with multiple implementations that can be
mixed and matched via the Simulation builder.
§Quick Start
use caustic::prelude::*;
use caustic::{
FftPoisson, SemiLagrangian, StrangSplitting, UniformGrid6D,
Domain, DomainBuilder, SpatialBoundType, VelocityBoundType,
Simulation, sample_on_grid,
};
let domain = Domain::builder()
.spatial_extent(10.0)
.velocity_extent(5.0)
.spatial_resolution(16)
.velocity_resolution(16)
.t_final(1.0)
.spatial_bc(SpatialBoundType::Periodic)
.velocity_bc(VelocityBoundType::Open)
.build()
.unwrap();
let ic = PlummerIC::new(1.0, 1.0, 1.0);
let snap = sample_on_grid(&ic, &domain);
let mut sim = Simulation::builder()
.domain(domain.clone())
.poisson_solver(FftPoisson::new(&domain))
.advector(SemiLagrangian::new())
.integrator(StrangSplitting::new(1.0))
.initial_conditions(snap)
.time_final(1.0)
.build()
.unwrap();
let exit = sim.run().unwrap();
exit.print_summary();§Architecture
| Trait | Role |
|---|---|
PhaseSpaceRepr | Store and query f(x,v): grid, tensor, sheet, spectral, AMR |
PoissonSolver | Solve nabla^2 Phi = 4piG rho: FFT, multigrid, tree, spherical |
Advector | Advance f by dt via drift (spatial) and kick (velocity) sub-steps |
TimeIntegrator | Orchestrate the full timestep: Strang, Yoshida, unsplit RK, etc. |
ExitCondition | Termination predicates: time limit, energy drift, virial, etc. |
Use prelude for the most common imports.
Re-exports§
pub use serde_helpers::decimal_serde;pub use tooling::core::algos::ht::HtTensor;pub use tooling::core::algos::lagrangian::SemiLagrangian;pub use tooling::core::init::isolated::HernquistIC;pub use tooling::core::init::isolated::IsochroneIC;pub use tooling::core::init::isolated::IsolatedEquilibrium;pub use tooling::core::init::isolated::KingIC;pub use tooling::core::init::isolated::NfwIC;pub use tooling::core::init::isolated::PlummerIC;pub use tooling::core::init::isolated::sample_on_grid;pub use tooling::core::init::isolated::sample_on_grid_with_progress;pub use tooling::core::progress::ProgressSnapshot;pub use tooling::core::progress::StepPhase;pub use tooling::core::progress::StepProgress;pub use tooling::core::algos::uniform::UniformGrid6D;pub use tooling::core::algos::wpfc;pub use tooling::core::algos::wpfc::AdvectionScheme;
Modules§
- conservative_
svd - Conservative SVD: moment-preserving truncation for low-rank tensors.
- prelude
- Convenience re-exports for the most commonly used items.
- serde_
helpers - tooling
Structs§
- Acceleration
Field - 3D vector field g = −∇Φ; three flat
Vec<f64>for gx, gy, gz components. - Adaptive
Strang Splitting - Adaptive Strang splitting with Lie-in-Strang embedded error estimation.
- AmrGrid
- Adaptive mesh refinement grid in 6D phase space.
- Blanes
Moan Splitting - Blanes-Moan 4th-order symplectic integrator (6-stage, palindromic DKD).
- BugConfig
- Configuration for the BUG integrator.
- BugIntegrator
- BUG (Basis Update & Galerkin) integrator for low-rank tensor formats.
- Casimir
Drift Condition - Exit when relative Casimir drift exceeds
tolerance. - Caustic
Formation Condition - Exit when the first caustic forms (max stream count > 1).
- CflViolation
Condition - Exit when adaptive Δt drops below
dt_min. - Cosmological
Strang Splitting - Cosmological Strang splitting with scale-factor-dependent coefficients.
- CustomIC
Array - Pre-computed 6D distribution function loaded from an external file.
- Density
Field - 3D scalar field ρ(x); flat
Vec<f64>with(nx1, nx2, nx3)shape. - Disk
StabilityIC - Disk stability initial conditions: Shu (1969) distribution function f(E, Lz) for an axisymmetric disk with optional bulge, halo, and azimuthal perturbation.
- Displacement
Field - Displacement Δx = v·Δt for the spatial drift sub-step.
- Domain
- Complete 6D computational domain specification, ready for use by solver components.
- Domain
Builder - Fluent builder for
Domain. - Energy
Drift Condition - Exit when relative energy drift exceeds
tolerance. - Exit
Evaluator - Aggregates and evaluates all registered exit conditions each timestep.
- FftIsolated
Deprecated - Isolated-boundary-condition Poisson solver using the Hockney-Eastwood zero-padding method.
- FftPoisson
- Periodic-boundary-condition Poisson solver using 3D FFTs, O(N^3 log N).
- Flow
MapRepr - Flow-map Lagrangian representation of the 6D distribution function.
- Global
Diagnostics - One row of the global time-series output.
- HtPoisson
- HT-format Poisson solver for isolated BCs.
- Hybrid
Repr - Hybrid representation combining SheetTracker and UniformGrid6D.
- Instrumented
Strang Splitting - Instrumented version of
StrangSplittingthat records per-sub-step ranks and timings. - Kfvs
Solver - KFVS macroscopic solver on a 3D spatial grid.
- Lawson
RkIntegrator - Lawson-RK integrator: exact drift + RK4 gravity kick.
- LieSplitting
- First-order Lie operator splitting: drift(Δt) followed by kick(Δt).
- LoMaC
- LoMaC conservation manager.
- Macro
Micro Repr - Macro-micro representation: f = f_M + g.
- Macro
State - Macroscopic state at a single spatial cell: density, momentum, energy.
- Mass
Loss Condition - Exit when mass fraction drops below
threshold. - MergerIC
- Binary merger initial conditions: two displaced and boosted equilibria.
- Multigrid
- Geometric multigrid Poisson solver.
- Multipole
Expansion - Multipole expansion calculator for computing far-field boundary conditions.
- Parallel
BugConfig - Configuration for the Parallel BUG integrator.
- Parallel
BugIntegrator - Parallel BUG integrator: computes all 6 leaf K-steps simultaneously via rayon.
- Phase
Space Diagnostics - Collected phase-space structure diagnostics for a single time step.
- Phase
Space Snapshot - Full 6D snapshot f(x,v) at one instant; flat
Vec<f64>with shape(nx1, nx2, nx3, nv1, nv2, nv3). Only stored at checkpoint intervals. - Potential
Field - 3D scalar potential field Φ(x); same layout as
DensityField. - Range
Separated Poisson - Range-separated Poisson solver.
- Rank
Adaptive Controller - Adaptive rank controller for HT tensor truncation.
- RkBug
Config - Configuration for the RK-BUG integrator.
- RkBug
Integrator - RK-BUG integrator: classical Runge-Kutta time stepping with BUG tensor updates.
- Rkei
Integrator - RKEI: 3rd-order unsplit Runge-Kutta time integrator.
- Rkn6
Splitting - 6th-order symplectic integrator (triple-jump composition of Yoshida).
- Sheet
Tracker - Lagrangian cold dark matter sheet tracker.
- Simulation
- The top-level simulation object. Owns all solver components.
- SpectralV
- Spectral-in-velocity representation using orthonormal Hermite function basis.
- Spherical1D
Poisson - 1D Poisson solver for spherically symmetric density on a uniform radial grid.
- Spherical
Harmonics Poisson - Spherical-harmonics expansion Poisson solver.
- Spherical
Repr - Spherically symmetric phase-space representation on a (r, v_r, L) grid.
- Steady
State Condition - Exit when
‖∂f/∂t‖ < threshold(steady state reached). Uses interior mutability (Cell) to track previous entropy across calls, since the trait takes&self. - Step
Products - End-of-step products from
TimeIntegrator::advance(). - Step
Rank Diagnostics - Per-step rank diagnostics, populated by
InstrumentedStrangSplitting. Fields areNonewhen the representation is notHtTensor. - Step
Timings - Per-step phase timing breakdown in milliseconds.
Populated by instrumented time integrators and
Simulation::step(). - Strang
Splitting - Second-order symplectic time integrator via Strang splitting.
- Stream
Count Field - Number of distinct velocity streams n_s(x) at each spatial point. Nonzero where the sheet has folded (caustic formation).
- Tensor
- General velocity moment tensor of arbitrary rank.
- Tensor
Poisson - Tensor-format Poisson solver with isolated (vacuum) boundary conditions.
- Tensor
Train - Tensor-Train representation of the 6D phase-space distribution f(x,v).
- TidalIC
- Tidal stream initial conditions: a satellite on an orbit in a fixed host potential.
- Time
Limit Condition - Exit when simulation time reaches
t_final. - Tree
Poisson - Barnes-Hut tree code Poisson solver.
- Unsplit
Integrator - Method-of-lines Runge-Kutta integrator for the full 6D Vlasov PDE.
- VgfPoisson
- Vico–Greengard–Ferrando isolated Poisson solver.
- Virial
Relaxed Condition - Exit when the virial ratio 2T/|W| stabilises within
toleranceof 1.0. - Wall
Clock Condition - Exit when wall-clock time exceeds
limit_secsseconds. - Yoshida
Splitting - Fourth-order symplectic time integrator via Yoshida splitting.
- ZeldovichIC
- Multi-mode Zel’dovich pancake IC: cold dark matter sheet with random perturbations.
- Zeldovich
Single Mode - Single-mode Zel’dovich pancake IC for validation tests.
Enums§
- Caustic
Error - Top-level error type for caustic operations.
- Exit
Reason - Reason why the simulation terminated.
- Spatial
Bound Type - Spatial boundary condition type.
- Velocity
Bound Type - Velocity boundary condition type.
Traits§
- Advector
- Trait for all phase-space advection schemes.
- Exit
Condition - Trait for simulation exit predicates. Evaluated after each timestep.
- Phase
Space Repr - Central trait for all phase-space storage and manipulation strategies.
- Poisson
Solver - Trait for all gravitational Poisson solver implementations.
- Time
Integrator - Trait for all time integration / operator splitting strategies.
Functions§
- dec
- Convert f64 to Decimal, returning
Decimal::ZEROfor unrepresentable values. - f64_
to_ decimal - Convert f64 to Decimal with a warning on unrepresentable values (NaN, Inf, subnormal).
- field_
energy_ spectrum - Gravitational field energy spectrum E(k) = |k|² |Φ̂(k)|² binned by |k|.
- poisson_
residual_ l2 - L2 norm of the Poisson residual: ||∇²Φ − 4πGρ||₂.
- potential_
power_ spectrum - Spherically-averaged potential power spectrum P(k) = <|Φ̂(k)|²>.