CompAero/ObliqueShockRelations.py
def plot_theta_beta_mach_chart(self) -> None:
        """ Plots the Theta-Beta-Mach plot from the data already in the class
        """
        mach = self.mach

        machWaveAngle = degrees(ObliqueShockRelations.calc_mach_wave_angle(mach))
        maxShockAngle = degrees(ObliqueShockRelations.calc_max_shock_angle(mach, self.gamma))
        maxDeflectionAngle = degrees(
            ObliqueShockRelations.calc_max_flow_deflection_angle(radians(maxShockAngle), mach, self.gamma)
        )

        weakFlowDeflectionAngles = np.linspace(0, maxDeflectionAngle - 0.1, 100)
        weakShockAngles = np.zeros(weakFlowDeflectionAngles.shape)
        strongShockAngles = np.zeros(weakFlowDeflectionAngles.shape)

        for ii in range(weakFlowDeflectionAngles.shape[0]):
            if weakFlowDeflectionAngles[ii] == 0:
                weakShockAngles[ii] = machWaveAngle
                strongShockAngles[ii] = 90
                continue

            weakShockAngles[ii] = degrees(
                ObliqueShockRelations.calc_beta_from_theta_beta_mach_weak(
                    radians(weakFlowDeflectionAngles[ii]), mach, self.gamma
                )
            )
            strongShockAngles[ii] = degrees(
                ObliqueShockRelations.calc_beta_from_theta_beta_mach_strong(
                    radians(weakFlowDeflectionAngles[ii]), mach, self.gamma
                )
            )

        weakFlowDeflectionAngles = np.append(weakFlowDeflectionAngles, [maxDeflectionAngle])
        strongShockAngles = np.append(strongShockAngles, [maxShockAngle])
        weakShockAngles = np.append(weakShockAngles, [maxShockAngle])

        vertPointLine = np.linspace(0, self.shockAngle, 20)
        horzPointLine = np.linspace(0, self.wedgeAngle, 20)

        _, ax = plt.subplots(1, 1)

        ax.plot(weakFlowDeflectionAngles, weakShockAngles, label=" Oblique Weak Shock")
        ax.plot(weakFlowDeflectionAngles, strongShockAngles, label="Oblique Strong Shock")
        # ax.plot(np.ones(vertPointLine.shape) * self.wedgeAngle, vertPointLine, 'g')
        # ax.plot(horzPointLine, np.ones(horzPointLine.shape) * self.shockAngle, 'g')
        ax.annotate(
            "Shock {}\nWedge {}".format(round(maxShockAngle, 2), round(maxDeflectionAngle, 2)),
            xy=(maxDeflectionAngle, maxShockAngle),
            xytext=(self.wedgeAngle - 0.4 * self.wedgeAngle, self.shockAngle + 0.1 * self.shockAngle),
            arrowprops=dict(facecolor="black", shrink=0.05),
        )
        ax.annotate(
            "Shock {}\nWedge {}".format(round(self.shockAngle, 2), round(self.wedgeAngle, 2)),
            xy=(self.wedgeAngle, self.shockAngle),
            xytext=(self.wedgeAngle - 0.2 * self.wedgeAngle, self.shockAngle - 0.4 * self.shockAngle),
            arrowprops=dict(facecolor="black", shrink=0.05),
        )
        # ax.set_xlim(0, maxDeflectionAngle + 5)
        # ax.set_ylim(0, 90)
        ax.set_xticks([num for num in range(0, int(maxDeflectionAngle) + 5, 2)])
        ax.set_yticks([num for num in range(0, 92, 2)])
        ax.set_xlabel("Flow Deflection Angle, \u03B8 (\u00b0)")
        ax.set_ylabel("Shock Anlge, \u03B2 (\u00b0)")
        ax.set_title("Mach {} Flow".format(round(self.mach, self.precision)))
        ax.legend()
        ax.grid()
        plt.show()
 Plots the Theta-Beta-Mach plot from the data already in the class
        
