Bookmark and Share FiPy: A Finite Volume PDE Solver Using Python
Version 2.1.3

This Page

Contact

FiPy developers
Jonathan Guyer
Daniel Wheeler
James Warren

Join our mailing list

100 Bureau Drive, M/S 6555
Gaithersburg, MD 20899

301-975-5329 Telephone
301-975-4553 Facsimile

gistViewer Package Documentation

This page contains the gistViewer Package documentation.

The gistViewer Package

fipy.viewers.gistViewer.GistViewer(vars, title=None, limits={}, **kwlimits)

Generic function for creating a GistViewer.

The GistViewer factory will search the module tree and return an instance of the first GistViewer it finds of the correct dimension.

Parameters :
vars

a CellVariable or tuple of CellVariable objects to plot

title

displayed at the top of the Viewer window

limits : dict

a (deprecated) alternative to limit keyword arguments

xmin, xmax, ymin, ymax, datamin, datamax

displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.

class fipy.viewers.gistViewer.Gist1DViewer(vars, title=None, xlog=0, ylog=0, style='work.gs', limits={}, **kwlimits)

Bases: fipy.viewers.gistViewer.gistViewer._GistViewer

Displays a y vs. x plot of one or more 1D CellVariable objects.

>>> from fipy import *
>>> mesh = Grid1D(nx=100)
>>> x, = mesh.getCellCenters()
>>> xVar = CellVariable(mesh=mesh, name="x", value=x)
>>> k = Variable(name="k", value=0.)
>>> viewer = Gist1DViewer(vars=(sin(k * xVar), cos(k * xVar / pi)), 
...                 limits={'xmin': 10, 'xmax': 90}, 
...                 datamin=-0.9, datamax=2.0,
...                 title="Gist1DViewer test")
>>> for kval in numerix.arange(0,0.3,0.03):
...     k.setValue(kval)
...     viewer.plot()
>>> viewer._promptForOpinion()

Creates a Gist1DViewer.

Parameters :
vars

a CellVariable or tuple of CellVariable objects to plot

title

displayed at the top of the Viewer window

xlog

log scaling of x axis if True

ylog

log scaling of y axis if True

stye

the Gist stylefile to use.

limits : dict

a (deprecated) alternative to limit keyword arguments

xmin, xmax, datamin, datamax

displayed range of data. Any limit set to a (default) value of None will autoscale. (ymin and ymax are synonyms for datamin and datamax).

plot(filename=None)
class fipy.viewers.gistViewer.Gist2DViewer(vars, title=None, palette='heat.gp', grid=True, dpi=75, limits={}, **kwlimits)

Bases: fipy.viewers.gistViewer.gistViewer._GistViewer

Displays a contour plot of a 2D CellVariable object.

>>> from fipy import *
>>> mesh = Grid2D(nx=50, ny=100, dx=0.1, dy=0.01)
>>> x, y = mesh.getCellCenters()
>>> xyVar = CellVariable(mesh=mesh, name="x y", value=x * y)
>>> k = Variable(name="k", value=0.)
>>> viewer = Gist2DViewer(vars=sin(k * xyVar), 
...                 limits={'ymin': 0.1, 'ymax': 0.9}, 
...                 datamin=-0.9, datamax=2.0,
...                 title="Gist2DViewer test")
>>> for kval in range(10):
...     k.setValue(kval)
...     viewer.plot()
>>> viewer._promptForOpinion()
>>> from fipy import *
>>> mesh = (Grid2D(nx=5, ny=10, dx=0.1, dy=0.1)
...         + (Tri2D(nx=5, ny=5, dx=0.1, dy=0.1) 
...          + ((0.5,), (0.2,))))
>>> x, y = mesh.getCellCenters()
>>> xyVar = CellVariable(mesh=mesh, name="x y", value=x * y)
>>> k = Variable(name="k", value=0.)
>>> viewer = Gist2DViewer(vars=sin(k * xyVar), 
...                 limits={'ymin': 0.1, 'ymax': 0.9}, 
...                 datamin=-0.9, datamax=2.0,
...                 title="Gist2DViewer test")
>>> for kval in range(10):
...     k.setValue(kval)
...     viewer.plot()
>>> viewer._promptForOpinion()

Creates a Gist2DViewer.

Parameters :
vars

a CellVariable object.

title

displayed at the top of the Viewer window

palette

the color scheme to use for the image plot. Default is heat.gp. Another choice would be rainbow.gp.

grid

whether to show the grid lines in the plot.

limits : dict

a (deprecated) alternative to limit keyword arguments

