标题:Python解微分方程出现TypeError: splu() got an unexpected keyword argume ...
只看楼主
yzdm
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2018-4-5
 问题点数:0 回复次数:2 
Python解微分方程出现TypeError: splu() got an unexpected keyword argument 'drop_tol'错误提示
如题所示,本人接触python有一阵子了,目前用的2.7.14,杂七杂八的学着。最近需要用到python解微分方程安装了fipy包,参考了网上的一个例子代码如下:
import fipy as fp
nx = 20
ny = 20
dx = 1.
dy = dx
L = dx*nx
mesh = fp.Grid2D(dx=dx,dy=dy,nx=nx,ny=ny)
phi = fp.CellVariable(name='solution variable', mesh=mesh, value=0.)
D = 1
eq = fp.TransientTerm() == fp.DiffusionTerm(coeff=D)
T1 = 100
T2 = 0
phi.constrain(T2, mesh.facesRight)
phi.constrain(T2, mesh.facesLeft)
phi.constrain(T2, mesh.facesBottom)
phi.constrain(T1, mesh.facesTop)

viewer = fp.Viewer(vars = phi, datamin=0., datamax = 1.)
viewer.plot()

timeStepDuration = 10*0.9*dx**2/(2*D)
steps =10
for step in range(steps):
    eq.solve(var=phi, dt=timeStepDuration)
    viewer.plot()
print fp.numerix.allclose(phi(((L,),(0,))),T1,atol = 1e-2)
raw_input('press <return> to exit')
运行后出现如下错误提示:
  File "C:\Users\Yang\Desktop\pf-test\bdwk.py", line 24, in <module>
    eq.solve(var=phi, dt=timeStepDuration)
  File "C:\Python27\lib\site-packages\fipy\terms\term.py", line 213, in solve
    solver._solve()
  File "C:\Python27\lib\site-packages\fipy\solvers\scipy\scipySolver.py", line 61, in _solve
    self.var[:] = numerix.reshape(self._solve_(self.matrix, self.var.ravel(), numerix.array(self.RHSvector)), self.var.shape)
  File "C:\Python27\lib\site-packages\fipy\solvers\scipy\linearLUSolver.py", line 64, in _solve_
    permc_spec=3)
TypeError: splu() got an unexpected keyword argument 'drop_tol'
看不太懂啥意思,希望有大神指点一二。
搜索更多相关主题的帖子: Python 错误 提示 var File 
2018-04-05 22:41
JJ1002091318
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2018-11-12
得分:0 
你好朋友,请问你的问题解决了么?我也遇到了这个问题,想请教一下,多谢了!
2018-11-12 19:09
Guci
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2018-12-4
得分:0 
你好,同问是否解决了,想请教下
2018-12-04 19:52



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-485783-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.142941 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved