StormerVerlet
Defined in: verlet.rs:17
pub struct StormerVerletStörmer-Verlet (velocity Verlet) symplectic integrator.
A 2nd-order symplectic method for separable Hamiltonian systems (where acceleration depends only on position, not velocity). Exactly preserves phase-space volume and has excellent long-term energy conservation properties.
Only works with 2nd-order ODE states (State<DIM, 2>).
Methods
Section titled “Methods”step()
Section titled “step()”fn step<const DIM: usize, S>(&self, system: &S, t: f64, state: &State<DIM, 2>, dt: f64) -> State<DIM, 2> where S: [DynamicalSystem<State = State<DIM, 2>>](../../traits/dynamicalsystem/)
Perform a single Störmer-Verlet (velocity Verlet) step.
Kick-drift-kick form:
- v_{1/2} = v_n + (dt/2) * a(t_n, q_n)
- q_{n+1} = q_n + dt * v_{1/2}
- v_{n+1} = v_{1/2} + (dt/2) * a(t_{n+1}, q_{n+1})
integrate()
Section titled “integrate()”fn integrate<const DIM: usize, S, F>(&self, system: &S, initial: State<DIM, 2>, t0: f64, t_end: f64, dt: f64, callback: F) -> State<DIM, 2> where S: [DynamicalSystem<State = State<DIM, 2>>](../../traits/dynamicalsystem/), F: [FnMut(f64, &State<DIM, 2>)](https://doc.rust-lang.org/std/ops/function/trait.FnMut.html)
Integrate from t0 to t_end with fixed step size dt.
Panics
Section titled “Panics”Panics if the arguments cannot produce a terminating integration, and if
a step produces a non-finite state; see
try_integrate(Self::try_integrate) for the fallible form.
try_integrate()
Section titled “try_integrate()”fn try_integrate<const DIM: usize, S, F>(&self, system: &S, initial: State<DIM, 2>, t0: f64, t_end: f64, dt: f64, callback: F) -> [Result<State<DIM, 2>, IntegrationError>](https://doc.rust-lang.org/std/result/enum.Result.html) where S: [DynamicalSystem<State = State<DIM, 2>>](../../traits/dynamicalsystem/), F: [FnMut(f64, &State<DIM, 2>)](https://doc.rust-lang.org/std/ops/function/trait.FnMut.html)
Fallible variant of integrate(Self::integrate).
Mirrors Integrator::try_integrate(crate::Integrator::try_integrate)
so that “use try_integrate to avoid the panic” holds for every
integrator in the crate, not just the trait-based ones — including
stopping at the first step whose result is not finite.
integrate_with_events()
Section titled “integrate_with_events()”fn integrate_with_events<const DIM: usize, S, F, E, B>(&self, system: &S, initial: State<DIM, 2>, t0: f64, t_end: f64, dt: f64, callback: F, event_check: E) -> [IntegrationOutcome<State<DIM, 2>, B>](../../enums/integrationoutcome/) where S: [DynamicalSystem<State = State<DIM, 2>>](../../traits/dynamicalsystem/), F: [FnMut(f64, &State<DIM, 2>)](https://doc.rust-lang.org/std/ops/function/trait.FnMut.html), E: [Fn(f64, &State<DIM, 2>) -> ControlFlow<B>](https://doc.rust-lang.org/std/ops/function/trait.Fn.html)
Integrate with event detection and NaN/Inf checking.