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


Python TestCase.run_filediff方法代码示例

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


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

示例1: main

# 需要导入模块: from TestCase import TestCase [as 别名]
# 或者: from TestCase.TestCase import run_filediff [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_filediff [as 别名]
def main():
    '''This program runs SU2 and ensures that the output matches specified values. 
       This will be used to do checks when code is pushed to github 
       to make sure nothing is broken. '''

    test_list = []

    #####################################
    ### Disc. adj. compressible Euler ###
    #####################################

    # Inviscid NACA0012
    discadj_naca0012           = TestCase('discadj_naca0012')
    discadj_naca0012.cfg_dir   = "cont_adj_euler/naca0012"
    discadj_naca0012.cfg_file  = "inv_NACA0012_discadj.cfg"
    discadj_naca0012.test_iter = 100
    discadj_naca0012.test_vals = [-3.606839,-9.035212,-3.3386e-07,1.8777e-01] #last 4 columns
    discadj_naca0012.su2_exec  = "SU2_CFD_AD"
    discadj_naca0012.timeout   = 1600
    discadj_naca0012.tol       = 0.00001
    test_list.append(discadj_naca0012)

    #######################################################
    ### Disc. adj. compressible RANS                    ###
    #######################################################
    
    # Adjoint turbulent NACA0012 SA
    discadj_rans_naca0012_sa           = TestCase('discadj_rans_naca0012_sa')
    discadj_rans_naca0012_sa.cfg_dir   = "disc_adj_rans/naca0012"
    discadj_rans_naca0012_sa.cfg_file  = "turb_NACA0012_sa.cfg"
    discadj_rans_naca0012_sa.test_iter = 10
    discadj_rans_naca0012_sa.test_vals = [-1.751947, 0.485758, 0.181440, -0.385110] #last 4 columns
    discadj_rans_naca0012_sa.su2_exec  = "SU2_CFD_AD"
    discadj_rans_naca0012_sa.timeout   = 1600
    discadj_rans_naca0012_sa.tol       = 0.00001
    test_list.append(discadj_rans_naca0012_sa)

    # Adjoint turbulent NACA0012 SST
    discadj_rans_naca0012_sst           = TestCase('discadj_rans_naca0012_sst')
    discadj_rans_naca0012_sst.cfg_dir   = "disc_adj_rans/naca0012"
    discadj_rans_naca0012_sst.cfg_file  = "turb_NACA0012_sst.cfg"
    discadj_rans_naca0012_sst.test_iter = 10
    discadj_rans_naca0012_sst.test_vals = [-1.658566, -0.487694, 0.087556, -0.537010] #last 4 columns
    discadj_rans_naca0012_sst.su2_exec  = "SU2_CFD_AD"
    discadj_rans_naca0012_sst.timeout   = 1600
    discadj_rans_naca0012_sst.tol       = 0.00001
    test_list.append(discadj_rans_naca0012_sst)

    #######################################################
    ### Unsteady Disc. adj. compressible RANS           ###
    #######################################################
   
    # Turbulent Cylinder
    discadj_cylinder           = TestCase('unsteady_cylinder')
    discadj_cylinder.cfg_dir   = "disc_adj_rans/cylinder"
    discadj_cylinder.cfg_file  = "cylinder.cfg" 
    discadj_cylinder.test_iter = 10
    discadj_cylinder.test_vals = [3.522068,-1.787841,-1.2030e-02,1.1156e-03] #last 4 columns
    discadj_cylinder.su2_exec  = "SU2_CFD_AD"
    discadj_cylinder.timeout   = 1600
    discadj_cylinder.tol       = 0.00001
    discadj_cylinder.unsteady  = True
    test_list.append(discadj_cylinder)

    ######################################
    ### RUN TESTS                      ###
    ######################################  

    pass_list = [ test.run_test() for test in test_list ]
    
    ######################################
    ### RUN PYTHON TESTS               ###
    ######################################
    
    # test discrete_adjoint.py
    discadj_euler_py = TestCase('discadj_euler_py')
    discadj_euler_py.cfg_dir = "cont_adj_euler/naca0012"
    discadj_euler_py.cfg_file  = "inv_NACA0012.cfg"
    discadj_euler_py.test_iter = 10
    discadj_euler_py.su2_exec  = "discrete_adjoint.py"
    discadj_euler_py.timeout   = 1600
    discadj_euler_py.reference_file = "of_grad_cd_disc.dat.ref"
    discadj_euler_py.test_file = "of_grad_cd.dat"
    pass_list.append(discadj_euler_py.run_filediff())
    test_list.append(discadj_euler_py)
    
    # test direct_differentiation.py
    directdiff_euler_py = TestCase('directdiff_euler_py')
    directdiff_euler_py.cfg_dir = "cont_adj_euler/naca0012"
    directdiff_euler_py.cfg_file  = "inv_NACA0012_FD.cfg"
    directdiff_euler_py.test_iter = 10
    directdiff_euler_py.su2_exec  = "direct_differentiation.py"
    directdiff_euler_py.timeout   = 1600
    directdiff_euler_py.reference_file = "of_grad_directdiff.dat.ref"
    directdiff_euler_py.test_file = "DIRECTDIFF/of_grad_directdiff.dat"
    pass_list.append(directdiff_euler_py.run_filediff())
    test_list.append(directdiff_euler_py)

    # Tests summary
    print '=================================================================='
