MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Kinesis::Acoustics Namespace Reference

Namespaces

namespace  detail

Classes

struct  DuctGrid
 Prepared grid and update gains of one bore. More...
class  DuctLoss
 Prepared implicit loss step for one duct grid. More...
struct  DuctSpec
 Physical and sampling constants a grid is built from. More...
struct  RadiationCoefficients
 Prepared coefficients of one end, built once per bore or step change. More...
struct  RadiationSpec
 What the network constants are scaled by. More...
struct  RadiationState
 Inductor flow and branch pressure, zero at rest. More...
struct  ReedChannel
 Geometry and constants of the reed channel. More...

Typedefs

using FlowSample = std::pair<double, double>
 Flow through a coupling, then its slope against the pressure difference.
using RadiationModel = std::array<double, 3>
 The three dimensionless constants of the radiation network, as gamma, lambda and theta.

Enumerations

enum class  DuctError : uint8_t { INVALID_SPEC , INVALID_PROFILE , TOO_SHORT }
 Why no grid was built. More...

Functions

void advance_pressure (std::span< double > pressure, std::span< const double > velocity, std::span< const double > pressure_gain) noexcept
 Advance the interior pressures from the new velocities.
void advance_velocity (std::span< double > velocity, std::span< const double > pressure, std::span< const double > velocity_gain) noexcept
 Advance the half step velocities from the pressure.
constexpr double centred_end_pressure (double driving_pressure, double pressure_difference, double end_pressure) noexcept
 Pressure of the end cell after the step, once the difference is solved.
double discrete_energy (std::span< const double > pressure, std::span< const double > velocity_previous, std::span< const double > velocity_current, std::span< const double > pressure_gain, std::span< const double > velocity_gain, double time_step) noexcept
 Discrete energy of the bore in joules.
size_t duct_intervals (const DuctSpec &spec) noexcept
 Number of grid intervals a spec allows.
std::tuple< double, double, double > dynamic_reed_mouth_step (const ReedChannel &reed, double resonance, double damping, double reed_area, double time_step, std::array< double, 2 > &motion, double end_pressure_gain, double mouth_pressure, double end_pressure, double downstream_flow) noexcept
 Couple a reed with its own dynamics to the first cell of the bore.
constexpr double end_cell_pressure (double pressure, double pressure_gain, double net_inflow) noexcept
 New pressure of an end cell from the flow into it.
constexpr double flow_coupling_gain (double end_pressure_gain) noexcept
 Gain of a time centred coupling at an end cell.
constexpr double flow_coupling_target (double driving_pressure, double end_pressure, double gain, double downstream_flow) noexcept
 Right side of the coupling equation.
template<typename Radius>
requires std::is_invocable_r_v<double, Radius&, double>
std::expected< DuctGrid, DuctError > make_duct_grid (const DuctSpec &spec, Radius radius)
 Build a grid from a radius function of position.
std::expected< DuctGrid, DuctError > make_duct_grid (const DuctSpec &spec, std::span< const double > radii)
 Build a grid from radii sampled evenly along the bore.
std::optional< RadiationCoefficients > make_radiation_coefficients (const RadiationSpec &spec, double end_area, double end_pressure_gain) noexcept
 Prepare the coefficients of a radiating end.
constexpr double radiated_pressure (double flow, double previous_flow, double time_step, double air_density, double distance=1.0) noexcept
 Pressure radiated into free space by a flow out of the end.
constexpr RadiationModel radiation_model_from_pade (double n1, double d1, double d2) noexcept
 Network constants from the numerator and denominator of the Pade reflection coefficient R = -(1 - n1 s) / (1 - d1 s + d2 s^2).
std::pair< double, double > radiation_step (const RadiationCoefficients &coefficients, RadiationState &state, double end_pressure, double upstream_flow) noexcept
 Advance the end cell and the load one sample.
bool reed_coupling_is_unique (const ReedChannel &reed, double gain) noexcept
 Whether a coupling gain keeps the solution unique.
double reed_flow (const ReedChannel &reed, double difference) noexcept
 Volume velocity through the channel for a pressure difference.
double reed_flow_coefficient (const ReedChannel &reed) noexcept
 w H sqrt(2 / rho), the flow per unit of (1 - d / pM) sign(d) sqrt|d|.
std::tuple< double, double, double, RootStatus > reed_mouth_step (const ReedChannel &reed, double &warm_start, double end_pressure_gain, double mouth_pressure, double end_pressure, double downstream_flow) noexcept
 Couple the reed to the first cell of the bore for one sample.
void resample_line (std::span< const double > source, std::span< double > target, double offset=0.0) noexcept
 Linearly interpolate a line of values onto another of a different size by relative position.
double sample_pressure (std::span< const double > pressure, double position) noexcept
 Pressure at a position along the bore, linearly interpolated.
template<typename FlowLaw>
requires std::invocable<FlowLaw&, double> && std::convertible_to<std::invoke_result_t<FlowLaw&, double>, FlowSample>
std::tuple< double, double, RootStatus > solve_pressure_flow (FlowLaw law, double gain, double target, double lower, double upper, double guess, const RootOptions &options={})
 Solve a coupling for any flow law.
double viscothermal_attenuation (double radius, double frequency, double sound_speed=343.0, double air_density=1.2) noexcept
 Plane wave attenuation of a circular tube from its wall boundary layers.
std::pair< double, double > viscothermal_rates (double radius, double sound_speed=343.0, double air_density=1.2, double low_frequency=150.0, double high_frequency=3000.0) noexcept
 Friction and viscosity that match the tube's attenuation at two frequencies.

Variables

constexpr RadiationModel flanged_radiation = radiation_model_from_pade(0.182, 1.825, 0.649)
 Pipe in an infinite flange, end correction 0.8216 a.
constexpr RadiationModel unflanged_radiation = radiation_model_from_pade(0.167, 1.393, 0.457)
 Unflanged circular pipe, end correction 0.6133 a.