本文整理汇总了Python中MDOTools.OC.operating_condition.OperatingCondition.set_Mach方法的典型用法代码示例。如果您正苦于以下问题:Python OperatingCondition.set_Mach方法的具体用法?Python OperatingCondition.set_Mach怎么用?Python OperatingCondition.set_Mach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MDOTools.OC.operating_condition.OperatingCondition
的用法示例。
在下文中一共展示了OperatingCondition.set_Mach方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init_wing_param
# 需要导入模块: from MDOTools.OC.operating_condition import OperatingCondition [as 别名]
# 或者: from MDOTools.OC.operating_condition.OperatingCondition import set_Mach [as 别名]
def __init_wing_param(self):
OC=OperatingCondition('cond1')
OC.set_Mach(0.7)
OC.set_AoA(3.0)
OC.set_altitude(5000.)
OC.set_T0_deg(20.)
OC.set_P0(101325.)
OC.set_humidity(0.)
OC.compute_atmosphere()
wing_param=Wing_param('test_param',geom_type='Broken',n_sect=20)
wing_param.build_wing()
wing_param.set_value('span',34.1)
wing_param.set_value('sweep',32.)
wing_param.set_value('break_percent',33.)
wing_param.set_value('root_chord',6.1)
wing_param.set_value('break_chord',4.6)
wing_param.set_value('tip_chord',1.5)
wing_param.set_value('root_height',1.28)
wing_param.set_value('break_height',0.97)
wing_param.set_value('tip_height',0.33)
wing_param.convert_to_design_variable('span',(10.,50.))
wing_param.convert_to_design_variable('sweep',(0.,40.))
wing_param.convert_to_design_variable('break_percent',(20.,40.))
wing_param.convert_to_design_variable('root_chord',(5.,7.))
wing_param.convert_to_design_variable('break_chord',(3.,5.))
wing_param.convert_to_design_variable('tip_chord',(1.,2.))
wing_param.convert_to_design_variable('root_height',(1.,1.5))
wing_param.convert_to_design_variable('break_height',(0.8,1.2))
wing_param.convert_to_design_variable('tip_height',(0.2,0.5))
wing_param.build_linear_airfoil(OC, AoA0=-2., Cm0=-0.1, set_as_ref=True)
wing_param.build_airfoils_from_ref()
wing_param.update()
return wing_param
示例2: __init_OC
# 需要导入模块: from MDOTools.OC.operating_condition import OperatingCondition [as 别名]
# 或者: from MDOTools.OC.operating_condition.OperatingCondition import set_Mach [as 别名]
def __init_OC(self):
OC=OperatingCondition('cond1')
OC.set_Mach(0.7)
OC.set_AoA(3.0)
OC.set_altitude(5000.)
OC.set_T0_deg(20.)
OC.set_P0(101325.)
OC.set_humidity(0.)
OC.compute_atmosphere()
return OC
示例3: __init_wing_param
# 需要导入模块: from MDOTools.OC.operating_condition import OperatingCondition [as 别名]
# 或者: from MDOTools.OC.operating_condition.OperatingCondition import set_Mach [as 别名]
def __init_wing_param(self):
OC=OperatingCondition('cond1')
OC.set_Mach(0.8)
OC.set_AoA(3.5)
OC.set_altitude(10000.)
OC.set_T0_deg(15.)
OC.set_P0(101325.)
OC.set_humidity(0.)
OC.compute_atmosphere()
wing_param=Wing_Broken('broken_wing',n_sect=20)
wing_param.import_BC_from_file('input_parameters.par')
wing_param.build_linear_airfoil(OC, AoA0=0.0, set_as_ref=True)
wing_param.build_airfoils_from_ref()
wing_param.update()
return OC,wing_param
示例4:
# 需要导入模块: from MDOTools.OC.operating_condition import OperatingCondition [as 别名]
# 或者: from MDOTools.OC.operating_condition.OperatingCondition import set_Mach [as 别名]
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# http://github.com/TBD
#
from DLLM.DLLMGeom.wing_param import Wing_param
from DLLM.DLLMKernel.DLLMTargetCl import DLLMTargetCl
from MDOTools.OC.operating_condition import OperatingCondition
from MDOTools.ValidGrad.FDValidGrad import FDValidGrad
import numpy
import sys
OC=OperatingCondition('cond1')
OC.set_Mach(0.3)
OC.set_AoA(0.)
OC.set_altitude(3000.)
OC.set_T0_deg(15.)
OC.set_P0(101325.)
OC.set_humidity(0.)
OC.compute_atmosphere()
wing_param=Wing_param('test_param',geom_type='Broken',n_sect=20)
wing_param.build_wing()
wing_param.set_value('span',40.)
wing_param.set_value('sweep',0.)
wing_param.set_value('break_percent',33.)
wing_param.set_value('root_chord',1.0)
wing_param.set_value('break_chord',1.0)
wing_param.set_value('tip_chord',1.0)
示例5:
# 需要导入模块: from MDOTools.OC.operating_condition import OperatingCondition [as 别名]
# 或者: from MDOTools.OC.operating_condition.OperatingCondition import set_Mach [as 别名]
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# http://github.com/TBD
#
from MDOTools.ValidGrad.FDValidGrad import FDValidGrad
from DLLM.DLLMGeom.wing_param import Wing_param
from DLLM.DLLMKernel.DLLMTargetCl import DLLMTargetCl
from MDOTools.OC.operating_condition import OperatingCondition
import numpy
import sys
OC=OperatingCondition('cond1')
OC.set_Mach(0.8)
OC.set_AoA(3.5)
OC.set_altitude(10000.)
OC.set_T0_deg(15.)
OC.set_P0(101325.)
OC.set_humidity(0.)
OC.compute_atmosphere()
wing_param=Wing_param('test_param',geom_type='Broken',n_sect=20)
wing_param.build_wing()
wing_param.set_value('span',34.1)
wing_param.set_value('sweep',34.)
wing_param.set_value('break_percent',33.)
wing_param.set_value('root_chord',6.1)
wing_param.set_value('break_chord',4.6)
wing_param.set_value('tip_chord',1.5)
示例6: set_polar_file
# 需要导入模块: from MDOTools.OC.operating_condition import OperatingCondition [as 别名]
# 或者: from MDOTools.OC.operating_condition.OperatingCondition import set_Mach [as 别名]
DLLM.run_post()
output = DLLM.get_F_list()
F_list_names = DLLM.get_F_list_names()
return output, F_list_names
def set_polar_file(OC, polar_name):
with open(polar_name, 'w') as f:
# Header is no up to date!!!
header = '# polar for Mach ='+str(OC.get_Mach())
f.write(header+'\n')
f.closed
def add_to_polar(polar_name, values, tags, i):
with open(polar_name, 'a') as f:
if i == 0:
line = "# "
line+=string.join(tags,'\t')
f.write(line+'\n')
line = ''
for param in values:
line = line+'%.10E ' % param
f.write(line+'\n')
f.closed
for M in Mach_list:
OC.set_Mach(M)
OC.compute_atmosphere()
RunPolar(wing_param,OC, AoA_list, 'WingSweep0')
示例7:
# 需要导入模块: from MDOTools.OC.operating_condition import OperatingCondition [as 别名]
# 或者: from MDOTools.OC.operating_condition.OperatingCondition import set_Mach [as 别名]
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# http://github.com/TBD
#
# Imports
from DLLM.DLLMGeom.wing_param import Wing_param
from DLLM.DLLMKernel.DLLMSolver import DLLMSolver
from MDOTools.OC.operating_condition import OperatingCondition
OC=OperatingCondition('cond1')
OC.set_Mach(0.4)
OC.set_AoA(3.5)
OC.set_altitude(5000.)
OC.set_T0_deg(15.)
OC.set_P0(101325.)
OC.set_humidity(0.)
OC.compute_atmosphere()
wing_param=Wing_param('test_param',geom_type='Broken',n_sect=20)
wing_param.build_wing()
wing_param.set_value('span',34.1) #34.1
wing_param.set_value('sweep',34.)
wing_param.set_value('break_percent',23.) #33.
wing_param.set_value('root_chord',5.4) #6.1
wing_param.set_value('break_chord',4.6)
wing_param.set_value('tip_chord',1.2) #1.5
示例8: DLLMOpenMDAOComponent
# 需要导入模块: from MDOTools.OC.operating_condition import OperatingCondition [as 别名]
# 或者: from MDOTools.OC.operating_condition.OperatingCondition import set_Mach [as 别名]
#.........这里部分代码省略.........
self.__wing_param.build_linear_airfoil(self.OC, AoA0=-2., Cm0=-0.1, set_as_ref=True)
self.__wing_param.build_airfoils_from_ref()
self.__wing_param.update()
if self.__display_wing_param:
self.__display_wing_param = False
print self.__wing_param
def __set_wing_param_values(self, wing_param_name='test_param'):
"""Method for wing parameters variables setting
@param wing_param_name : wing parametrization names
"""
self.__wing_param = Wing_param(wing_param_name,
geom_type='Broken', n_sect=self.N * 2)
self.__wing_param.build_wing()
for i in xrange(self.N):
self.__wing_param.set_value('rtwist%s' % i, 0.)
for param in Wing_param.DISCRETE_ATTRIBUTES_LIST:
self.__wing_param.set_value(param, getattr(self, param))
def __set_wing_param_bounds(self):
"""Method for desing variables bounds settings
Values are set to inf/-inf in DLLM component and their 'real' bounds
are defined when optimization problem is set
"""
for i in xrange(self.N):
self.__wing_param.convert_to_design_variable(
'rtwist%s' % i, (-float('inf'), float('inf')))
for param in Wing_param.DISCRETE_ATTRIBUTES_LIST:
self.__wing_param.convert_to_design_variable(param, (-float('inf'), float('inf')))
return
def __set_OC_values(self):
""" Set default operating conditions"""
self.OC.set_Mach(self.Mach)
self.OC.set_altitude(self.altitude)
self.OC.set_T0(self.T0)
self.OC.set_P0(self.P0)
self.OC.set_humidity(0.)
self.OC.compute_atmosphere()
def __update_wing_parame_values(self):
for dv_id in self.__wing_param.get_dv_id_list():
if dv_id.startswith('rtwist'):
i_twist = int(dv_id.replace('rtwist', ''))
self.__wing_param.set_value(dv_id, self.rtwist[i_twist])
else:
self.__wing_param.set_value(dv_id,getattr(self,dv_id))
self.__wing_param.build_linear_airfoil(self.OC, AoA0=-2., Cm0=-0.1, set_as_ref=True)
self.__set_wing_param_bounds()
self.__wing_param.build_airfoils_from_ref()
self.__wing_param.update()
return
def execute(self):
""" Perform a DLLM computation with the """
self.__update_wing_parame_values()
self.__set_OC_values()
self.__DLLM.set_target_Lift(self.Target_Lift)
self.__DLLM.run_direct()
self.__DLLM.run_post()
output = self.__DLLM.get_F_list()
for f, f_name in zip(output, self.__DLLM.get_F_list_names()):
setattr(self, f_name, f)
def list_deriv_vars(self):
"""specify the inputs and outputs where derivatives are defined
Specific treatment for twist : defined as rtwist0, rtwist1,... in DLLM
but as an array rtwist in openmdao component"""
out_dvid = []
for dv_id in self.__wing_param.get_dv_id_list():
if dv_id.startswith('rtwist0'):
out_dvid.append('rtwist')
elif not dv_id.startswith('rtwist'):
out_dvid.append(dv_id)
return tuple(out_dvid), tuple(self.__DLLM.get_F_list_names())
def provideJ(self):
"""Calculate the Jacobian according inputs and outputs"""
self.__DLLM.run_adjoint()
return np.array(self.__DLLM.get_dF_list_dchi())
def get_F_list(self):
return self.__DLLM.get_F_list()
def get_F_list_names(self):
return self.__DLLM.get_F_list_names()
def get_dv_array(self):
return self.__wing_param.get_dv_array()
def get_dv_id_list(self):
return self.__wing_param.get_dv_id_list()
def get_dv_info_list(self):
return self.__wing_param.get_dv_info_list()
def get_dv_value(self,dv_id):
return self.get_dv_array()[self.get_dv_id_list().index(dv_id)]
示例9:
# 需要导入模块: from MDOTools.OC.operating_condition import OperatingCondition [as 别名]
# 或者: from MDOTools.OC.operating_condition.OperatingCondition import set_Mach [as 别名]
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# http://github.com/TBD
#
from DLLM.DLLMGeom.wing_param import Wing_param
from DLLM.DLLMKernel.DLLMSolver import DLLMSolver
from MDOTools.ValidGrad.FDValidGrad import FDValidGrad
from MDOTools.OC.operating_condition import OperatingCondition
import numpy
OC=OperatingCondition('cond1')
OC.set_Mach(0.6) #.7
OC.set_AoA(6.0) #3.
OC.set_altitude(10000.) #5000
OC.set_T0_deg(20.)
OC.set_P0(101325.)
OC.set_humidity(0.)
OC.compute_atmosphere()
wing_param=Wing_param('test_param',geom_type='Broken',n_sect=20)
wing_param.build_wing()
wing_param.set_value('span',34.1)
wing_param.set_value('sweep',32.) #32.
wing_param.set_value('break_percent',33.)
wing_param.set_value('root_chord',5.4)#6.1
wing_param.set_value('break_chord',4.6)#4.6
wing_param.set_value('tip_chord',1.2)#1.5
示例10:
# 需要导入模块: from MDOTools.OC.operating_condition import OperatingCondition [as 别名]
# 或者: from MDOTools.OC.operating_condition.OperatingCondition import set_Mach [as 别名]
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# http://github.com/TBD
#
from MDOTools.ValidGrad.FDValidGrad import FDValidGrad
from DLLM.DLLMGeom.wing_param import Wing_param
from MDOTools.OC.operating_condition import OperatingCondition
OC=OperatingCondition('cond1')
OC.set_Mach(0.7)
OC.set_AoA(3.0)
OC.set_altitude(5000.)
OC.set_T0_deg(20.)
OC.set_P0(101325.)
OC.set_humidity(0.)
OC.compute_atmosphere()
wing_param=Wing_param('test_param',geom_type='Broken',n_sect=20)
wing_param.build_wing()
wing_param.set_value('span',34.1)
wing_param.set_value('sweep',32.)
wing_param.set_value('break_percent',33.)
wing_param.set_value('root_chord',6.1)
wing_param.set_value('break_chord',4.6)
wing_param.set_value('tip_chord',1.5)
示例11: RefCTAAirfoil
# 需要导入模块: from MDOTools.OC.operating_condition import OperatingCondition [as 别名]
# 或者: from MDOTools.OC.operating_condition.OperatingCondition import set_Mach [as 别名]
import numpy as np
from DLLM.polarManager.RefCTAAirfoil import RefCTAAirfoil
from MDOTools.OC.operating_condition import OperatingCondition
#Mach = 0.79
#Cl = 0.21
#Altitude 35000 ft
OC=OperatingCondition('Cond_RefCTA',atmospheric_model='ISA')
OC.set_Mach(0.79)
OC.set_AoA(3.5)
OC.set_altitude_feet(35000.)
OC.set_T0_deg(15.)
OC.set_P0(101325.)
OC.set_humidity(0.)
OC.compute_atmosphere()
print OC
RefCTA_AF = RefCTAAirfoil(OC)
RefCTA_AF.set_y_def_list([0.,1.520, 3.800, 6.080, 9.120, 12.160, 15.200, 18.240, 19.000])
RefCTA_AF.set_file_def_list(['section0.dat','section1.dat','section2.dat','section3.dat','section4.dat','section5.dat','section6.dat','section7.dat','section8.dat'])
RefCTA_AF.init_interpolators()
RefCTA_AF.set_y_pos(-5.1)
RefCTA_AF.init_interp_factors()
AoA = 2.*np.pi/180.
RefCTA_AF.compute(AoA, 0.79)