本文整理匯總了Python中DLLM.DLLMGeom.wing_param.Wing_param.get_dv_info_list方法的典型用法代碼示例。如果您正苦於以下問題:Python Wing_param.get_dv_info_list方法的具體用法?Python Wing_param.get_dv_info_list怎麽用?Python Wing_param.get_dv_info_list使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DLLM.DLLMGeom.wing_param.Wing_param
的用法示例。
在下文中一共展示了Wing_param.get_dv_info_list方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: DLLMOpenMDAOComponent
# 需要導入模塊: from DLLM.DLLMGeom.wing_param import Wing_param [as 別名]
# 或者: from DLLM.DLLMGeom.wing_param.Wing_param import get_dv_info_list [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)]