Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add speed of sound isentropic ratio #27

Merged
merged 1 commit into from
Mar 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions skaero/gasdynamics/isentropic.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,24 @@ def A_Astar(self, M):
)
return A_Astar

def a_a0(self, M):
""" Speed of sound ratio from Mach number.

Parameters
----------
M: array_like
Mach number.

Returns
-------
a_a0: array_like
Speed of sound ratio.
"""

M = np.asarray(M)
a_a0 = self.T_T0(M) ** 0.5

return a_a0

class PrandtlMeyerExpansion(object):
"""Class representing a Prandtl-Meyer expansion fan.
Expand Down
9 changes: 9 additions & 0 deletions tests/test_isentropic.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,15 @@ def test_mach_from_area_ratio_raises_error_when_ratio_is_subsonic():
with pytest.raises(ValueError):
isentropic.mach_from_area_ratio(0.9)

def test_speed_of_sound_ratio():
fl = isentropic.IsentropicFlow(1.4)
M_list = [0.0, 0.3, 1.0, 1.3, 2.5]
expected_sound_speed_ratios = [1.0, 0.99112, 0.91287, 0.86451, 0.6667]

np.testing.assert_array_almost_equal(
fl.a_a0(M_list), expected_sound_speed_ratios, decimal=3
)


def test_mach_from_area_ratio_subsonic():
fl = isentropic.IsentropicFlow(1.4)
Expand Down