当前位置: 首页>>代码示例>>Python>>正文


Python OperatingCondition.config_from_dict方法代码示例

本文整理汇总了Python中MDOTools.OC.operating_condition.OperatingCondition.config_from_dict方法的典型用法代码示例。如果您正苦于以下问题:Python OperatingCondition.config_from_dict方法的具体用法?Python OperatingCondition.config_from_dict怎么用?Python OperatingCondition.config_from_dict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MDOTools.OC.operating_condition.OperatingCondition的用法示例。


在下文中一共展示了OperatingCondition.config_from_dict方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: DLLMWrapper

# 需要导入模块: from MDOTools.OC.operating_condition import OperatingCondition [as 别名]
# 或者: from MDOTools.OC.operating_condition.OperatingCondition import config_from_dict [as 别名]

#.........这里部分代码省略.........
        self.__DLLM_solver.run_post()
        self.__DLLM_solver.run_adjoint()
        F_list = self.__DLLM_solver.get_F_list()
        F_list_grad=self.__DLLM_solver.get_dF_list_dchi()
        self.__DLLM_solver.export_F_list()
        self.__DLLM_solver.export_dF_list_dchi()
        if self.__out_format == 'list':
            F_list=F_list.tolist()
        if self.__grad_format == 'numpy':
            F_list_grad=numpy.array(F_list_grad)
        self.__F_list = F_list
        self.__F_list_grad = F_list_grad
        return F_list,F_list_grad
    
    def export_results(self):
        fid=open(self.__tag+'.res.dat','w')
        res=[self.__F_list,self.__F_list_grad]
        cPickle.dump(res, fid)
        fid.close()
        
    def import_results(self):
        fid=open(self.__tag+'.res.dat','r')
        res=cPickle.load(fid)
        fid.close()
        self.__F_list=res[0]
        self.__F_list_grad=res[1]
        
    #-- Private methods
    def __config_OC(self):
        """
        Set up the 
        """
        self.__OC = OperatingCondition(self.__tag+'.OC')
        self.__OC.config_from_dict(self.__config_dict)
        
    def __config_param(self):
        """
        Set up the __wing_param attribute.
        -The class associated to __wing_param depends on the chosen parameterization type
        -The method needs to be updated if a new parameterization is implemented
        """
        input_keys=self.__config_dict.keys()
        
        geom_type_key=self.__tag+'.param.geom_type'
        if geom_type_key in input_keys:
            geom_type = self.__config_dict[geom_type_key]
        else:
            geom_type= 'Broken'
            
        n_sect_key=self.__tag+'.param.n_sect'
        if n_sect_key in input_keys:
            n_sect = self.__config_dict[n_sect_key]
        else:
            n_sect = 20
        
        if   geom_type == 'Broken':
            self.__wing_param = Wing_Broken(self.__tag+'.param', n_sect=n_sect)
        elif geom_type == 'Elliptic':
            self.__wing_param = Wing_Elliptic(self.__tag+'.param', n_sect=n_sect)
        elif geom_type == 'Straight':
            self.__wing_param = Wing_Straight(self.__tag+'.param', n_sect=n_sect)
            
        self.__wing_param.set_AoA_id(self.__AoA_id)
        self.__wing_param.set_common_OC(self.__OC)
        self.__wing_param.config_from_dict(self.__config_dict)
        
开发者ID:matthieu-meaux,项目名称:DLLM,代码行数:69,代码来源:DLLMWrapper.py

示例2: DLLMWrapper

# 需要导入模块: from MDOTools.OC.operating_condition import OperatingCondition [as 别名]
# 或者: from MDOTools.OC.operating_condition.OperatingCondition import config_from_dict [as 别名]

#.........这里部分代码省略.........
        return F_list_grad
    
    def analysis_and_grad(self):
        print self.__wing_param
        self.__DLLM_solver.run_direct()
        self.__DLLM_solver.run_post()
        self.__DLLM_solver.run_adjoint()
        F_list = self.__DLLM_solver.get_F_list()
        F_list_grad=self.__DLLM_solver.get_dF_list_dchi()
        if self.__out_format == 'list':
            F_list=F_list.tolist()
        if self.__grad_format == 'numpy':
            F_list_grad=numpy.array(F_list_grad)
        self.__F_list = F_list
        self.__F_list_grad = F_list_grad
        return F_list,F_list_grad
    
    def export_results(self):
        fid=open(self.__tag+'.res.dat','w')
        res=[self.__F_list,self.__F_list_grad]
        cPickle.dump(res, fid)
        fid.close()
        
    def import_results(self):
        fid=open(self.__tag+'.res.dat','r')
        res=cPickle.load(fid)
        fid.close()
        self.__F_list=res[0]
        self.__F_list_grad=res[1]
        
    #-- Private methods
    def __config_OC(self):
        self.__OC = OperatingCondition(self.__tag+'.OC')
        self.__OC.config_from_dict(self.__config_dict)
        
    def __config_param(self):
        input_keys=self.__config_dict.keys()
        
        geom_type_key=self.__tag+'.param.geom_type'
        if geom_type_key in input_keys:
            geom_type = self.__config_dict[geom_type_key]
        else:
            geom_type= 'Broken'
            
        n_sect_key=self.__tag+'.param.n_sect'
        if n_sect_key in input_keys:
            n_sect = self.__config_dict[n_sect_key]
        else:
            n_sect = 20
            
        self.__wing_param = Wing_param(self.__tag+'.param',geom_type=geom_type,n_sect=n_sect)
        self.__wing_param.set_AoA_id(self.__AoA_id)
        self.__wing_param.config_from_dict(self.__OC, self.__config_dict)
        
    def __config_DLLM(self):
        WARNING_MSG=self.WARNING_MSG+'__config_DLLM: '
        input_keys=self.__config_dict.keys()
        type_key = self.__tag+'.DLLM.type'
        type = self.__config_dict[type_key]
        
        if type not in self.POS_SOLVER:
            print WARNING_MSG+'solver_type = '+str(type)+' not in '+str(self.POS_SOLVER)+'. Set to default solver_type = Solver'
            type='Solver'
            
        if   type == 'Solver':
            self.__DLLM_solver = DLLMSolver(self.__tag,self.__wing_param,self.__OC)          
开发者ID:FrancoisGallard,项目名称:DLLM,代码行数:70,代码来源:DLLMWrapper.py


注:本文中的MDOTools.OC.operating_condition.OperatingCondition.config_from_dict方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。