Friction and viscosity that match the tube's attenuation at two frequencies.
37{
38 if (!positive_finite(low_frequency) || !positive_finite(high_frequency) || !(low_frequency < high_frequency)) {
39 return { 0.0, 0.0 };
40 }
41
44 if (!(low > 0.0) || !(high > 0.0)) {
45 return { 0.0, 0.0 };
46 }
47
48 const double slope = (high - low) / (high_frequency * high_frequency - low_frequency * low_frequency);
49 const double flat = low - slope * low_frequency * low_frequency;
50
51 const double two_pi = 2.0 * std::numbers::pi;
52 const double friction = 2.0 * sound_speed * std::max(flat, 0.0);
53 const double viscosity = slope * 2.0 * sound_speed * sound_speed * sound_speed / (two_pi * two_pi);
54 return { friction, viscosity };
55}
double viscothermal_attenuation(double radius, double frequency, double sound_speed, double air_density) noexcept
Plane wave attenuation of a circular tube from its wall boundary layers.