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'
看不太懂啥意思,希望有大神指点一二。