コード例 #1
0
def df(x):
    wing_param.update_from_x_list(x)
    DLLM = DLLMTargetCl('Simple',wing_param,OC)
    DLLM.set_target_Cl(0.5)
    DLLM.run_direct()
    DLLM.run_post()
    DLLM.run_adjoint()
    func_grad=numpy.array(DLLM.get_dF_list_dchi())
    return func_grad
コード例 #2
0
 def df1(x):
     wing_param.update_from_x_list(x)
     DLLM = DLLMTargetCl('Simple',wing_param,OC)
     DLLM.set_target_Cl(0.5)
     DLLM.run_direct()
     DLLM.run_post()
     DLLM.run_adjoint()
     func_grad=np.array(DLLM.get_dF_list_dchi())
     N = func_grad.shape[0]
     ndv = func_grad.shape[1]
     out_grad = np.zeros((N,ndv))
     for i in xrange(N):
         out_grad[i,:] = func_grad[i,:]/Ref_list[i]
     return out_grad
コード例 #3
0
# Imports
from MDOTools.OC.operating_condition import OperatingCondition
from DLLM.DLLMGeom.wing_broken import Wing_Broken
from DLLM.DLLMKernel.DLLMTargetCl import DLLMTargetCl

OC=OperatingCondition('cond1', atmospheric_model='ISA')
OC.set_Mach(0.8)
OC.set_AoA(3.0)
OC.set_altitude(10000.)
OC.set_T0_deg(15.)
OC.set_P0(101325.)
OC.set_humidity(0.)
OC.compute_atmosphere()

wing_param=Wing_Broken('broken_wing',n_sect=20)
wing_param.import_BC_from_file('input_parameters.par')
wing_param.build_linear_airfoil(OC, AoA0=0.0, set_as_ref=True)
wing_param.build_airfoils_from_ref()
wing_param.update()
wing_param.plot()

DLLM = DLLMTargetCl('TCl',wing_param,OC)
DLLM.set_target_Cl(0.5)
DLLM.run_direct()
DLLM.run_post()
DLLM.run_adjoint()

print 'Cl = ',DLLM.get_DLLMPost().Cl,' Target = ',0.5
print 'AoA = ',OC.get_AoA()

dF_list_dchi=DLLM.get_dF_list_dchi()
コード例 #4
0
ファイル: test_target_Cl.py プロジェクト: regislebrun/DLLM
wing_param.set_value('tip_chord', 1.5)
wing_param.set_value('root_height', 1.28)
wing_param.set_value('break_height', 0.97)
wing_param.set_value('tip_height', 0.33)
wing_param.convert_to_design_variable('span', (10., 50.))
wing_param.convert_to_design_variable('sweep', (0., 40.))
wing_param.convert_to_design_variable('break_percent', (20., 40.))
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 = DLLMTargetCl('TCl', wing_param, OC)
#DLLM.set_method('scipy')
DLLM.set_target_Cl(0.5)
DLLM.run_direct()
DLLM.run_post()
DLLM.run_adjoint()

dF_list_dchi = DLLM.get_dF_list_dchi()

# for i,name in enumerate(DLLM.get_F_list_names()):
#     print 'gradients for '+name+' = ',dF_list_dchi[i]