xmin, xmax, ymin, ymax, datamin, datamax

displayed range of data. Any limit set to a (default) value of None will autoscale.

plot(filename=None)

Plot the CellVariable as a contour plot.

plotMesh(filename=None)
class fipy.viewers.gistViewer.GistVectorViewer(vars, title=None, limits={}, **kwlimits)

Bases: fipy.viewers.gistViewer.gistViewer._GistViewer

Displays a vector plot of a 2D rank-1 CellVariable or FaceVariable object using gist.

>>> from fipy import *
>>> mesh = Grid2D(nx=50, ny=100, dx=0.1, dy=0.01)
>>> x, y = mesh.getCellCenters()
>>> xyVar = CellVariable(mesh=mesh, name="x y", value=x * y)
>>> k = Variable(name="k", value=0.)
>>> viewer = GistVectorViewer(vars=sin(k * xyVar).getGrad(), 
...                 title="GistVectorViewer test")
>>> for kval in range(10):
...     k.setValue(kval)
...     viewer.plot()
>>> viewer._promptForOpinion()
>>> viewer = GistVectorViewer(vars=sin(k * xyVar).getFaceGrad(), 
...                 title="GistVectorViewer test")
>>> for kval in range(10):
...     k.setValue(kval)
...     viewer.plot()
>>> viewer._promptForOpinion()
>>> from fipy import *
>>> mesh = (Grid2D(nx=5, ny=10, dx=0.1, dy=0.1)
...         + (Tri2D(nx=5, ny=5, dx=0.1, dy=0.1) 
...          + ((0.5,), (0.2,))))
>>> x, y = mesh.getCellCenters()
>>> xyVar = CellVariable(mesh=mesh, name="x y", value=x * y)
>>> k = Variable(name="k", value=0.)
>>> viewer = GistVectorViewer(vars=sin(k * xyVar).getGrad(), 
...                 title="GistVectorViewer test")
>>> for kval in range(10):
...     k.setValue(kval)
...     viewer.plot()
>>> viewer._promptForOpinion()
>>> viewer = GistVectorViewer(vars=sin(k * xyVar).getFaceGrad(), 
...                 title="GistVectorViewer test")
>>> for kval in range(10):
...     k.setValue(kval)
...     viewer.plot()
>>> viewer._promptForOpinion()

Creates a GistVectorViewer.

Parameters :
vars

a rank-1 CellVariable or FaceVariable object.

title

displayed at the top of the Viewer window

limits : dict

a (deprecated) alternative to limit keyword arguments

xmin, xmax, ymin, ymax, datamin, datamax

displayed range of data. Any limit set to a (default) value of None will autoscale.

getArray()
plot(filename=None)

The colorbar Module

The gist1DViewer Module

class fipy.viewers.gistViewer.gist1DViewer.Gist1DViewer(vars, title=None, xlog=0, ylog=0, style='work.gs', limits={}, **kwlimits)

Bases: fipy.viewers.gistViewer.gistViewer._GistViewer

Displays a y vs. x plot of one or more 1D CellVariable objects.

>>> from fipy import *
>>> mesh = Grid1D(nx=100)
>>> x, = mesh.getCellCenters()
>>> xVar = CellVariable(mesh=mesh, name="x", value=x)
>>> k = Variable(name="k", value=0.)
>>> viewer = Gist1DViewer(vars=(sin(k * xVar), cos(k * xVar / pi)), 
...                 limits={'xmin': 10, 'xmax': 90}, 
...                 datamin=-0.9, datamax=2.0,
...                 title="Gist1DViewer test")
>>> for kval in numerix.arange(0,0.3,0.03):
...     k.setValue(kval)
...     viewer.plot()
>>> viewer._promptForOpinion()

Creates a Gist1DViewer.

Parameters :
vars

a CellVariable or tuple of CellVariable objects to plot

title

displayed at the top of the Viewer window

xlog

log scaling of x axis if True

ylog

log scaling of y axis if True

stye

the Gist stylefile to use.

limits : dict

a (deprecated) alternative to limit keyword arguments

xmin, xmax, datamin, datamax

displayed range of data. Any limit set to a (default) value of None will autoscale. (ymin and ymax are synonyms for datamin and datamax).

plot(filename=None)

The gist2DViewer Module

class fipy.viewers.gistViewer.gist2DViewer.Gist2DViewer(vars, title=None, palette='heat.gp', grid=True, dpi=75, limits={}, **kwlimits)

Bases: fipy.viewers.gistViewer.gistViewer._GistViewer

Displays a contour plot of a 2D CellVariable object.

