When I try to run the next script "canhilliard2dmesh" example
from fipy import *
if __name__ == "__main__":
nx = ny = 20
else:
nx = ny = 10
mesh = Grid2D(nx=nx, ny=ny, dx=0.25, dy=0.25)
phi = CellVariable(name=r"$\phi$", mesh=mesh)
psi = CellVariable(name=r"$\psi$", mesh=mesh)
phi.setValue(GaussianNoiseVariable(mesh=mesh,mean=0.5,variance=0.01))
if __name__ == "__main__":
viewer = Viewer(vars=(phi, psi)) # , datamin=0., datamax=1.)
D = a = epsilon = 1.
dfdphi = a**2 * 2 * phi * (1 - phi) * (1 - 2 * phi)
dfdphi_ = a**2 * 2 * (1 - phi) * (1 - 2 * phi)
d2fdphi2 = a**2 * 2 * (1 - 6 * phi * (1 - phi))
eq1 = (TransientTerm(var=phi) == DiffusionTerm(coeff=D, var=psi))
eq2 = (ImplicitSourceTerm(coeff=1., var=psi)==
ImplicitSourceTerm(coeff=-d2fdphi2, var=phi) - d2fdphi2 * phi + dfdphi-
DiffusionTerm(coeff=epsilon**2, var=phi))
eq3 = (ImplicitSourceTerm(coeff=1., var=psi)== ImplicitSourceTerm(coeff=dfdphi_,
var=phi)- DiffusionTerm(coeff=epsilon**2, var=phi))
eq = eq1 & eq2
dexp = -5
elapsed = 0.
if __name__ == "__main__":
duration = 1000.
else:
duration = 1e-2
while elapsed < duration:
dt = min(100, exp(dexp))
elapsed += dt
dexp += 0.01
eq.solve(dt=dt)
if __name__ == "__main__":
viewer.plot()
after this line eq1 = (TransientTerm(var=phi) == DiffusionTerm(coeff=D,
var=psi))
I get TypeError Traceback (most recent call
last)
/home/omar/femhub-0.9.10.beta2-ubuntu64/<ipython console> in <module>()
TypeError: __init__() got an unexpected keyword argument 'var'
I get the same error when I try to solve a partial differential equation system
equivalent to a NLSE,
what can I do to fix this?
Kind regards
_______________________________________________
fipy mailing list
[email protected]
http://www.ctcms.nist.gov/fipy
[ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]