本文整理汇总了Python中SUAVE.Core.Data.lift方法的典型用法代码示例。如果您正苦于以下问题:Python Data.lift方法的具体用法?Python Data.lift怎么用?Python Data.lift使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SUAVE.Core.Data
的用法示例。
在下文中一共展示了Data.lift方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import lift [as 别名]
def main():
# initialize the vehicle
vehicle = vehicle_setup()
for wing in vehicle.wings:
wing.areas.wetted = 2.0 * wing.areas.reference
wing.areas.exposed = 0.8 * wing.areas.wetted
wing.areas.affected = 0.6 * wing.areas.wetted
# initalize the aero model
aerodynamics = SUAVE.Analyses.Aerodynamics.Fidelity_Zero()
aerodynamics.geometry = vehicle
aerodynamics.initialize()
#no of test points
test_num = 11
#specify the angle of attack
angle_of_attacks = np.linspace(-.174,.174,test_num)[:,None] #* Units.deg
# Cruise conditions (except Mach number)
state = SUAVE.Analyses.Mission.Segments.Conditions.State()
state.conditions = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics()
state.expand_rows(test_num)
# --------------------------------------------------------------------
# Initialize variables needed for CL and CD calculations
# Use a seeded random order for values
# --------------------------------------------------------------------
random.seed(1)
Mc = np.linspace(0.05,0.9,test_num)
random.shuffle(Mc)
rho = np.linspace(0.3,1.3,test_num)
random.shuffle(rho)
mu = np.linspace(5*10**-6,20*10**-6,test_num)
random.shuffle(mu)
T = np.linspace(200,300,test_num)
random.shuffle(T)
pressure = np.linspace(10**5,10**6,test_num)
# Changed after to preserve seed for initial testing
Mc = Mc[:,None]
rho = rho[:,None]
mu = mu[:,None]
T = T[:,None]
pressure = pressure[:,None]
air = Air()
a = air.compute_speed_of_sound(T,pressure)
re = rho*a*Mc/mu
state.conditions.freestream.mach_number = Mc
state.conditions.freestream.density = rho
state.conditions.freestream.dynamic_viscosity = mu
state.conditions.freestream.temperature = T
state.conditions.freestream.pressure = pressure
state.conditions.freestream.reynolds_number = re
state.conditions.aerodynamics.angle_of_attack = angle_of_attacks
# --------------------------------------------------------------------
# Surrogate
# --------------------------------------------------------------------
#call the aero model
results = aerodynamics.evaluate(state)
#build a polar for the markup aero
polar = Data()
CL = results.lift.total
CD = results.drag.total
polar.lift = CL
polar.drag = CD
# --------------------------------------------------------------------
# Test compute Lift
# --------------------------------------------------------------------
#compute_aircraft_lift(conditions, configuration, geometry)
lift = state.conditions.aerodynamics.lift_coefficient
lift_r = np.array( [-2.17277359, -0.77516232, -0.41769607, -0.16530511, 0.19456498, 0.49425496, \
0.67481247, 0.93041268, 1.41531217, 2.1033578, 1.71822138])[:,None]
print 'lift = ', lift
#.........这里部分代码省略.........
示例2: main
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import lift [as 别名]
def main():
vehicle = vehicle_setup() # Create the vehicle for testing
for wing in vehicle.wings:
wing.areas.wetted = 2.0 * wing.areas.reference
wing.areas.exposed = 0.8 * wing.areas.wetted
wing.areas.affected = 0.6 * wing.areas.wetted
aerodynamics = SUAVE.Analyses.Aerodynamics.Supersonic_Zero()
aerodynamics.geometry = vehicle
aerodynamics.settings.drag_coefficient_increment = 0.0000
vehicle.aerodynamics_model = aerodynamics
vehicle.aerodynamics_model.initialize()
test_num = 11 # Length of arrays used in this test
# --------------------------------------------------------------------
# Test Lift Surrogate
# --------------------------------------------------------------------
AoA = np.linspace(-.174,.174,test_num)[:,None] # +- 10 degrees
# Cruise conditions (except Mach number)
state = SUAVE.Analyses.Mission.Segments.Conditions.State()
state.conditions = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics()
state.expand_rows(test_num)
# --------------------------------------------------------------------
# Initialize variables needed for CL and CD calculations
# Use a seeded random order for values
# --------------------------------------------------------------------
random.seed(1)
Mc = np.linspace(0.05,0.9,test_num)
random.shuffle(Mc)
AoA = AoA.reshape(test_num,1)
Mc = Mc.reshape(test_num,1)
rho = np.linspace(0.3,1.3,test_num)
random.shuffle(rho)
rho = rho.reshape(test_num,1)
mu = np.linspace(5*10**-6,20*10**-6,test_num)
random.shuffle(mu)
mu = mu.reshape(test_num,1)
T = np.linspace(200,300,test_num)
random.shuffle(T)
T = T.reshape(test_num,1)
pressure = np.linspace(10**5,10**6,test_num)
pressure = pressure.reshape(test_num,1)
state.conditions.freestream.mach_number = Mc
state.conditions.freestream.density = rho
state.conditions.freestream.dynamic_viscosity = mu
state.conditions.freestream.temperature = T
state.conditions.freestream.pressure = pressure
state.conditions.aerodynamics.angle_of_attack = AoA
# --------------------------------------------------------------------
# Surrogate
# --------------------------------------------------------------------
#call the aero model
results = aerodynamics.evaluate(state)
#build a polar for the markup aero
polar = Data()
CL = results.lift.total
CD = results.drag.total
polar.lift = CL
polar.drag = CD
# --------------------------------------------------------------------
# Test compute Lift
# --------------------------------------------------------------------
#compute_aircraft_lift(conditions, configuration, geometry)
lift = state.conditions.aerodynamics.lift_coefficient
# Truth value
lift_r = np.array([-2.42489437, -0.90696416, -0.53991953, -0.3044834 , -0.03710598,
0.31061936 , 0.52106899, 0.77407765, 1.22389024, 1.86240501,
1.54587835])[:,None]
lift_r = lift_r.reshape(test_num,1)
lift_test = np.abs((lift-lift_r)/lift)
print '\nCompute Lift Test Results\n'
print lift_test
assert(np.max(lift_test)<1e-4), 'Supersonic Aero regression failed at compute lift test'
#.........这里部分代码省略.........
示例3: Data
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import lift [as 别名]
#specify the conditions at which to perform the aerodynamic analysis
state.conditions.aerodynamics.angle_of_attack[:,0] = angle_of_attacks
state.conditions.freestream.mach_number = np.array([0.8]*test_num)
state.conditions.freestream.density = np.array([0.3804534]*test_num)
state.conditions.freestream.dynamic_viscosity = np.array([1.43408227e-05]*test_num)
state.conditions.freestream.temperature = np.array([218.92391647]*test_num)
state.conditions.freestream.pressure = np.array([23908.73408391]*test_num)
#call the aero model
results = aerodynamics.evaluate(state)
#build a polar for the markup aero
polar = Data()
CL = results.lift.total
CD = results.drag.total
polar.lift = CL
polar.drag = CD
#load old results
old_polar = SUAVE.Input_Output.load('polar_M8.pkl') #('polar_old2.pkl')
CL_old = old_polar.lift
CD_old = old_polar.drag
#plot the results
plt.figure("Drag Polar")
axes = plt.gca()
axes.plot(CD,CL,'bo-',CD_old,CL_old,'*')
axes.set_xlabel('$C_D$')
axes.set_ylabel('$C_L$')
示例4: main
# 需要导入模块: from SUAVE.Core import Data [as 别名]
# 或者: from SUAVE.Core.Data import lift [as 别名]
def main():
# --------------------------------------------------------------------
# Drag Polar
# --------------------------------------------------------------------
# initialize the vehicle
vehicle = vehicle_setup()
for wing in vehicle.wings:
wing.areas.wetted = 2.0 * wing.areas.reference
wing.areas.exposed = 0.8 * wing.areas.wetted
wing.areas.affected = 0.6 * wing.areas.wetted
# initalize the aero model
aerodynamics = SUAVE.Analyses.Aerodynamics.Fidelity_Zero()
aerodynamics.geometry = vehicle
## modify inviscid wings - linear model
#inviscid_wings = SUAVE.Analyses.Aerodynamics.Linear_Lift()
#inviscid_wings.settings.slope_correction_coefficient = 1.04
#inviscid_wings.settings.zero_lift_coefficient = 2.*np.pi* 3.1 * Units.deg
#aerodynamics.process.compute.lift.inviscid_wings = inviscid_wings
# modify inviscid wings - avl model
inviscid_wings = SUAVE.Analyses.Aerodynamics.Surrogates.AVL()
inviscid_wings.geometry = vehicle
aerodynamics.process.compute.lift.inviscid_wings = inviscid_wings
aerodynamics.initialize()
#no of test points
test_num = 11
#specify the angle of attack
angle_of_attacks = np.linspace(-.174,.174,test_num) #* Units.deg
# Cruise conditions (except Mach number)
state = SUAVE.Analyses.Mission.Segments.Conditions.State()
state.conditions = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics()
state.expand_rows(test_num)
#specify the conditions at which to perform the aerodynamic analysis
state.conditions.aerodynamics.angle_of_attack[:,0] = angle_of_attacks
state.conditions.freestream.mach_number = np.array([0.8]*test_num)
state.conditions.freestream.density = np.array([0.3804534]*test_num)
state.conditions.freestream.dynamic_viscosity = np.array([1.43408227e-05]*test_num)
state.conditions.freestream.temperature = np.array([218.92391647]*test_num)
state.conditions.freestream.pressure = np.array([23908.73408391]*test_num)
#call the aero model
results = aerodynamics.evaluate(state)
#build a polar for the markup aero
polar = Data()
CL = results.lift.total
CD = results.drag.total
polar.lift = CL
polar.drag = CD
#load old results
old_polar = SUAVE.Input_Output.load('polar_M8.pkl') #('polar_old2.pkl')
CL_old = old_polar.lift
CD_old = old_polar.drag
#plot the results
plt.figure("Drag Polar")
axes = plt.gca()
axes.plot(CD,CL,'bo-',CD_old,CL_old,'*')
axes.set_xlabel('$C_D$')
axes.set_ylabel('$C_L$')
plt.show(block=True) # here so as to not block the regression test