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


Python TestCase.run_opt方法代码示例

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


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

示例1: main

# 需要导入模块: from TestCase import TestCase [as 别名]
# 或者: from TestCase.TestCase import run_opt [as 别名]

#.........这里部分代码省略.........
    pass_list = [test.run_test() for test in test_list]

    ######################################
    ### RUN SU2_GEO TESTS               ###
    ######################################

    # NACA0012
    naca0012_geo = TestCase("naca0012_geo")
    naca0012_geo.cfg_dir = "optimization_euler/steady_naca0012"
    naca0012_geo.cfg_file = "inv_NACA0012_adv.cfg"
    naca0012_geo.test_vals = [0.120011, 0.0816925, 0.0, 1.0]  # max thickness, area, twist, chord
    naca0012_geo.su2_exec = "SU2_GEO"
    naca0012_geo.timeout = 1600
    naca0012_geo.tol = 0.00001
    pass_list.append(naca0012_geo.run_geo())
    test_list.append(naca0012_geo)

    ######################################
    ### RUN SU2_DEF TESTS              ###
    ######################################

    # RAE2822
    rae2822_def = TestCase("rae2822_def")
    rae2822_def.cfg_dir = "optimization_rans/steady_rae2822"
    rae2822_def.cfg_file = "def_SA_RAE2822.cfg"
    rae2822_def.test_iter = 100
    rae2822_def.test_vals = [8.06616e-14]  # residual
    rae2822_def.su2_exec = "SU2_DEF"
    rae2822_def.timeout = 1600
    rae2822_def.tol = 1e-14

    pass_list.append(rae2822_def.run_def())
    test_list.append(rae2822_def)

    # Inviscid ONERAM6
    oneram6_sa_def = TestCase("oneram6_sa_def")
    oneram6_sa_def.cfg_dir = "optimization_euler/steady_oneram6"
    oneram6_sa_def.cfg_file = "def_ONERAM6.cfg"
    oneram6_sa_def.test_iter = 600
    oneram6_sa_def.test_vals = [3.46695e-13]  # residual
    oneram6_sa_def.su2_exec = "SU2_DEF"
    oneram6_sa_def.timeout = 1600
    oneram6_sa_def.tol = 1e-13

    pass_list.append(oneram6_sa_def.run_def())
    test_list.append(oneram6_sa_def)

    ######################################
    ### RUN PYTHON TESTS               ###
    ######################################

    # test continuous_adjoint.py
    contadj_euler_py = TestCase("contadj_euler_py")
    contadj_euler_py.cfg_dir = "cont_adj_euler/naca0012"
    contadj_euler_py.cfg_file = "inv_NACA0012.cfg"
    contadj_euler_py.test_iter = 10
    contadj_euler_py.su2_exec = "continuous_adjoint.py"
    contadj_euler_py.timeout = 1600
    contadj_euler_py.reference_file = "of_grad_cd.dat.ref"
    contadj_euler_py.test_file = "of_grad_cd.dat"
    pass_list.append(contadj_euler_py.run_filediff())
    test_list.append(contadj_euler_py)

    # test finite_difference.py
    findiff_euler_py = TestCase("findiff_euler_py")
    findiff_euler_py.cfg_dir = "cont_adj_euler/naca0012"
    findiff_euler_py.cfg_file = "inv_NACA0012_FD.cfg"
    findiff_euler_py.test_iter = 10
    findiff_euler_py.su2_exec = "finite_differences.py"
    findiff_euler_py.timeout = 1600
    findiff_euler_py.reference_file = "of_grad_findiff.dat.ref"
    findiff_euler_py.test_file = "FINDIFF/of_grad_findiff.dat"
    pass_list.append(findiff_euler_py.run_filediff())
    test_list.append(findiff_euler_py)

    # test shape_optimization.py
    shape_opt_euler_py = TestCase("shape_opt_euler_py")
    shape_opt_euler_py.cfg_dir = "optimization_euler/steady_naca0012"
    shape_opt_euler_py.cfg_file = "inv_NACA0012_adv.cfg"
    shape_opt_euler_py.test_iter = 1
    shape_opt_euler_py.test_vals = [1, 1, 2.134974e-05, 3.829535e-03]  # last 4 columns
    shape_opt_euler_py.su2_exec = "shape_optimization.py -f"
    shape_opt_euler_py.timeout = 1600
    shape_opt_euler_py.tol = 0.00001
    pass_list.append(shape_opt_euler_py.run_opt())
    test_list.append(shape_opt_euler_py)

    # Tests summary
    print "=================================================================="
    print "Summary of the serial tests"
    for i, test in enumerate(test_list):
        if pass_list[i]:
            print "  passed - %s" % test.tag
        else:
            print "* FAILED - %s" % test.tag

    if all(pass_list):
        sys.exit(0)
    else:
        sys.exit(1)
