On Nov 17, 2008, at 1:17 PM, Thomas Cool wrote:

I am using the trunk Version. My question is:
How do you make a CellVariable with for example cos(x) and sin(y) and draw a vector field (or any type of function)) to pass to the VectorViewer? Something in like this: (no need for any of the special effects or anything)
http://matplotlib.sourceforge.net/examples/pylab_examples/quiver_demo.html


>>> from fipy import *
>>> L = 2*pi
>>> dx = 0.2
>>> nx = int(L/dx)
>>> mesh = Grid2D(nx=nx, ny=nx, dx=dx, dy=dx)
>>> x, y = mesh.getCellCenters()
>>> var = CellVariable(mesh=mesh, rank=1, value=(cos(x), sin(y)))
>>> viewer = MatplotlibVectorViewer(vars=var)
>>> viewer.plot()

The Viewer factory isn't working right for some reason. I'll have to look into that.



Reply via email to