#.........这里部分代码省略.........
开发者ID:HolyGeneralK,项目名称:SU2,代码行数:103,代码来源:serial_regression_AD.py

示例3: main

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

#.........这里部分代码省略.........
    discadj_cylinder.cfg_dir   = "disc_adj_rans/cylinder"
    discadj_cylinder.cfg_file  = "cylinder.cfg" 
    discadj_cylinder.test_iter = 9
    discadj_cylinder.test_vals = [3.746904, -1.544886, -0.008345, 0.000014] #last 4 columns
    discadj_cylinder.su2_exec  = "SU2_CFD_AD"
    discadj_cylinder.timeout   = 1600
    discadj_cylinder.tol       = 0.00001
    discadj_cylinder.unsteady  = True
    test_list.append(discadj_cylinder)
    
    ###################################
    ### Structural Adjoint          ###
    ###################################
   
    # Structural model
    discadj_fea           = TestCase('discadj_fea')
    discadj_fea.cfg_dir   = "disc_adj_fea"
    discadj_fea.cfg_file  = "configAD_fem.cfg" 
    discadj_fea.test_iter = 9
    discadj_fea.test_vals = [-6.403771, -6.404196, -3.6413e-04, -8.7087e+00] #last 4 columns
    discadj_fea.su2_exec  = "SU2_CFD_AD"
    discadj_fea.timeout   = 1600
    discadj_fea.tol       = 0.00001
    test_list.append(discadj_fea)    
    
    ###################################
    ### Coupled FSI Adjoint         ###
    ###################################
   
    # Structural model
    discadj_fsi           = TestCase('discadj_fsi')
    discadj_fsi.cfg_dir   = "disc_adj_fsi"
    discadj_fsi.cfg_file  = "configAD_fsi.cfg" 
    discadj_fsi.test_iter = 3000
    discadj_fsi.test_vals = [0.958848,-0.157183,0.658415,1.302076] #last 4 columns
    discadj_fsi.su2_exec  = "SU2_CFD_AD"
    discadj_fsi.timeout   = 1600
    discadj_fsi.tol       = 0.00001
    test_list.append(discadj_fsi)      

    ######################################
    ### RUN TESTS                      ###
    ######################################  

    pass_list = [ test.run_test() for test in test_list ]
    
    ######################################
    ### RUN PYTHON TESTS               ###
    ######################################
    
    # test discrete_adjoint.py
    discadj_euler_py = TestCase('discadj_euler_py')
    discadj_euler_py.cfg_dir = "cont_adj_euler/naca0012"
    discadj_euler_py.cfg_file  = "inv_NACA0012.cfg"
    discadj_euler_py.test_iter = 10
    discadj_euler_py.su2_exec  = "discrete_adjoint.py"
    discadj_euler_py.timeout   = 1600
    discadj_euler_py.reference_file = "of_grad_cd_disc.dat.ref"
    discadj_euler_py.test_file = "of_grad_cd.dat"
    pass_list.append(discadj_euler_py.run_filediff())
    test_list.append(discadj_euler_py)
    
    # test direct_differentiation.py
    directdiff_euler_py = TestCase('directdiff_euler_py')
    directdiff_euler_py.cfg_dir = "cont_adj_euler/naca0012"
    directdiff_euler_py.cfg_file  = "inv_NACA0012_FD.cfg"
    directdiff_euler_py.test_iter = 10
    directdiff_euler_py.su2_exec  = "direct_differentiation.py"
    directdiff_euler_py.timeout   = 1600
    directdiff_euler_py.reference_file = "of_grad_directdiff.dat.ref"
    directdiff_euler_py.test_file = "DIRECTDIFF/of_grad_directdiff.dat"
    pass_list.append(directdiff_euler_py.run_filediff())
    test_list.append(directdiff_euler_py)

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

    # Tests summary
    print('==================================================================')
    print('Summary of the serial tests')
    print('python version:', sys.version)
    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:drewkett,项目名称:SU2,代码行数:104,代码来源:serial_regression_AD.py