>>> from fipy import *
>>> mesh = Grid2D(nx=50, ny=100, dx=0.1, dy=0.01)
>>> x, y = mesh.getCellCenters()
>>> xyVar = CellVariable(mesh=mesh, name="x y", value=x * y)
>>> k = Variable(name="k", value=0.)
>>> viewer = Gist2DViewer(vars=sin(k * xyVar), 
...                 limits={'ymin': 0.1, 'ymax': 0.9}, 
...                 datamin=-0.9, datamax=2.0,
...                 title="Gist2DViewer test")
>>> for kval in range(10):
...     k.setValue(kval)
...     viewer.plot()
>>> viewer._promptForOpinion()
>>> from fipy import *
>>> mesh = (Grid2D(nx=5, ny=10, dx=0.1, dy=0.1)
...         + (Tri2D(nx=5, ny=5, dx=0.1, dy=0.1) 
...          + ((0.5,), (0.2,))))
>>> x, y = mesh.getCellCenters()
>>> xyVar = CellVariable(mesh=mesh, name="x y", value=x * y)
>>> k = Variable(name="k", value=0.)
>>> viewer = Gist2DViewer(vars=sin(k * xyVar), 
...                 limits={'ymin': 0.1, 'ymax': 0.9}, 
...                 datamin=-0.9, datamax=2.0,
...                 title="Gist2DViewer test")
>>> for kval in range(10):
...     k.setValue(kval)
...     viewer.plot()
>>> viewer._promptForOpinion()

Creates a Gist2DViewer.

Parameters :
vars

a CellVariable object.

title

displayed at the top of the Viewer window

palette

the color scheme to use for the image plot. Default is heat.gp. Another choice would be rainbow.gp.

grid

whether to show the grid lines in the plot.

limits : dict

a (deprecated) alternative to limit keyword arguments

xmin, xmax, ymin, ymax, datamin, datamax

displayed range of data. Any limit set to a (default) value of None will autoscale.

plot(filename=None)

Plot the CellVariable as a contour plot.

plotMesh(filename=None)

The gistVectorViewer Module

class fipy.viewers.gistViewer.gistVectorViewer.GistVectorViewer(vars, title=None, limits={}, **kwlimits)

Bases: fipy.viewers.gistViewer.gistViewer._GistViewer

Displays a vector plot of a 2D rank-1 CellVariable or FaceVariable object using gist.

>>> from fipy import *
>>> mesh = Grid2D(nx=50, ny=100, dx=0.1, dy=0.01)
>>> x, y = mesh.getCellCenters()
>>> xyVar = CellVariable(mesh=mesh, name="x y", value=x * y)
>>> k = Variable(name="k", value=0.)
>>> viewer = GistVectorViewer(vars=sin(k * xyVar).getGrad(), 
...                 title="GistVectorViewer test")
>>> for kval in range(10):
...     k.setValue(kval)
...     viewer.plot()
>>> viewer._promptForOpinion()
>>> viewer = GistVectorViewer(vars=sin(k * xyVar).getFaceGrad(), 
...                 title="GistVectorViewer test")
>>> for kval in range(10):
...     k.setValue(kval)
...     viewer.plot()
>>> viewer._promptForOpinion()
>>> from fipy import *
>>> mesh = (Grid2D(nx=5, ny=10, dx=0.1, dy=0.1)
...         + (Tri2D(nx=5, ny=5, dx=0.1, dy=0.1) 
...          + ((0.5,), (0.2,))))
>>> x, y = mesh.getCellCenters()
>>> xyVar = CellVariable(mesh=mesh, name="x y", value=x * y)
>>> k = Variable(name="k", value=0.)
>>> viewer = GistVectorViewer(vars=sin(k * xyVar).getGrad(), 
...                 title="GistVectorViewer test")
>>> for kval in range(10):
...     k.setValue(kval)
...     viewer.plot()
>>> viewer._promptForOpinion()
>>> viewer = GistVectorViewer(vars=sin(k * xyVar).getFaceGrad(), 
...                 title="GistVectorViewer test")
>>> for kval in range(10):
...     k.setValue(kval)
...     viewer.plot()
>>> viewer._promptForOpinion()

Creates a GistVectorViewer.

Parameters :
vars

a rank-1 CellVariable or FaceVariable object.

title

displayed at the top of the Viewer window

limits : dict

a (deprecated) alternative to limit keyword arguments

xmin, xmax, ymin, ymax, datamin, datamax

displayed range of data. Any limit set to a (default) value of None will autoscale.

getArray()
plot(filename=None)

The gistViewer Module

The test Module

Test numeric implementation of the mesh