rill_core_model/plate/params.rs
1use rill_core::Transcendental;
2
3/// Parameters for a 2D plate/membrane model.
4#[derive(Debug, Clone)]
5pub struct PlateParams<T: Transcendental> {
6 /// Grid width (4–64, power of two recommended).
7 pub grid_width: usize,
8 /// Grid height (4–64, power of two recommended).
9 pub grid_height: usize,
10 /// Wave speed coefficient (0.0–0.5, stability requires ≤ 0.25 for 2D).
11 pub wave_speed: T,
12 /// Decay per sample (0.0–1.0, 0.999 typical).
13 pub decay: T,
14 /// Boundary condition: 0.0 = clamped, 1.0 = free edge.
15 pub boundary: T,
16 /// Excitation position as fraction of width (0.0–1.0).
17 pub excitation_x: T,
18 /// Excitation position as fraction of height (0.0–1.0).
19 pub excitation_y: T,
20}
21
22impl<T: Transcendental> Default for PlateParams<T> {
23 fn default() -> Self {
24 Self {
25 grid_width: 16,
26 grid_height: 16,
27 wave_speed: T::from_f64(0.25),
28 decay: T::from_f64(0.999),
29 boundary: T::from_f64(0.5),
30 excitation_x: T::from_f64(0.5),
31 excitation_y: T::from_f64(0.5),
32 }
33 }
34}