示例4: main

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

#.........这里部分代码省略.........
    brick_tets_def.timeout = 1600
    brick_tets_def.tol = 1e-15

    pass_list.append(brick_tets_def.run_def())
    test_list.append(brick_tets_def)

    # Brick of isotropic hexas (inverse volume)
    brick_hex_def = TestCase("brick_hex_def")
    brick_hex_def.cfg_dir = "deformation/brick_hex"
    brick_hex_def.cfg_file = "def_brick_hex.cfg"
    brick_hex_def.test_iter = 1000
    brick_hex_def.test_vals = [1.46423e-15]  # residual
    brick_hex_def.su2_exec = "mpirun -n 2 SU2_DEF"
    brick_hex_def.timeout = 1600
    brick_hex_def.tol = 1e-15

    pass_list.append(brick_hex_def.run_def())
    test_list.append(brick_hex_def)

    # Brick with a pyramid layer (inverse volume)
    brick_pyra_def = TestCase("brick_pyra_def")
    brick_pyra_def.cfg_dir = "deformation/brick_pyra"
    brick_pyra_def.cfg_file = "def_brick_pyra.cfg"
    brick_pyra_def.test_iter = 100
    brick_pyra_def.test_vals = [5.97202e-15]  # residual
    brick_pyra_def.su2_exec = "mpirun -n 2 SU2_DEF"
    brick_pyra_def.timeout = 1600
    brick_pyra_def.tol = 1e-15

    pass_list.append(brick_pyra_def.run_def())
    test_list.append(brick_pyra_def)

    # Brick of isotropic prisms (inverse volume)
    brick_prism_def = TestCase("brick_prism_def")
    brick_prism_def.cfg_dir = "deformation/brick_prism"
    brick_prism_def.cfg_file = "def_brick_prism.cfg"
    brick_prism_def.test_iter = 100
    brick_prism_def.test_vals = [2.80867e-14]  # residual
    brick_prism_def.su2_exec = "mpirun -n 2 SU2_DEF"
    brick_prism_def.timeout = 1600
    brick_prism_def.tol = 1e-15

    pass_list.append(brick_prism_def.run_def())
    test_list.append(brick_prism_def)

    # Brick of prisms with high aspect ratio cells near the wall (wall distance)
    brick_prism_rans_def = TestCase("brick_prism_rans_def")
    brick_prism_rans_def.cfg_dir = "deformation/brick_prism_rans"
    brick_prism_rans_def.cfg_file = "def_brick_prism_rans.cfg"
    brick_prism_rans_def.test_iter = 50
    brick_prism_rans_def.test_vals = [3.5265e-15]  # residual
    brick_prism_rans_def.su2_exec = "mpirun -n 2 SU2_DEF"
    brick_prism_rans_def.timeout = 1600
    brick_prism_rans_def.tol = 1e-15

    pass_list.append(brick_prism_rans_def.run_def())
    test_list.append(brick_prism_rans_def)

    # Brick of hexas with high aspect ratio cells near the wall (inverse volume)
    brick_hex_rans_def = TestCase("brick_hex_rans_def")
    brick_hex_rans_def.cfg_dir = "deformation/brick_hex_rans"
    brick_hex_rans_def.cfg_file = "def_brick_hex_rans.cfg"
    brick_hex_rans_def.test_iter = 600
    brick_hex_rans_def.test_vals = [2.75292e-14]  # residual
    brick_hex_rans_def.su2_exec = "mpirun -n 2 SU2_DEF"
    brick_hex_rans_def.timeout = 1600
    brick_hex_rans_def.tol = 1e-16

    pass_list.append(brick_hex_rans_def.run_def())
    test_list.append(brick_hex_rans_def)

    ######################################
    ### RUN EXTERNAL FSI COUPLING TEST ###
    ######################################

    # Pitch-plunge NACA 0012 (external FSI coupling)
    coupled_FSI = TestCase("coupled_FSI")
    coupled_FSI.cfg_dir = "coupled_fsi/2d_aeroelasticity"
    coupled_FSI.cfg_file = "FSICoupler_config.cfg"
    coupled_FSI.test_iter = 1
    coupled_FSI.su2_exec = "mpirun -np 2 fsi_computation.py"
    coupled_FSI.timeout = 1600
    coupled_FSI.reference_file = "StructHistory.dat.ref_parallel"
    coupled_FSI.test_file = "StructHistory.dat"
    pass_list.append(coupled_FSI.run_filediff())
    test_list.append(coupled_FSI)

    # Tests summary
    print "=================================================================="
    print "Summary of the parallel 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:su2code,项目名称:SU2,代码行数:104,代码来源:parallel_regression.py

