Crate : kwaversRun : cargo run -p kwavers --example dg_acoustic_timestep_sweepSource : crates/kwavers/examples/dg_acoustic_timestep_sweep.rs
This example performs a timestep refinement sweep for Discontinuous Galerkin (DG) methods. It tests different acoustic solvers (DG, FDTD, k-space FDTD, PSTD) with varying timesteps to show stability and accuracy characteristics.
Solver Type
DG Discontinuous Galerkin
FDTD Finite-Difference Time Domain
k-space FDTD k-space corrected FDTD
PSTD Pseudo-Spectral Time Domain
Level Description
1 20 steps (coarsest timestep)
2 40 steps
3 80 steps (finest timestep)
File Description
timestep_sweep.pngError vs. timestep for all solvers
timestep_sweep.csvNumerical data
const STEP_COUNTS: [usize; 3] = [20, 40, 80];
let rows = run_timestep_sweep()?;
let out_dir = PathBuf::from("target/dg_acoustic_comparison");
fs::create_dir_all(&out_dir)?;
write_plot(&out_dir.join("timestep_sweep.png"), &rows)?;
write_csv(&out_dir.join("timestep_sweep.csv"), &rows)?;
← Numerical Methods: FDTD and PSTD