示例#1
0
config_dict['Case.param.desc.break_height.bounds'] = (0.8, 1.2)
config_dict['Case.param.desc.tip_height.type'] = 'DesignVariable'
config_dict['Case.param.desc.tip_height.value'] = 0.33
config_dict['Case.param.desc.tip_height.bounds'] = (0.2, 0.5)

config_dict['Case.DLLM.type'] = 'Solver'
config_dict['Case.DLLM.method'] = 'inhouse'
config_dict['Case.DLLM.relax_factor'] = 0.99
config_dict['Case.DLLM.stop_residual'] = 1e-9
config_dict['Case.DLLM.max_iterations'] = 100

list_log = glob('*.log')
for log in list_log:
    os.remove(log)

MP = DLLMMP('Case')
MP.configure(config_dict)
MP.set_out_format('numpy')
MP.set_grad_format('numpy')

x0 = MP.get_x0()

val_grad = FDValidGrad(2, MP.run, MP.run_grad, fd_step=1.e-8)
ok, df_fd, df = val_grad.compare(x0,
                                 treshold=1.e-6,
                                 split_out=True,
                                 return_all=True)

# for j in xrange(len(df[:,0])):
#     fid=open('gradient_file'+str(j)+'.dat','w')
#     for i in xrange(len(x0)):