示例5: main

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

#.........这里部分代码省略.........
    sphere_ffd_def.su2_exec  = "SU2_DEF"
    sphere_ffd_def.timeout   = 1600
    sphere_ffd_def.tol       = 1e-16

    pass_list.append(sphere_ffd_def.run_def())
    test_list.append(sphere_ffd_def)
    
    # Spherical FFD test using BSplines
    sphere_ffd_def_bspline           = TestCase('sphere_ffd_def_bspline')
    sphere_ffd_def_bspline.cfg_dir   = "deformation/spherical_ffd"
    sphere_ffd_def_bspline.cfg_file  = "def_spherical_bspline.cfg"
    sphere_ffd_def_bspline.test_iter = 50
    sphere_ffd_def_bspline.test_vals = [6.69927e-11] #residual
    sphere_ffd_def_bspline.su2_exec  = "SU2_DEF"
    sphere_ffd_def_bspline.timeout   = 1600
    sphere_ffd_def_bspline.tol       = 1e-16

    pass_list.append(sphere_ffd_def_bspline.run_def())
    test_list.append(sphere_ffd_def_bspline)
   
    ######################################
    ### 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)

    # 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"
开发者ID:EduardoMolina,项目名称:SU2,代码行数:70,代码来源:serial_regression.py

示例6: main

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

