Found a manual, but it wasn't a huge amount of help on this problem. But I 
think I've got it figured out. 
Here's what I did:

def V(x,y):
        """ dummy vector field with arbitrary math expressions """
        return [x*y,y-x]

x = mesh.cellCenters[0]
y = mesh.cellCenters[1]

vel = CellVariable(name = "velocity field",
                   mesh = mesh,
                   rank = 1,
                   value = V(x,y))

eq = TransientTerm() == 
(DiffusionTerm(coeff=D)+ExplicitUpwindConvectionTerm(coeff=vel))

... seems to work when V(x,y) is a general numpy mathematical expression. I 
don't really grasp why, since the variables x,y are not simple numpy arrays, 
but it seems to work correctly. Anyone care to enlighten me as to why this 
works? This must be some kind of Python operator overloading. I must have 
missed this point somewhere in the manual.

Richard

_______________________________________________
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