Q = (-v[0] * v[1], v[0]**2) 

produces a tuple of two rank-0 CellVariables. You need a rank-1 CellVariable. 
Try:

  Q = (-v[0] * v[1]) * [[1], [0]] + v[0]**2 * [[0], [1]]


On Feb 5, 2015, at 3:05 PM, Dhisa Minerva <rtmine...@yahoo.com> wrote:

> Hi everyone,
> 
> I am working with RDE system. I tried to search on fipy documentation and 
> examples about how to write source term in vector form.  For example, the 
> code bellow is to solve 2 RDEs on case 1D.
> 
> from fipy import *
> m = Grid1D(nx=100, Lx=1.)
> v = CellVariable(mesh=m, hasOld=True, value=[[0.5], [0.5]], elementshape=(2,))
> v.constrain([[0], [1]], where=m.facesLeft)
> v.constrain([[1], [0]], where=m.facesRight)
> M = [[1,0],[0,1]]
> N = [[1,0],[0,1]]
> Q = (-v[0] * v[1], v[0]**2) 
> eqn = TransientTerm(N) == DiffusionTerm([M]) + (Q)
> vi = Viewer((v[0],v[1]))
> for t in range(20): 
>      v.updateOld()
>      eqn.solve(var=v, dt=1.e-3)
>      if __name__ == '__main__':
>          vi.plot()
> if __name__ == '__main__':
>      raw_input("Press <return> to proceed...")
> 
> Can anybody tell me how to write the source term 'Q'? The point why I don't 
> define each variable separately is because I want to work with big RDE system.
> 
> Thanks,
> Dhisa
> Vanderbilt
> 
> _______________________________________________
> fipy mailing list
> fipy@nist.gov
> http://www.ctcms.nist.gov/fipy
>  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]


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

Reply via email to