pub struct RK4Integrator;Expand description
Runge-Kutta 4th order integrator.
Fourth-order accurate, non-symplectic. Excellent for smooth problems but energy may drift in long-term simulations.
Algorithm (classical RK4):
k1_v = a(q_n)
k1_q = v_n
k2_v = a(q_n + h/2 * k1_q)
k2_q = v_n + h/2 * k1_v
k3_v = a(q_n + h/2 * k2_q)
k3_q = v_n + h/2 * k2_v
k4_v = a(q_n + h * k3_q)
k4_q = v_n + h * k3_v
v_{n+1} = v_n + h/6 * (k1_v + 2*k2_v + 2*k3_v + k4_v)
q_{n+1} = q_n + h/6 * (k1_q + 2*k2_q + 2*k3_q + k4_q)Implementations§
Source§impl RK4Integrator
impl RK4Integrator
Trait Implementations§
Source§impl Clone for RK4Integrator
impl Clone for RK4Integrator
Source§fn clone(&self) -> RK4Integrator
fn clone(&self) -> RK4Integrator
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RK4Integrator
impl Debug for RK4Integrator
Source§impl Default for RK4Integrator
impl Default for RK4Integrator
Source§fn default() -> RK4Integrator
fn default() -> RK4Integrator
Returns the “default value” for a type. Read more
Source§impl Integrator for RK4Integrator
impl Integrator for RK4Integrator
Source§fn step(
&self,
state: &mut SimState,
force_field: &dyn ForceField,
dt: f64,
) -> SimResult<()>
fn step( &self, state: &mut SimState, force_field: &dyn ForceField, dt: f64, ) -> SimResult<()>
Step the state forward by one timestep. Read more
Source§fn error_order(&self) -> u32
fn error_order(&self) -> u32
Get the error order of this integrator.
Source§fn is_symplectic(&self) -> bool
fn is_symplectic(&self) -> bool
Check if integrator is symplectic (preserves phase space volume).
Auto Trait Implementations§
impl Freeze for RK4Integrator
impl RefUnwindSafe for RK4Integrator
impl Send for RK4Integrator
impl Sync for RK4Integrator
impl Unpin for RK4Integrator
impl UnsafeUnpin for RK4Integrator
impl UnwindSafe for RK4Integrator
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