Technically, I think this should be a FaceVariable rather than CellVariable. 
But if I do that substitution, python complains:

ValueError: shape mismatch: objects cannot be broadcast to a single shape
WARNING: Failure executing file: <A4F.py>

Richard

On Oct 7, 2013, at 1:21 PM, Richard Gillilan wrote:

> 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]
> 

FaceVariable?

> 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 ]
> 



_______________________________________________
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