#.........这里部分代码省略.........

    ###################################
    ### Coupled FSI Adjoint         ###
    ###################################
   
    # Structural model
    discadj_fsi           = TestCase('discadj_fsi')
    discadj_fsi.cfg_dir   = "disc_adj_fsi"
    discadj_fsi.cfg_file  = "configAD_fsi.cfg" 
    discadj_fsi.test_iter = 3000
    discadj_fsi.test_vals = [0.958848,-0.157183,0.658415,1.302076] #last 4 columns
    discadj_fsi.su2_exec  = "SU2_CFD_AD"
    discadj_fsi.timeout   = 1600
    discadj_fsi.tol       = 0.00001
    test_list.append(discadj_fsi)      

    ######################################
    ### RUN TESTS                      ###
    ######################################  

    pass_list = [ test.run_test() for test in test_list ]
    
    ######################################
    ### RUN PYTHON TESTS               ###
    ######################################
    
    # test discrete_adjoint.py
    discadj_euler_py = TestCase('discadj_euler_py')
    discadj_euler_py.cfg_dir = "cont_adj_euler/naca0012"
    discadj_euler_py.cfg_file  = "inv_NACA0012.cfg"
    discadj_euler_py.test_iter = 10
    discadj_euler_py.su2_exec  = "discrete_adjoint.py"
    discadj_euler_py.timeout   = 1600
    discadj_euler_py.reference_file = "of_grad_cd_disc.dat.ref"
    discadj_euler_py.test_file = "of_grad_cd.dat"
    pass_list.append(discadj_euler_py.run_filediff())
    test_list.append(discadj_euler_py)
    
    # test discrete_adjoint with multiple ffd boxes
    discadj_multiple_ffd_py = TestCase('discadj_multiple_ffd_py')
    discadj_multiple_ffd_py.cfg_dir = "multiple_ffd/naca0012"
    discadj_multiple_ffd_py.cfg_file  = "inv_NACA0012_ffd.cfg"
    discadj_multiple_ffd_py.test_iter = 9
    discadj_multiple_ffd_py.su2_exec  = "discrete_adjoint.py"
    discadj_multiple_ffd_py.timeout   = 1600
    discadj_multiple_ffd_py.reference_file = "of_grad_cd.dat.ref"
    discadj_multiple_ffd_py.test_file = "of_grad_cd.dat"
    pass_list.append(discadj_multiple_ffd_py.run_filediff())
    test_list.append(discadj_multiple_ffd_py)

    # test direct_differentiation.py
    directdiff_euler_py = TestCase('directdiff_euler_py')
    directdiff_euler_py.cfg_dir = "cont_adj_euler/naca0012"
    directdiff_euler_py.cfg_file  = "inv_NACA0012_FD.cfg"
    directdiff_euler_py.test_iter = 10
    directdiff_euler_py.su2_exec  = "direct_differentiation.py"
    directdiff_euler_py.timeout   = 1600
    directdiff_euler_py.reference_file = "of_grad_directdiff.dat.ref"
    directdiff_euler_py.test_file = "DIRECTDIFF/of_grad_directdiff.dat"
    pass_list.append(directdiff_euler_py.run_filediff())
    test_list.append(directdiff_euler_py)

    # test direct_differentiation.py with multiple ffd boxes
    directdiff_multiple_ffd_py = TestCase('directdiff_multiple_ffd_py')
    directdiff_multiple_ffd_py.cfg_dir = "multiple_ffd/naca0012"
    directdiff_multiple_ffd_py.cfg_file  = "inv_NACA0012_ffd.cfg"
    directdiff_multiple_ffd_py.test_iter = 9
    directdiff_multiple_ffd_py.su2_exec  = "direct_differentiation.py"
    directdiff_multiple_ffd_py.timeout   = 1600
    directdiff_multiple_ffd_py.reference_file = "of_grad_directdiff.dat.ref"
    directdiff_multiple_ffd_py.test_file = "DIRECTDIFF/of_grad_directdiff.dat"
    pass_list.append(directdiff_multiple_ffd_py.run_filediff())
    test_list.append(directdiff_multiple_ffd_py)

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

    # Tests summary
    print('==================================================================')
    print('Summary of the serial tests')
    print('python version:', sys.version)
    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:su2code,项目名称:SU2,代码行数:104,代码来源:serial_regression_AD.py

示例7: main

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

