Skip to content

Commit

Permalink
Add rate of change functions for partition tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
mpiannucci committed Jul 30, 2024
1 parent 7f5609b commit feaf605
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/tools/waves.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,25 @@ pub fn steepness_coefficient(zero_moment: f64, second_moment: f64) -> f64 {
(8.0 * PI * second_moment) / (9.81 * zero_moment.sqrt())
}

/// Rate of change of the wind-sea peak wave frequency.
/// Based on fetch-limited relationships, (Ewans & Kibblewhite, 1986).
///
/// Units are metric, gravity is 9.81 m/s
/// https://github.com/wavespectra/wavespectra/blob/master/wavespectra/partition/tracking.py
pub fn dfp_wind_sea(wind_speed: f64, period: f64, dt: f64, scale: f64) -> f64 {
let tmp = 15.8 * (9.81 / wind_speed).powf(0.57);
let t0 = (period / tmp).powf(-1.0 / 0.43);
scale * tmp * (t0 + dt).powf(-0.43) - period
}

/// Rate of change of the swell peak wave frequency.
///
/// Units are metric, gravity is 9.81 m/s
/// Based on the swell dispersion relationship derived by Snodgrass et al (1966).
pub fn dfp_swell_sea(dt: f64, distance: f64) -> f64 {
dt * 9.81 / (4.0 * PI * distance)
}

/// Calculate wavenumber and group velocity from the interpolation
/// array filled by DISTAB from a given intrinsic frequency and the
/// waterdepth.
Expand Down

0 comments on commit feaf605

Please sign in to comment.