Plots the Theta-Beta-Mach plot from the data already in the class
Plots the Theta - Beta - Mach plot from the data already in the class
def plot_theta_beta_mach_chart(self) -> None:
        mach = self.mach
        machWaveAngle = degrees(ObliqueShockRelations.calc_mach_wave_angle(mach))
        maxShockAngle = degrees(ObliqueShockRelations.calc_max_shock_angle(mach, self.gamma))
        maxDeflectionAngle = degrees(
            ObliqueShockRelations.calc_max_flow_deflection_angle(radians(maxShockAngle), mach, self.gamma)
        )
        weakFlowDeflectionAngles = np.linspace(0, maxDeflectionAngle - 0.1, 100)
        weakShockAngles = np.zeros(weakFlowDeflectionAngles.shape)
        strongShockAngles = np.zeros(weakFlowDeflectionAngles.shape)
        for ii in range(weakFlowDeflectionAngles.shape[0]):
            if weakFlowDeflectionAngles[ii] == 0:
                weakShockAngles[ii] = machWaveAngle
                strongShockAngles[ii] = 90
                continue
            weakShockAngles[ii] = degrees(
                ObliqueShockRelations.calc_beta_from_theta_beta_mach_weak(
                    radians(weakFlowDeflectionAngles[ii]), mach, self.gamma
                )
            )
            strongShockAngles[ii] = degrees(
                ObliqueShockRelations.calc_beta_from_theta_beta_mach_strong(
                    radians(weakFlowDeflectionAngles[ii]), mach, self.gamma
                )
            )
        weakFlowDeflectionAngles = np.append(weakFlowDeflectionAngles, [maxDeflectionAngle])
        strongShockAngles = np.append(strongShockAngles, [maxShockAngle])
        weakShockAngles = np.append(weakShockAngles, [maxShockAngle])
        vertPointLine = np.linspace(0, self.shockAngle, 20)
        horzPointLine = np.linspace(0, self.wedgeAngle, 20)
        _, ax = plt.subplots(1, 1)
        ax.plot(weakFlowDeflectionAngles, weakShockAngles, label=" Oblique Weak Shock")
        ax.plot(weakFlowDeflectionAngles, strongShockAngles, label="Oblique Strong Shock")
        ax.annotate(
            "Shock {}\nWedge {}".format(round(maxShockAngle, 2), round(maxDeflectionAngle, 2)),
            xy=(maxDeflectionAngle, maxShockAngle),
            xytext=(self.wedgeAngle - 0.4 * self.wedgeAngle, self.shockAngle + 0.1 * self.shockAngle),
            arrowprops=dict(facecolor="black", shrink=0.05),
        )
        ax.annotate(
            "Shock {}\nWedge {}".format(round(self.shockAngle, 2), round(self.wedgeAngle, 2)),
            xy=(self.wedgeAngle, self.shockAngle),
            xytext=(self.wedgeAngle - 0.2 * self.wedgeAngle, self.shockAngle - 0.4 * self.shockAngle),
            arrowprops=dict(facecolor="black", shrink=0.05),
        )
        ax.set_xticks([num for num in range(0, int(maxDeflectionAngle) + 5, 2)])
        ax.set_yticks([num for num in range(0, 92, 2)])
        ax.set_xlabel("Flow Deflection Angle, \u03B8 (\u00b0)")
        ax.set_ylabel("Shock Anlge, \u03B2 (\u00b0)")
        ax.set_title("Mach {} Flow".format(round(self.mach, self.precision)))
        ax.legend()
        ax.grid()
        plt.show()
def plot_theta_beta_mach_chart ( self ) -> None : mach = self . mach machWaveAngle = degrees ( ObliqueShockRelations . calc_mach_wave_angle ( mach ) ) maxShockAngle = degrees ( ObliqueShockRelations . calc_max_shock_angle ( mach , self . gamma ) ) maxDeflectionAngle = degrees ( ObliqueShockRelations . calc_max_flow_deflection_angle ( radians ( maxShockAngle ) , mach , self . gamma ) ) weakFlowDeflectionAngles = np . linspace ( 0 , maxDeflectionAngle - 0.1 , 100 ) weakShockAngles = np . zeros ( weakFlowDeflectionAngles . shape ) strongShockAngles = np . zeros ( weakFlowDeflectionAngles . shape ) for ii in range ( weakFlowDeflectionAngles . shape [ 0 ] ) : if weakFlowDeflectionAngles [ ii ] == 0 : weakShockAngles [ ii ] = machWaveAngle strongShockAngles [ ii ] = 90 continue weakShockAngles [ ii ] = degrees ( ObliqueShockRelations . calc_beta_from_theta_beta_mach_weak ( radians ( weakFlowDeflectionAngles [ ii ] ) , mach , self . gamma ) ) strongShockAngles [ ii ] = degrees ( ObliqueShockRelations . calc_beta_from_theta_beta_mach_strong ( radians ( weakFlowDeflectionAngles [ ii ] ) , mach , self . gamma ) ) weakFlowDeflectionAngles = np . append ( weakFlowDeflectionAngles , [ maxDeflectionAngle ] ) strongShockAngles = np . append ( strongShockAngles , [ maxShockAngle ] ) weakShockAngles = np . append ( weakShockAngles , [ maxShockAngle ] ) vertPointLine = np . linspace ( 0 , self . shockAngle , 20 ) horzPointLine = np . linspace ( 0 , self . wedgeAngle , 20 ) _ , ax = plt . subplots ( 1 , 1 ) ax . plot ( weakFlowDeflectionAngles , weakShockAngles , label = " Oblique Weak Shock" ) ax . plot ( weakFlowDeflectionAngles , strongShockAngles , label = "Oblique Strong Shock" ) ax . annotate ( "Shock {}\nWedge {}" . format ( round ( maxShockAngle , 2 ) , round ( maxDeflectionAngle , 2 ) ) , xy = ( maxDeflectionAngle , maxShockAngle ) , xytext = ( self . wedgeAngle - 0.4 * self . wedgeAngle , self . shockAngle + 0.1 * self . shockAngle ) , arrowprops = dict ( facecolor = "black" , shrink = 0.05 ) , ) ax . annotate ( "Shock {}\nWedge {}" . format ( round ( self . shockAngle , 2 ) , round ( self . wedgeAngle , 2 ) ) , xy = ( self . wedgeAngle , self . shockAngle ) , xytext = ( self . wedgeAngle - 0.2 * self . wedgeAngle , self . shockAngle - 0.4 * self . shockAngle ) , arrowprops = dict ( facecolor = "black" , shrink = 0.05 ) , ) ax . set_xticks ( [ num for num in range ( 0 , int ( maxDeflectionAngle ) + 5 , 2 ) ] ) ax . set_yticks ( [ num for num in range ( 0 , 92 , 2 ) ] ) ax . set_xlabel ( "Flow Deflection Angle, \u03B8 (\u00b0)" ) ax . set_ylabel ( "Shock Anlge, \u03B2 (\u00b0)" ) ax . set_title ( "Mach {} Flow" . format ( round ( self . mach , self . precision ) ) ) ax . legend ( ) ax . grid ( ) plt . show ( )
Plots the Theta-Beta-Mach plot from the data already in the class
Plots the Theta - Beta - Mach plot from the data already in the class
""" Plots the Theta-Beta-Mach plot from the data already in the class
        """ # ax.plot(np.ones(vertPointLine.shape) * self.wedgeAngle, vertPointLine, 'g') # ax.plot(horzPointLine, np.ones(horzPointLine.shape) * self.shockAngle, 'g') # ax.set_xlim(0, maxDeflectionAngle + 5) # ax.set_ylim(0, 90)
self