Esempio n. 1
0
def profile_aerostruct(num_x=2, num_y=7, n=100):
    params = aerostruct.setup(num_x, num_y)
    def_mesh = aerostruct.gen_init_mesh(params['surfaces'][0], params['comp_dict'])
    for i in range(n):
        # if i % 10 == 0:
        #     print(i)
        loads = aerostruct.aerodynamics2(def_mesh, params)
        loads_aerostruct = loads
        def_mesh = aerostruct.structures2(loads_aerostruct, params)
        def_mesh_aerostruct = def_mesh
Esempio n. 2
0
def test_timing(num_inboard=3, num_outboard=4, n=100):
    print('n=',n)
    print('Run coupled.setup()...')
    tic = time.clock()
    for i in xrange(n):
        def_mesh_coupled, params_coupled = coupled.setup(num_inboard, num_outboard)
    toc11 = time.clock() - tic
    print('Time per eval: {0} s'.format(toc11 / n))
    # toc11 = 0.0081286546 * n

    print('Run aerostruct.setup()...')
    tic = time.clock()
    for i in xrange(n):
        def_mesh_aerostruct, params_aerostruct = aerostruct.setup(num_inboard, num_outboard)
    toc12 = time.clock() - tic
    print('Time per eval: {0} s  --> {1}x faster than coupled'.format(toc12 / n, toc11/toc12))
    # toc12 = 0.00325556601613 * n

    print('Run aerostruct_cython.setup()...')
    tic = time.clock()
    for i in xrange(n):
        def_mesh_cython, params_cython = aerostruct_cython.setup(num_inboard, num_outboard)
    toc13 = time.clock() - tic
    print('Time per eval: {0} s  --> {1}x faster than coupled'.format(toc13 / n, toc11/toc13))
    print('                      --> {0}x faster than aerostruct'.format(toc12/toc13))
    #

    print('\nRun coupled.aero()...')
    tic = time.clock()
    for i in xrange(n):
        loads_coupled = coupled.aero(def_mesh_coupled, params_coupled)
    toc21 = time.clock() - tic
    print('Time per eval: {0} s'.format(toc21 / n))
    print('Run aerostruct.aerodynamics()...')
    tic = time.clock()
    for i in xrange(n):
        loads_aerostruct = aerostruct.aerodynamics(def_mesh_aerostruct, params_aerostruct)
    toc22 = time.clock() - tic
    print('Time per eval: {0} s  --> {1}x faster than coupled'.format(toc22 / n, toc21/toc22))
    print('Run aerostruct_cython.aerodynamics()...')
    tic = time.clock()
    for i in xrange(n):
        loads_cython = aerostruct_cython.aerodynamics(def_mesh_cython, params_cython)
    toc23 = time.clock() - tic
    print('Time per eval: {0} s  --> {1}x faster than coupled'.format(toc23 / n, toc21/toc23))
    print('                      --> {0}x faster than aerostruct'.format(toc22/toc23))
Esempio n. 3
0
def time_iterations(num_inboard=3, num_outboard=4, n=100):
    print('\n...Time iterations... ')
    print('Run coupled loop ...')
    def_mesh, params = coupled.setup(num_inboard, num_outboard)
    tic = time.clock()
    for i in xrange(n):
        loads = coupled.aero(def_mesh, params)
        def_mesh = coupled.struct(loads, params)
    toc1 = time.clock() - tic
    print('Time per iteration: {0} s  '.format(toc1/n))

    print('Run aerostruct loop ...')
    def_mesh, params = aerostruct.setup(num_inboard, num_outboard)
    tic = time.clock()
    for i in xrange(n):
        loads = aerostruct.aerodynamics(def_mesh, params)
        def_mesh = aerostruct.structures(loads, params)
    toc2 = time.clock() - tic
    print('Time per iteration: {0} s  --> {1}x faster'.format(toc2/n, toc1/toc2))
Esempio n. 4
0
def main_aerostruct(num_x=2, num_y=7):
    print('\nRun aerostruct.setup()...')
    params = aerostruct.setup(num_x, num_y)
    print('params = ')
    print(params)
    def_mesh = aerostruct.gen_init_mesh(params['surfaces'][0], params['comp_dict'])
    print('def_mesh = ')
    print(def_mesh)
    # print('def_mesh...  def_mesh.shape =', def_mesh.shape)
    
    print('\nRun aerostruct.aerodynamics()...')
    loads = aerostruct.aerodynamics(def_mesh, params)
    print('loads matrix... loads.shape =', loads.shape)
    print(loads)
    loads_aerostruct = loads
    #
    print('\nRun aerostruct.structures()...')
    def_mesh = aerostruct.structures(loads_aerostruct, params)
    print('def_mesh...  def_mesh.shape =',def_mesh.shape)
    print(def_mesh)
    def_mesh_aerostruct = def_mesh
Esempio n. 5
0
def test_accuracy(num_inboard=3, num_outboard=4):

    print('\nRun coupled.setup()...')
    def_mesh, params = coupled.setup(num_inboard, num_outboard)
    print('def_mesh...  def_mesh.shape =', def_mesh.shape)
    # print(def_mesh)

    print('\nRun aerostruct.setup()...')
    def_mesh, params = aerostruct.setup(num_inboard, num_outboard)
    print('def_mesh...  def_mesh.shape =', def_mesh.shape)
    # print(def_mesh)

    print('\nRun coupled.aero()...')
    loads = coupled.aero(def_mesh, params)
    print('loads matrix... loads.shape =', loads.shape)
    # print(loads)
    loads_coupled = loads

    print('\nRun aerostruct.aerodynamics()...')
    loads = aerostruct.aerodynamics(def_mesh, params)
    print('loads matrix... loads.shape =', loads.shape)
    # print(loads)
    loads_aerostruct = loads

    print('\nloads Difference:')
    # print(loads_coupled - loads_aerostruct)

    print('\nRun coupled.struct()...')
    def_mesh = coupled.struct(loads_coupled, params)
    print('def_mesh...  def_mesh.shape =',def_mesh.shape)
    # print(def_mesh)
    def_mesh_coupled = def_mesh

    print('\nRun aerostruct.structures()...')
    def_mesh = aerostruct.structures(loads_aerostruct, params)
    print('def_mesh...  def_mesh.shape =',def_mesh.shape)
    # print(def_mesh)
    def_mesh_aerostruct = def_mesh

    print('\ndef_mesh Difference:')