Skip to main content

VelocityVerlet

Struct VelocityVerlet 

Source
pub struct VelocityVerlet { /* private fields */ }
Expand description

Explicit, second-order, fixed-step method for dynamics.1

\ddot{x} = a(t, x, \dot{x})
v_{n+1/2} = v_n + \tfrac{h}{2}\,a_n
x_{n+1} = x_n + h\,v_{n+1/2}
a_{n+1} = a(t_{n+1}, x_{n+1}, v_{n+1/2})
v_{n+1} = v_{n+1/2} + \tfrac{h}{2}\,a_{n+1}

It requires one evaluation of the acceleration per step, and is stable for $h \le 2/\omega_{max}$. It is symplectic, and conserves a nearby energy, for conservative accelerations and a fixed time step. Accelerations that depend on velocity are evaluated at the half-step velocity, which is no longer symplectic.


  1. Also known as the leapfrog or kick-drift-kick method, and equivalent to the central difference method for dynamics. ↩

Implementations§

Source§

impl VelocityVerlet

Source

pub fn new<T>(dt: Quantity<T>) -> Self

Constructs the integrator with a fixed time step.

Trait Implementations§

Source§

impl Debug for VelocityVerlet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for VelocityVerlet

Source§

fn default() -> VelocityVerlet

Returns the “default value” for a type. Read more
Source§

impl<X, UX, UV, UA, T> ExplicitDynamics<X, UX, UV, UA, T> for VelocityVerlet
where X: Differentiable<T> + Tensor, Derivative<X, T>: Differentiable<T> + Tensor, for<'a> &'a Derivative<X, T>: Mul<Quantity<T>, Output = X>, for<'a> &'a Derivative<Derivative<X, T>, T>: Mul<Quantity<T>, Output = Derivative<X, T>>, UX: TensorVec<Item = X>, UV: TensorVec<Item = Derivative<X, T>>, UA: TensorVec<Item = Derivative<Derivative<X, T>, T>>,

Source§

fn integrate( &self, function: impl FnMut(Quantity<T>, &X, &Derivative<X, T>) -> Result<Derivative<Derivative<X, T>, T>, String>, time: &[Quantity<T>], initial_position: X, initial_velocity: Derivative<X, T>, ) -> Result<(Times<T>, UX, UV, UA), IntegrationError>

Solves an initial value problem for dynamics, given the acceleration as a function of time, position, and velocity. Read more
Source§

fn integrate_bounded( &self, function: impl FnMut(Quantity<T>, &X, &Derivative<X, T>) -> Result<Derivative<Derivative<X, T>, T>, String>, bound: impl FnMut(Quantity<T>, &X, &Derivative<X, T>) -> Result<Quantity<T>, String>, safety: Scalar, time: &[Quantity<T>], initial_position: X, initial_velocity: Derivative<X, T>, ) -> Result<(Times<T>, UX, UV, UA), IntegrationError>

Solves an initial value problem like integrate, subject to a stability bound. Read more
Source§

impl<T> FixedStep<T> for VelocityVerlet

Source§

fn dt(&self) -> Quantity<T>

Returns the time step.

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Is<T> for T

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.