#.........这里部分代码省略.........
    discadj_trans_stator.timeout   = 1600
    discadj_trans_stator.tol       = 0.00001
    test_list.append(discadj_trans_stator)
    
    ###################################
    ### Structural Adjoint          ###
    ###################################
   
    # Structural model
    discadj_fea           = TestCase('discadj_fea')
    discadj_fea.cfg_dir   = "disc_adj_fea"
    discadj_fea.cfg_file  = "configAD_fem.cfg" 
    discadj_fea.test_iter = 9
    discadj_fea.test_vals = [-4.751576, -4.692029, -0.000364, -8.708700] #last 4 columns
    discadj_fea.su2_exec  = "parallel_computation.py -f"
    discadj_fea.timeout   = 1600
    discadj_fea.tol       = 0.00001
    test_list.append(discadj_fea) 

    ###################################
    ### Disc. adj. heat             ###
    ###################################

    # Discrete adjoint for heated cylinder
    discadj_heat           = TestCase('discadj_heat')
    discadj_heat.cfg_dir   = "disc_adj_heat"
    discadj_heat.cfg_file  = "disc_adj_heat.cfg"
    discadj_heat.test_iter = 10
    discadj_heat.test_vals = [3.162960, 0.923834, -223.148728, -3562.233908] #last 4 columns
    discadj_heat.su2_exec  = "parallel_computation.py -f"
    discadj_heat.timeout   = 1600
    discadj_heat.tol       = 0.00001
    test_list.append(discadj_heat)

    ###################################
    ### Coupled FSI Adjoint         ###
    ###################################
   
    # Structural model
    discadj_fsi           = TestCase('discadj_fsi')
    discadj_fsi.cfg_dir   = "disc_adj_fsi"
    discadj_fsi.cfg_file  = "configAD_fsi.cfg" 
    discadj_fsi.test_iter = 3000
    discadj_fsi.test_vals = [0.958848,-0.157183,0.658415,1.302076] #last 4 columns
    discadj_fsi.su2_exec  = "parallel_computation.py -f"
    discadj_fsi.timeout   = 1600
    discadj_fsi.tol       = 0.00001
    test_list.append(discadj_fsi)

    ######################################
    ### RUN TESTS                      ###
    ######################################

    pass_list = [ test.run_test() for test in test_list ]

    ##################################################
    ### Structural Adjoint - Topology Optimization ###
    ##################################################

    # test discrete_adjoint.py
    discadj_topol_optim = TestCase('discadj_topol_optim')
    discadj_topol_optim.cfg_dir = "fea_topology"
    discadj_topol_optim.cfg_file  = "config.cfg"
    discadj_topol_optim.test_iter = 0
    discadj_topol_optim.su2_exec  = "parallel_computation.py"
    discadj_topol_optim.timeout   = 1600
    discadj_topol_optim.reference_file = "grad_ref_node.dat.ref"
    discadj_topol_optim.test_file = "grad_ref_node.dat"
    pass_list.append(discadj_topol_optim.run_filediff())
    test_list.append(discadj_topol_optim)

    ###################################
    ### Coupled FSI Adjoint         ###
    ###################################

    discadj_fsi2           = TestCase('discadj_fsi_airfoil')
    discadj_fsi2.cfg_dir   = "disc_adj_fsi/Airfoil_2d"
    discadj_fsi2.cfg_file  = "config.cfg"
    discadj_fsi2.test_iter = 0
    discadj_fsi2.su2_exec  = "parallel_computation.py"
    discadj_fsi2.timeout   = 1600
    discadj_fsi2.reference_file = "grad_young.opt.ref"
    discadj_fsi2.test_file = "grad_young.opt"
    pass_list.append(discadj_fsi2.run_filediff())
    test_list.append(discadj_fsi2)

    # Tests summary
    print('==================================================================')
    print('Summary of the parallel tests')
    print('python version:', sys.version)
    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:su2code,项目名称:SU2,代码行数:104,代码来源:parallel_regression_AD.py


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