Ejemplo n.º 1
0
wing_param.convert_to_design_variable('root_chord', (5., 7.))
wing_param.convert_to_design_variable('break_chord', (3., 5.))
wing_param.convert_to_design_variable('tip_chord', (1., 2.))
wing_param.convert_to_design_variable('root_height', (1., 1.5))
wing_param.convert_to_design_variable('break_height', (0.8, 1.2))
wing_param.convert_to_design_variable('tip_height', (0.2, 0.5))
wing_param.build_linear_airfoil(OC, AoA0=-2., Cm0=-0.1, set_as_ref=True)
wing_param.build_airfoils_from_ref()
wing_param.update()

print wing_param

DLLM = DLLMSolver('Simple', wing_param, OC)
DLLM.run_direct()
iAoA0 = DLLM.get_iAoA()
AoA0 = OC.get_AoA_rad()


def f(x):
    OC.set_AoA_rad(x[0])
    func = DLLM.comp_R(iAoA0)
    return func


def df(x):
    OC.set_AoA_rad(x[0])
    func_grad = DLLM.comp_dpR_dpAoA()
    N = len(func_grad)
    np_func_grad = numpy.zeros((N, 1))
    np_func_grad[:, 0] = func_grad[:]
    return np_func_grad
Ejemplo n.º 2
0
wing_param.convert_to_design_variable('break_height',(0.8,1.2))
wing_param.convert_to_design_variable('tip_height',(0.2,0.5))
wing_param.build_linear_airfoil(OC, AoA0=-2., Cm0=-0.1, set_as_ref=True)
wing_param.build_airfoils_from_ref()
wing_param.update()

print wing_param

x0=wing_param.get_dv_array()
print 'dv array shape',x0.shape
print 'dv_array=',x0

DLLM = DLLMSolver('Simple',wing_param,OC)
DLLM.run_direct()
iAoA=DLLM.get_iAoA()
AoA0=OC.get_AoA_rad()

# Split validation in 2 steps since the norm depends on the function value scale...
def f(x):
    OC.set_AoA_rad(x[0])
    DLLM.comp_R(iAoA)
    DLLM.set_direct_computed()
    DLLM.run_post()
    func=DLLM.get_F_list()
    return func

def df(x):
    OC.set_AoA_rad(x[0])
    DLLM.comp_R(iAoA)
    DLLM.set_direct_computed()
    DLLM.run_post()