def get_Kstar_max(self):
""" value of K*(dimensionless vortex constant) for which weight flow in maximum
See also:
NASA TN D-4421 eq. 23-25
"""
max_val = 0
while(1):
try:
f = lambda Mstar: (1 - (max_val/self.Mlstar)**2 * Mstar**2) ** (1/(self.gamma - 1))
integrate.quad(f,self.Mlstar,self.Mustar)
except:
max_val -= 0.1
break
max_val += 0.1
def func(Kstar_max):
a1 = (1 - Kstar_max**2)**(1/(self.gamma -1))
a2 = (1 - (Kstar_max**2) * (self.Mustar/self.Mlstar)**2)
a3 = (1/(self.gamma - 1))
# This if is to avoid the bug in python3 it self
if(a2<0):
a2 = ((Kstar_max**2) * (self.Mustar/self.Mlstar)**2 - 1)
a = a1 + a2**a3
else :
a = a1 - a2 ** a3
f = lambda Mstar: (1 - (Kstar_max/self.Mlstar)**2 * Mstar**2) ** (1/(self.gamma - 1))
b = integrate.quad(f,self.Mlstar,self.Mustar)
return a - b[0]
Kstar_max = optimize.brentq(func,0.1,max_val)
return Kstar_max
评论列表
文章目录