Skip to content

feat(aero): Mach from stagnation density ratio (completes the trio)#421

Merged
nochallenge merged 1 commit into
masterfrom
feat/aero-mach-from-stagnation-density
Jun 8, 2026
Merged

feat(aero): Mach from stagnation density ratio (completes the trio)#421
nochallenge merged 1 commit into
masterfrom
feat/aero-mach-from-stagnation-density

Conversation

@nochallenge

Copy link
Copy Markdown
Owner

What

Adds report::mach_from_stagnation_density_ratio(rho0_over_rho, gamma) — the Mach number recovered from a measured total-to-static density ratio:

// M = sqrt(2*((rho0/rho)^(gamma-1) - 1)/(gamma - 1))
pub fn mach_from_stagnation_density_ratio(rho0_over_rho: f64, gamma: f64) -> f64

Why

report.rs had the temperature- (#403) and pressure-ratio (#409) Mach inverses; this is the density-ratio one, inverting isentropic_stagnation_density_ratio and completing the stagnation-ratio inverse trio. Mirrors their sentinel style: returns the at-rest 0.0 (inverse of the ratio's 1.0 no-compression identity) for non-physical input (non-finite, rho0/rho < 1, or gamma <= 1).

Test

mach_from_stagnation_density_ratio_inverts_the_ratio:

  • (a) round-trip threading isentropic_stagnation_density_ratio (both directions);
  • (b) worked — at M=1, gamma=1.4 the sonic ratio rho0/rho = 1.2^2.5 -> M=1;
  • (c) consistency — for the same Mach, the density-, pressure-, and temperature-ratio reductions all return the same Mach (cross-validates the whole trio, non-tautological);
  • (d) at restrho0/rho = 1 -> M = 0;
  • (e) guards0-sentinel for rho0/rho < 1, gamma <= 1, non-finite.

Free fn in report.rs (not re-exported), no lib.rs change. valenx-aero 214 lib tests (was 213); cargo clippy -p valenx-aero --all-targets -- -D warnings clean. Research-grade compressible-flow data-reduction primitive.

Add report::mach_from_stagnation_density_ratio(rho0_over_rho, gamma), the
Mach number recovered from a measured total-to-static density ratio:

  M = sqrt(2*((rho0/rho)^(gamma-1) - 1)/(gamma - 1))

the inverse of isentropic_stagnation_density_ratio. With the temperature-
(#403) and pressure-ratio (#409) inverses it completes the stagnation-
ratio inverse trio. Mirrors their sentinel style: returns the at-rest 0.0
(the inverse of the ratio's 1.0 no-compression identity) for non-physical
input (non-finite, rho0/rho < 1, or gamma <= 1).

Analytic test mach_from_stagnation_density_ratio_inverts_the_ratio:
(a) round-trip threading isentropic_stagnation_density_ratio (both
    directions);
(b) worked: at M=1, gamma=1.4 the sonic ratio rho0/rho = 1.2^2.5 -> M=1;
(c) consistency with the temperature- and pressure-ratio inverses: for the
    same Mach all three stagnation-ratio reductions return the same Mach;
(d) at rest: rho0/rho = 1 -> M = 0;
(e) 0-sentinel guard for rho0/rho < 1, gamma <= 1, non-finite.

Free fn in report.rs (not re-exported), no lib.rs change. valenx-aero 214
lib tests (was 213), cargo clippy --all-targets -D warnings clean.
@nochallenge nochallenge merged commit 82788ff into master Jun 8, 2026
@nochallenge nochallenge deleted the feat/aero-mach-from-stagnation-density branch June 8, 2026 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant