def temperature_from_stagnation_temperature(g, T, M): """ T = stagnation_temperature(g,Tt,M): compute temperature from stagnation temperature and Mach for a 1D ideal gas Inputs: g = ratio of specific heats (required) (float) Tt = stagnation temperature (required) (floats) M = Mach number (required) (floats) Outputs: T = absolute temperature (floats) """ return Tt / f_of_M(g, M)
def stagnation_temperature(g, T, M): """ Tt = stagnation_temperature(g,T,M): compute stagnation temperature for a 1D ideal gas Inputs: g = ratio of specific heats (required) (float) T = absolute temperature (required) (floats) M = Mach number (required) (floats) Outputs: Tt = stagnation temperature (floats) """ return T * f_of_M(g, M)
def temperature_from_stagnation_temperature(g,T,M): """ T = stagnation_temperature(g,Tt,M): compute temperature from stagnation temperature and Mach for a 1D ideal gas Inputs: g = ratio of specific heats (required) (float) Tt = stagnation temperature (required) (floats) M = Mach number (required) (floats) Outputs: T = absolute temperature (floats) """ return Tt/f_of_M(g,M)
def stagnation_temperature(g,T,M): """ Tt = stagnation_temperature(g,T,M): compute stagnation temperature for a 1D ideal gas Inputs: g = ratio of specific heats (required) (float) T = absolute temperature (required) (floats) M = Mach number (required) (floats) Outputs: Tt = stagnation temperature (floats) """ return T*f_of_M(g,M)
def area_ratio_from_mach(g, M): """ M = mach_from_area_ratio(g,area_ratio,branch="supersonic"): get M from A/A* and gamma for a 1D ideal gas flow Inputs: g = ratio of specific heats (required) (float) M = Mach number (required) (float) Outputs: area_ratio = A/A* (float) """ n = (g + 1) / (2 * (g - 1)) c = ((g + 1) / 2)**n return 1 / (c * M / f_of_M(g, M)**n)
def stagnation_pressure(g, p, M): """ pt = stagnation_pressure(g,p,M): compute stagnation pressure for a 1D ideal gas Inputs: g = ratio of specific heats (required) (float) p = absolute pressure (required) (floats) M = Mach number (required) (floats) Outputs: pt = stagnation pressure (floats) """ n = g / (g - 1) return p * f_of_M(g, M)**n
def area_ratio_from_mach(g,M): """ M = mach_from_area_ratio(g,area_ratio,branch="supersonic"): get M from A/A* and gamma for a 1D ideal gas flow Inputs: g = ratio of specific heats (required) (float) M = Mach number (required) (float) Outputs: area_ratio = A/A* (float) """ n = (g+1)/(2*(g-1)) c = ((g+1)/2)**n return 1/(c*M/f_of_M(g,M)**n)
def pressure_from_stagnation_pressure(g,pt,M): """ p = pressure_from_stagnation_pressure(g,pt,M): compute pressure from stagnation pressure and Mach for a 1D ideal gas Inputs: g = ratio of specific heats (required) (float) pt = stagnation pressure (required) (floats) M = Mach number (required) (floats) Outputs: p = absolute pressure (floats) """ n = g/(g-1) return pt/(f_of_M(g,M)**n)
def stagnation_pressure(g,p,M): """ pt = stagnation_pressure(g,p,M): compute stagnation pressure for a 1D ideal gas Inputs: g = ratio of specific heats (required) (float) p = absolute pressure (required) (floats) M = Mach number (required) (floats) Outputs: pt = stagnation pressure (floats) """ n = g/(g-1) return p*f_of_M(g,M)**n
def dRdM(M, g, area_ratio, c, n): f = f_of_M(g, M) return -c * (-n * M * (g - 1) * M / (f**(n + 1)) + 1 / f**n)
def R(M, g, area_ratio, c, n): return 1 / area_ratio - c * M / f_of_M(g, M)**n
def dRdM(M,g,area_ratio,c,n): f = f_of_M(g,M) return -c*(-n*M*(g-1)*M/(f**(n+1)) + 1/f**n)
def R(M,g,area_ratio,c,n): return 1/area_ratio - c*M/f_of_M(g,M)**n