Hello,

For x*y, I do not mean the expressions of phi is x*y. Here I just use x*y to sign discrete initial values to phi. My question has been solved. But thank you all the same.

Regards
Ronghai


On 26/01/15 19:08, Fausto Arinos de A. Barbuto wrote:

Hello,

Can't you do this?

phi = CellVariable(mesh=mesh, hasOld=1, value=x*y)
phi2 = CellVariable(mesh=mesh, hasOld=1, value=(x*y)**2)
phi3 = CellVariable(mesh=mesh, hasOld=1, value=(x*y)**3)

eq = TransientTerm(var=phi, coeff=1.0e0) == ImplicitDiffusionTerm(var=phi, coeff=1.0e0) + ImplicitDiffusionTerm(var=phi2, coeff=1.0e0) + ImplicitDiffusionTerm(var=phi3, coeff=1.0e0)

At least, it works.

Regards,

Fausto




On Monday, January 26, 2015 3:10 PM, Ronghai Wu <[email protected]> wrote:



    Dear Fipy developers and users,

    I have a strange PDE in 2D "dphi/dt = Laplacian(phi) +
    Laplacian(phi**2) + Laplacian(phi**3)",
    which I implement in the following way, but raise typeerror "The
    value of an `_OperatorVariable` cannot be assigned". Can anyone
    help me? Thanks.


    dx = 0.1
    dy = dx
    nx = 100
    ny = nx
    mesh = Grid2D(dx=dx, dy=dy, nx=nx, ny=ny)
    x = mesh.cellCenters[0]
    y = mesh.cellCenters[1]
    phi = CellVariable(mesh=mesh, hasOld=1, value=x*y)
    eq = TransientTerm(var=phi, coeff=1.) ==
    ImplicitDiffusionTerm(var=phi, coeff=1.) +
    ImplicitDiffusionTerm(var=phi**2, coeff=1.) +
    ImplicitDiffusionTerm(var=phi**3, coeff=1.)
    viewer = Viewer(vars=phi)
    for step in range(10):
    phi.updateOld()
    res = 1.e5
    while res > 1.e-1:
    res = eq.sweep(dt=1.e-3)
    viewer.plot()

    Regards
    Ronghai

    _______________________________________________
    fipy mailing list
    [email protected] <mailto:[email protected]>
    http://www.ctcms.nist.gov/fipy
      [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]



--
------------------------------------------
Ronghai Wu

Institute of Materials Simulation (WW8)
Department of Materials Science and Engineering
University of Erlangen-Nürnberg
Dr.-Mack-Str. 77, 90762 Fürth, Germany

Tel. +49 (0)911 65078-65064

_______________________________________________
fipy mailing list
[email protected]
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Reply via email to