Skip to main content

cfl_timestep

Function cfl_timestep 

Source
pub fn cfl_timestep(
    velocities: &[[f64; 3]],
    h: f64,
    c_sound: f64,
    cfl_factor: f64,
) -> f64
Expand description

Compute the CFL-limited time step for a particle system.

The CFL condition restricts the time step to: Δt = cfl_factor · h / max(|v_i| + c_sound)

where the maximum is taken over all particles.

§Arguments

  • velocities - Per-particle velocity vectors.
  • h - Smoothing length (characteristic length scale).
  • c_sound - Speed of sound (used as minimum wave speed).
  • cfl_factor - CFL safety factor (typically 0.1 – 0.4).