This file is indexed.

/usr/lib/python2.7/dist-packages/gastables/ObliqueShock.py is in python-gastables 0.3-2.2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
""" Python module for properties behind an oblique shock in perfect gases
    
An Oblique shock wave is inclined at an angle to the direction of upstream
flow. Supersonic flow passing through an oblique shock (wave angle = beta)
is deflected through an angle (delta).

Assumptions:
1) Perfect gas with constant specific heats and molecular weights
2) Adiabatic flow
3) Absence of body forces
4) Absence of external work
    
"""
"""
 * Copyright (C) 2006 Varun Hiremath.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * Authors: Varun Hiremath, Venkattraman A
 * Version 0.2
"""

from scipy import optimize
from math import *
from NormalShock import NormalShock

class ObliqueShock:
    def __init__(self, g = 1.4):
        """ g is the value of gamma (ratio of specific heats), default = 1.4
        """
        self.g = g
        self.NS = NormalShock(self.g)
    
    def get_Turn_Angle_from_Mx_and_Wave_Angle(self, Mx, beta):
        """Returns turn angle (degrees) from Mx and wave angle beta (degrees)""" 
        beta = beta * pi/180
        if Mx < 1:
            raise Exception('The value of Mx should be greater than 1')
            return
        else :
            return atan(2/tan(beta)*(Mx**2 * sin(beta)**2 - 1)/(Mx**2 *(self.g + cos(2*beta)) + 2)) * 180/pi
        
    def get_Wave_Angle_from_Mx_and_Turn_Angle(self, Mx, theta, Strong=False):
        """Returns wave angle (degrees) from Mx and turn angle theta (degrees) for a
        weak shock. Pass True as the third argument for strong shock."""
        if Strong:
            return optimize.fsolve(lambda beta:self.get_Turn_Angle_from_Mx_and_Wave_Angle(Mx, beta) - theta, 80.0)
        else:
            return optimize.fsolve(lambda beta:self.get_Turn_Angle_from_Mx_and_Wave_Angle(Mx, beta) - theta, 10.0)

    def get_My_from_Mx_and_Turn_Angle(self, Mx, theta, Strong=False):
        """Returns My from Mx and turn angle theta (degrees) for a
        weak shock. Pass True as the third argument for strong shock."""
        beta = self.get_Wave_Angle_from_Mx_and_Turn_Angle(Mx, theta, Strong)
        beta = beta * pi/180
        theta = theta * pi/180
        M1n = Mx * sin(beta)
        M2n = self.NS.get_My_from_Mx(M1n)
        return  M2n / sin(beta - theta)

    def get_Py_by_Px_from_Mx_and_Turn_Angle(self, Mx, theta, Strong=False):
        """Returns py/px from Mx and turn angle theta (degrees) for a
        weak shock. Pass True as the third argument for strong shock."""
        beta = self.get_Wave_Angle_from_Mx_and_Turn_Angle(Mx , theta, Strong)
        beta = beta * pi/180
        M1n = Mx * sin(beta)
        return self.NS.get_Py_by_Px_from_Mx(M1n)

    def get_Py_by_Px_from_Mx_and_Wave_Angle(self, Mx, beta):
        """Returns py/px from Mx and wave angle beta (degrees)"""
        beta = beta * pi/180
        M1n = Mx * sin(beta)
        return self.NS.get_Py_by_Px_from_Mx(M1n)

    def get_Ty_by_Tx_from_Mx_and_Turn_Angle(self, Mx, theta, Strong=False):
        """Returns Ty/Tx from Mx and turn angle theta (degrees) for a
        weak shock. Pass True as the third argument for strong shock."""
        beta = self.get_Wave_Angle_from_Mx_and_Turn_Angle(Mx , theta, Strong)
        beta = beta * pi/180
        M1n = Mx * sin(beta)
        return self.NS.get_Ty_by_Tx_from_Mx(M1n)

    def get_Ty_by_Tx_from_Mx_and_Wave_Angle(self, Mx, beta):
        """Returns Ty/Tx from Mx and wave angle equal to beta"""
        beta = beta * pi/180
        M1n = Mx * sin(beta)
        return self.NS.get_Ty_by_Tx_from_Mx(M1n)

    def get_rhoy_by_rhox_from_Mx_and_Turn_Angle(self, Mx, theta, Strong=False):
        """Returns rhoy/rhox from Mx and turn angle equal to theta for a
        weak shock. Pass True as the third argument for strong shock."""
        beta = self.get_Wave_Angle_from_Mx_and_Turn_Angle(Mx , theta, Strong)
        beta = beta * pi/180
        M1n = Mx * sin(beta)
        return self.NS.get_rhoy_by_rhox_from_Mx(M1n)

    def get_rhoy_by_rhox_from_Mx_and_Wave_Angle(self, Mx, beta):
        """Returns rhoy/rhox from Mx and wave angle equal to beta"""
        beta = beta * pi/180
        M1n = Mx * sin(beta)
        return self.NS.get_rhoy_by_rhox_from_Mx(M1n)

    def get_Poy_by_Pox_from_Mx_and_Turn_Angle(self, Mx, theta, Strong=False):
        """Returns poy/pox from Mx and turn angle equal to theta for a
        weak shock. Pass True as the third argument for strong shock."""
        beta = self.get_Wave_Angle_from_Mx_and_Turn_Angle(Mx , theta, Strong)
        beta = beta * pi/180
        M1n = Mx * sin(beta)
        return self.NS.get_Poy_by_Pox_from_Mx(M1n)

    def get_Poy_by_Pox_from_Mx_and_Wave_Angle(self, Mx, beta):
        """Returns poy/pox from Mx and wave angle equal to beta"""
        beta = beta * pi/180
        M1n = Mx * sin(beta)
        return self.NS.get_Poy_by_Pox_from_Mx(M1n)

    def get_Poy_by_Px_from_Mx_and_Turn_Angle(self, Mx, theta, Strong=False):
        """Returns poy/pox from Mx and turn angle equal to theta for a
        weak shock. Pass True as the third argument for strong shock."""
        beta = self.get_Wave_Angle_from_Mx_and_Turn_Angle(Mx , theta, Strong)
        beta = beta * pi/180
        M1n = Mx * sin(beta)
        return self.NS.get_Poy_by_Px_from_Mx(M1n)

    def get_Poy_by_Px_from_Mx_and_Wave_Angle(self, Mx, beta):
        """Returns poy/px from Mx and wave angle equal to beta"""
        beta = beta * pi/180
        M1n = Mx * sin(beta)
        return self.NS.get_Poy_by_Px_from_Mx(M1n)