本文整理汇总了Python中DLLM.DLLMKernel.DLLMSolver.DLLMSolver类的典型用法代码示例。如果您正苦于以下问题:Python DLLMSolver类的具体用法?Python DLLMSolver怎么用?Python DLLMSolver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DLLMSolver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_DLLM_valid_dpF_list_dpAoA
def test_DLLM_valid_dpF_list_dpAoA(self):
OC,wing_param = self.__init_wing_param()
DLLM = DLLMSolver('test',wing_param,OC)
print ''
DLLM.run_direct()
iAoA=DLLM.get_iAoA()
AoA0=OC.get_AoA_rad()
def f3(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 df3(x):
OC.set_AoA_rad(x[0])
DLLM.comp_R(iAoA)
DLLM.set_direct_computed()
DLLM.run_post()
func_grad=DLLM.get_dpF_list_dpAoA()
N=len(func_grad)
np_func_grad=zeros((N,1))
np_func_grad[:,0]=func_grad[:]
return np_func_grad
val_grad3=FDValidGrad(2,f3,df3,fd_step=1.e-8)
ok3,df_fd3,df3=val_grad3.compare([AoA0],treshold=1.e-6,split_out=True,return_all=True)
assert(ok3)
示例2: test_DLLM_valid_dpF_list_dpchi
def test_DLLM_valid_dpF_list_dpchi(self):
OC,wing_param = self.__init_wing_param()
DLLM = DLLMSolver('test',wing_param,OC)
print ''
DLLM.run_direct()
iAoA=DLLM.get_iAoA()
x0=wing_param.get_dv_array()
def f2(x):
wing_param.update_from_x_list(x)
DLLM.set_wing_param(wing_param)
DLLM.comp_R(iAoA)
DLLM.set_direct_computed()
DLLM.run_post()
func=DLLM.get_F_list()
return func
def df2(x):
wing_param.update_from_x_list(x)
DLLM.set_wing_param(wing_param)
DLLM.comp_R(iAoA)
DLLM.set_direct_computed()
DLLM.run_post()
func_grad=DLLM.get_dpF_list_dpchi()
return func_grad
val_grad2=FDValidGrad(2,f2,df2,fd_step=1.e-8)
ok2,df_fd2,df2=val_grad2.compare(x0,treshold=1.e-6,split_out=True,return_all=True)
assert(ok2)
示例3: test_DLLM_valid_dpLoads_dpAoA
def test_DLLM_valid_dpLoads_dpAoA(self):
OC,wing_param = self.__init_wing_param()
DLLM = DLLMSolver('test',wing_param,OC)
print ''
DLLM.run_direct()
iAoA0=DLLM.get_iAoA()
AoA0=OC.get_AoA_rad()
def f2(x):
OC.set_AoA_rad(x[0])
R=DLLM.comp_R(iAoA0)
Post=DLLM.get_DLLMPost()
func=Post.comp_Lift_distrib()
return func
def df2(x):
OC.set_AoA_rad(x[0])
R=DLLM.comp_R(iAoA0)
Post=DLLM.get_DLLMPost()
func_grad=Post.comp_dpLift_distrib_dpAoA()
N=len(func_grad)
np_func_grad=zeros((N,1))
np_func_grad[:,0]=func_grad[:]
return np_func_grad
val_grad2=FDValidGrad(2,f2,df2,fd_step=1.e-8)
ok2,df_fd2,df2=val_grad2.compare([AoA0],treshold=1.e-5,return_all=True)
assert(ok2)
示例4: test_DLLM_run_direct
def test_DLLM_run_direct(self):
OC,wing_param = self.__init_wing_param()
DLLM = DLLMSolver('test',wing_param,OC)
try:
print ''
DLLM.run_direct()
ok=True
except:
ok=False
assert(ok)
示例5: test_DLLM_valid_dpLoads_distrib_dpAoA
def test_DLLM_valid_dpLoads_distrib_dpAoA(self):
OC,wing_param = self.__init_wing_param()
DLLM = DLLMSolver('test',wing_param,OC)
print ''
DLLM.run_direct()
iAoA0=DLLM.get_iAoA()
AoA0=OC.get_AoA_rad()
Post=DLLM.get_DLLMPost()
def f1(x):
OC.set_AoA_rad(x[0])
R=DLLM.comp_R(iAoA0)
DLLM.run_post()
func=Post.Lift_distrib
return func
def df1(x):
OC.set_AoA_rad(x[0])
R=DLLM.comp_R(iAoA0)
DLLM.run_post()
func_grad=Post.dpLift_distrib_dpAoA
N=len(func_grad)
np_func_grad=np.zeros((N,1))
np_func_grad[:,0]=func_grad[:]
return np_func_grad
def f2(x):
OC.set_AoA_rad(x[0])
R=DLLM.comp_R(iAoA0)
DLLM.run_post()
func=Post.Drag_distrib
return func
def df2(x):
OC.set_AoA_rad(x[0])
R=DLLM.comp_R(iAoA0)
DLLM.run_post()
func_grad=Post.dpDrag_distrib_dpAoA
N=len(func_grad)
np_func_grad=np.zeros((N,1))
np_func_grad[:,0]=func_grad[:]
return np_func_grad
val_grad1=FDValidGrad(2,f1,df1,fd_step=1.e-8)
ok1,df_fd1,df1=val_grad1.compare([AoA0],treshold=1.e-6,return_all=True)
val_grad2=FDValidGrad(2,f2,df2,fd_step=1.e-8)
ok2,df_fd2,df2=val_grad2.compare([AoA0],treshold=1.e-6,return_all=True)
norm1, norm2 = self.print_valid_FD([AoA0],'dpLift_distrib_dpAoA',df1,df_fd1,'dpDrag_distrib_dpAoA',df2,df_fd2)
self.plot_valid_FD([AoA0],'dpLift_distrib_dpAoA',df1,df_fd1,'dpDrag_distrib_dpAoA',df2,df_fd2, norm1, norm2, 'Loads_distrib_dpAoA')
if (ok1==True) and (ok2==True):
ok = True
else :
ok = False
assert(ok)
示例6: test_DLLM_valid_dpLoads_distrib_dpchi
def test_DLLM_valid_dpLoads_distrib_dpchi(self):
OC,wing_param = self.__init_wing_param()
DLLM = DLLMSolver('test',wing_param,OC)
print ''
DLLM.run_direct()
iAoA=DLLM.get_iAoA()
x0=wing_param.get_dv_array()
Post=DLLM.get_DLLMPost()
def f1(x):
wing_param.update_from_x_list(x)
DLLM.set_geom(wing_param)
DLLM.comp_R(iAoA)
Post.run()
func=Post.Lift_distrib
return func
def df1(x):
wing_param.update_from_x_list(x)
DLLM.set_geom(wing_param)
DLLM.comp_R(iAoA)
Post.run()
func_grad=Post.dpLift_distrib_dpchi
return func_grad
def f2(x):
wing_param.update_from_x_list(x)
DLLM.set_geom(wing_param)
DLLM.comp_R(iAoA)
Post.run()
func=Post.Drag_distrib
return func
def df2(x):
wing_param.update_from_x_list(x)
DLLM.set_geom(wing_param)
DLLM.comp_R(iAoA)
Post.run()
func_grad=Post.dpDrag_distrib_dpchi
return func_grad
val_grad1=FDValidGrad(2,f1,df1,fd_step=1.e-8)
ok1,df_fd1,df1=val_grad1.compare(x0,treshold=1.e-6,return_all=True)
val_grad2=FDValidGrad(2,f2,df2,fd_step=1.e-8)
ok2,df_fd2,df2=val_grad2.compare(x0,treshold=1.e-6,return_all=True)
norm1, norm2 = self.print_valid_FD(x0,'dpLift_distrib_dpchi',df1,df_fd1,'dpDrag_distrib_dpchi',df2,df_fd2)
self.plot_valid_FD(x0,'dpLift_distrib_dpchi',df1,df_fd1,'dpDrag_distrib_dpchi',df2,df_fd2, norm1, norm2, 'Loads_distrib_dpchi')
if (ok1==True) and (ok2==True):
ok = True
else :
ok = False
assert(ok)
示例7: df
def df(x):
wing_param.update_from_x_list(x)
DLLM = DLLMSolver('Simple',wing_param,OC)
DLLM.run_direct()
DLLM.run_post()
DLLM.run_adjoint()
func_grad=numpy.array(DLLM.get_dF_list_dchi())
return func_grad
示例8: test_DLLM_valid_dpR_dpiAoA
def test_DLLM_valid_dpR_dpiAoA(self):
OC,wing_param = self.__init_wing_param()
DLLM = DLLMSolver('test',wing_param,OC)
print ''
DLLM.run_direct()
iAoA0=DLLM.get_iAoA()
def f1(x):
func=DLLM.comp_R(x)
return func
def df1(x):
func_grad=DLLM.comp_dpR_dpiAoA(x)
return func_grad
val_grad1=FDValidGrad(2,f1,df1,fd_step=1.e-8)
ok1,df_fd1,df1=val_grad1.compare(iAoA0,treshold=1.e-6,return_all=True)
assert(ok1)
示例9: __init__
def __init__(self, tag, wing_param, OC, verbose = 0):
self.__verbose = verbose
DLLMSolver.__init__(self, tag, wing_param, OC, verbose = self.__verbose)
self.__N = self.get_wing_param().get_n_sect()
self.__ndv = self.get_wing_param().get_ndv()
self.__R_TCl = numpy.zeros(self.__N+1)
self.__dpR_TCl_dpW = numpy.zeros((self.__N+1,self.__N+1))
self.__dpR_TCl_dpchi = numpy.zeros((self.__N+1,self.__ndv))
self.__dpF_list_dpW = None
self.__target_Cl = 0.5
# initialize the Newton-Raphson problem
self.__NRPb = None
self.__init_Newton_Raphson()
示例10: __init__
def __init__(self, tag, geom, OC,verbose = 0, grad_active=True):
self.__verbose = verbose
DLLMSolver.__init__(self, tag, geom, OC, verbose = self.__verbose, grad_active=grad_active)
self.__N = self.get_geom().get_n_sect()
self.__ndv = self.get_geom().get_ndv()
self.__R_TL = numpy.zeros(self.__N+1)
self.__dpR_TL_dpW = numpy.zeros((self.__N+1,self.__N+1))
self.__dpR_TL_dpchi = numpy.zeros((self.__N+1,self.__ndv))
self.__dpF_list_dpW = None
self.__target_Lift = 0.
# initialize the Newton-Raphson problem
self.__NRPb = None
self.__init_Newton_Raphson()
示例11: runDLLM
def runDLLM(wing_param, OC):
DLLM = DLLMSolver('Wing',wing_param,OC)
DLLM.run_direct()
DLLM.run_post()
output = DLLM.get_F_list()
F_list_names = DLLM.get_F_list_names()
return output, F_list_names
示例12: test_DLLM_valid_dpR_dpthetaY
def test_DLLM_valid_dpR_dpthetaY(self):
OC,wing_param = self.__init_wing_param()
DLLM = DLLMSolver('test',wing_param,OC)
print ''
DLLM.run_direct()
iAoA=DLLM.get_iAoA()
thetaY0=wing_param.get_thetaY()
def f3(x):
wing_param.set_thetaY(x)
func=DLLM.comp_R(iAoA)
return func
def df3(x):
wing_param.set_thetaY(x)
func_grad=DLLM.comp_dpR_dpthetaY()
return func_grad
val_grad3=FDValidGrad(2,f3,df3,fd_step=1.e-8)
ok3,df_fd3,df3=val_grad3.compare(thetaY0,treshold=1.e-6,return_all=True)
assert(ok3)
示例13: f
def f(x):
wing_param.update_from_x_list(x)
DLLM = DLLMSolver('Simple',wing_param,OC)
DLLM.run_direct()
DLLM.run_post()
func=DLLM.get_F_list()
return func
示例14: f
def f(x):
wing_param.update_from_x_list(x)
DLLM = DLLMSolver('Meta',wing_param,OC)
DLLM.run_direct()
#DLLM.run_post(func_list=['Cl'])
DLLM.run_post()
func=DLLM.get_F_list()
return func
示例15: test_DLLM_valid_dpR_dpAoA
def test_DLLM_valid_dpR_dpAoA(self):
OC,wing_param = self.__init_wing_param()
DLLM = DLLMSolver('test',wing_param,OC)
print ''
DLLM.run_direct()
iAoA = DLLM.get_iAoA()
AoA0=OC.get_AoA_rad()
def f4(x):
OC.set_AoA_rad(x[0])
func=DLLM.comp_R(iAoA)
return func
def df4(x):
OC.set_AoA_rad(x[0])
func_grad=DLLM.comp_dpR_dpAoA()
N=len(func_grad)
np_func_grad=zeros((N,1))
np_func_grad[:,0]=func_grad[:]
return np_func_grad
val_grad4=FDValidGrad(2,f4,df4,fd_step=1.e-8)
ok4,df_fd4,df4=val_grad4.compare([AoA0],treshold=1.e-6,return_all=True)
assert(ok4)