开发者ID:cspode,项目名称:SU2,代码行数:104,代码来源:serial_regression.py

示例2: main

# 需要导入模块: from TestCase import TestCase [as 别名]
# 或者: from TestCase.TestCase import run_opt [as 别名]

#.........这里部分代码省略.........
    # test continuous_adjoint.py
    contadj_euler_py = TestCase('contadj_euler_py')
    contadj_euler_py.cfg_dir = "cont_adj_euler/naca0012"
    contadj_euler_py.cfg_file  = "inv_NACA0012.cfg"
    contadj_euler_py.test_iter = 10
    contadj_euler_py.su2_exec  = "continuous_adjoint.py"
    contadj_euler_py.timeout   = 1600
    contadj_euler_py.reference_file = "of_grad_cd.dat.ref"
    contadj_euler_py.test_file = "of_grad_cd.dat"
    pass_list.append(contadj_euler_py.run_filediff())
    test_list.append(contadj_euler_py)

    # test finite_difference.py
    findiff_euler_py = TestCase('findiff_euler_py')
    findiff_euler_py.cfg_dir = "cont_adj_euler/naca0012"
    findiff_euler_py.cfg_file  = "inv_NACA0012_FD.cfg"
    findiff_euler_py.test_iter = 10
    findiff_euler_py.su2_exec  = "finite_differences.py"
    findiff_euler_py.timeout   = 1600
    findiff_euler_py.reference_file = "of_grad_findiff.dat.ref"
    findiff_euler_py.test_file = "FINDIFF/of_grad_findiff.dat"
    pass_list.append(findiff_euler_py.run_filediff())
    test_list.append(findiff_euler_py)
    
    # test shape_optimization.py
    shape_opt_euler_py           = TestCase('shape_opt_euler_py')
    shape_opt_euler_py.cfg_dir   = "optimization_euler/steady_naca0012"
    shape_opt_euler_py.cfg_file  = "inv_NACA0012_adv.cfg"
    shape_opt_euler_py.test_iter = 1
    shape_opt_euler_py.test_vals = [1, 1, 2.134974E-05, 3.829535E-03] #last 4 columns
    shape_opt_euler_py.su2_exec  = "shape_optimization.py -f"
    shape_opt_euler_py.timeout   = 1600
    shape_opt_euler_py.tol       = 0.00001
    pass_list.append(shape_opt_euler_py.run_opt())
    test_list.append(shape_opt_euler_py)

    # test continuous_adjoint.py, with multiple objectives
    #contadj_multi_py            = TestCase('contadj_multi_py')
    #contadj_multi_py.cfg_dir    = "cont_adj_euler/wedge"
    #contadj_multi_py.cfg_file   = "inv_wedge_ROE_multiobj.cfg"
    #contadj_multi_py.test_iter  = 10
    #contadj_multi_py.su2_exec   = "continuous_adjoint.py"
    #contadj_multi_py.timeout    = 1600
    #contadj_multi_py.reference_file = "of_grad_combo.dat.ref"
    #contadj_multi_py.test_file  = "of_grad_combo.dat"
    #pass_list.append(contadj_multi_py.run_filediff())
    #test_list.append(contadj_multi_py)


    ##########################
    ###   Python wrapper   ###
    ##########################
    
    # NACA0012 
    pywrapper_naca0012           = TestCase('pywrapper_naca0012')
    pywrapper_naca0012.cfg_dir   = "euler/naca0012"
    pywrapper_naca0012.cfg_file  = "inv_NACA0012_Roe.cfg"
    pywrapper_naca0012.test_iter = 100
    pywrapper_naca0012.test_vals = [-6.191618, -5.592802, 0.334809, 0.022197] #last 4 columns
    pywrapper_naca0012.su2_exec  = "SU2_CFD.py -f"
    pywrapper_naca0012.timeout   = 1600
    pywrapper_naca0012.tol       = 0.00001
    test_list.append(pywrapper_naca0012)
    pass_list.append(pywrapper_naca0012.run_test())

    # NACA0012 (SST, FUN3D results for finest grid: CL=1.0840, CD=0.01253)
开发者ID:EduardoMolina,项目名称:SU2,代码行数:70,代码来源:serial_regression.py


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