Hello all,

I'm using fipy to solve flow in porous media problems, and I must say
with the new version (3.0) there is no problem in solving single phase
multi-component convection diffusion equation coupled with Darcy's law.
My difficulty is with solving two-phase flow and specially
Buckley-Leverett problem. For the sake of simplicity, let's assume that
we can write it as

\frac{\partial S}{\partial t}+S\frac{\partial S}{\partial x}=0

Fipy does not accept multiplication of anything other than integers and
floats to a ConvectionTerm and it issues an error when I use the
following code. Is there a way to solve this problem?

Thanks a lot in advance,

Ehsan

from fipy import *

u = 1.e-3
L = 100.
nx = 200
dt = 1000.

mesh = Grid1D(dx = L/nx, nx = nx)

sw = CellVariable(mesh=mesh, name="saturation", hasOld=True, value = 0.)
sw.constrain(1.,mesh.facesLeft)
#sw.constrain(0., mesh.facesRight)
sw.faceGrad.constrain([0], mesh.facesRight)

eq = TransientTerm(coeff=1) + sw*UpwindConvectionTerm(coeff = (u,)) ==
0.

sw.constrain(1.,mesh.facesLeft)
#sw.constrain(0., mesh.facesRight)
sw.faceGrad.constrain([0], mesh.facesRight)

steps = 500
viewer = Viewer(vars = sw)
for step in range(steps):
    sw.updateOld()
    swres = 1.0e6
    while swres > 1e-6:
        swres = eq.sweep(dt = dt, var = sw)        
        print(swres)
        viewer.plot()

_______________________________________________
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