本文整理汇总了Python中SUAVE.Structure.Data.lift_coefficient方法的典型用法代码示例。如果您正苦于以下问题:Python Data.lift_coefficient方法的具体用法?Python Data.lift_coefficient怎么用?Python Data.lift_coefficient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SUAVE.Structure.Data
的用法示例。
在下文中一共展示了Data.lift_coefficient方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __call__
# 需要导入模块: from SUAVE.Structure import Data [as 别名]
# 或者: from SUAVE.Structure.Data import lift_coefficient [as 别名]
def __call__(self,conditions):
""" process vehicle to setup geometry, condititon and configuration
Inputs:
conditions - DataDict() of aerodynamic conditions
Outputs:
CL - array of lift coefficients, same size as alpha
CD - array of drag coefficients, same size as alpha
Assumptions:
linear intperolation surrogate model on Mach, Angle of Attack
and Reynolds number
locations outside the surrogate's table are held to nearest data
no changes to initial geometry or configuration
"""
# unpack
configuration = self.configuration
geometry = self.geometry
q = conditions.freestream.dynamic_pressure
Sref = geometry.reference_area
# lift needs to compute first, updates data needed for drag
CL = SUAVE.Methods.Aerodynamics.Supersonic_Zero.Lift.compute_aircraft_lift(conditions,configuration,geometry)
# drag computes second
CD = compute_aircraft_drag(conditions,configuration,geometry)
# pack conditions
conditions.aerodynamics.lift_coefficient = CL
conditions.aerodynamics.drag_coefficient = CD
# pack results
results = Data()
results.lift_coefficient = CL
results.drag_coefficient = CD
N = q.shape[0]
L = np.zeros([N,3])
D = np.zeros([N,3])
L[:,2] = ( -CL * q * Sref )[:,0]
D[:,0] = ( -CD * q * Sref )[:,0]
#if L.any < 0.0:
#k = 1
results.lift_force_vector = L
results.drag_force_vector = D
return results
示例2: __call__
# 需要导入模块: from SUAVE.Structure import Data [as 别名]
# 或者: from SUAVE.Structure.Data import lift_coefficient [as 别名]
def __call__(self,conditions):
alpha = conditions.angle_of_attack
state = Data()
state.M = conditions.mach_number
state.rho = conditions.density
state.mew = conditions.viscosity
state.T = conditions.temperature
#state.q = conditions.dynamic_pressure
state.Sref = self.Sref
#N = state.M.shape[0]
##interpolation methods
#f_Cl = interp1d(self.aoa_range, self.Cl_a,bounds_error=False)
#Cl_inc=f_Cl(alpha)
##Cl_inc=self.f_Cl(alpha)
Cl_inc= self.CL0 + self.dCLdalpha*alpha
CL=Cl_inc/(numpy.sqrt(1-state.M**2))
#print 'alpha',alpha
#print 'Cl_inc',Cl_inc
#print 'CL',CL
#CD = self.CD0 + (CL**2)/(np.pi*self.AR*self.e) # parbolic drag
CD= self.drag(CL,state)
results = Data()
results.lift_coefficient = CL
results.drag_coefficient = CD
conditions.lift_coefficient = CL
conditions.drag_coefficient = CD
L = np.zeros([N,3])
D = np.zeros([N,3])
L[:,2] = ( -CL * state.q * state.Sref )[:,0]
D[:,0] = ( -CD * state.q * state.Sref )[:,0]
results.lift_force_vector = L
results.drag_force_vector = D
return [CL,CD]
示例3: Aerodynamics_1d_Surrogate
# 需要导入模块: from SUAVE.Structure import Data [as 别名]
# 或者: from SUAVE.Structure.Data import lift_coefficient [as 别名]
class Aerodynamics_1d_Surrogate(Aerodynamics):
""" SUAVE.Attributes.Aerodynamics.Aerodynamics_Surrogate
aerodynamic model that builds a surrogate model
this class is callable, see self.__call__
"""
def __defaults__(self):
self.tag = 'Aerodynamics'
self.geometry = Geometry()
self.configuration = Configuration()
self.conditions_table = Conditions(
angle_of_attack = np.linspace(-10., 10. , 5) * Units.deg ,
)
self.model = Data()
def initialize(self):
# build the conditions table
self.build_conditions_table()
# unpack
conditions_table = self.conditions_table
geometry = self.geometry
configuration = self.configuration
#
AoA = conditions_table.angle_of_attack
#Ma = conditions_table.mach_number
#Re = conditions_table.reynolds_number
# check
#assert len(AoA) == len(Ma) == len(Re) , 'condition length mismatch'
n_conditions = len(AoA)
# arrays
CL = np.zeros_like(AoA)
CD = np.zeros_like(AoA)
# condition input, local, do not keep
konditions = Conditions()
# calculate aerodynamics for table
for i in xrange(n_conditions):
# overriding conditions, thus the name mangling
konditions.angle_of_attack = AoA[i]
#konditions.mach_number = Ma[i]
#konditions.reynolds_number = Re[i]
# these functions are inherited from Aerodynamics() or overridden
CL[i] = self.calculate_lift(konditions, configuration, geometry)
CD[i] = self.calculate_drag(konditions, configuration, geometry)
# store table
conditions_table.lift_coefficient = CL
conditions_table.drag_coefficient = CD
# build surrogate
self.build_surrogate()
return
#: def initialize()
def build_conditions_table(self):
conditions_table = self.conditions_table
# unpack, check unique just in case
AoA_list = np.unique( conditions_table.angle_of_attack )
#Ma_list = np.unique( conditions_table.mach_number )
#Re_list = np.unique( conditions_table.reynolds_number )
# mesh grid, beware of dimensionality!
#AoA_list,Ma_list,Re_list = np.meshgrid(AoA_list,Ma_list,Re_list)
AoA_list = np.meshgrid(AoA_list)
# need 1D lists
AoA_list = np.reshape(AoA_list,-1)
#Ma_list = np.reshape(Ma_list,-1)
#Re_list = np.reshape(Re_list,-1)
# repack conditions table
conditions_table.angle_of_attack = AoA_list
#conditions_table.mach_number = Ma_list
#conditions_table.reynolds_number = Re_list
return
#: def build_conditions_table()
def build_surrogate(self):
# unpack data
#.........这里部分代码省略.........