examples.levelSet.electroChem.mayaviSurfactantViewer¶
Classes
|
The MayaviSurfactantViewer creates a viewer with the Mayavi python plotting package that displays a DistanceVariable. |
- class examples.levelSet.electroChem.mayaviSurfactantViewer.MayaviSurfactantViewer(distanceVar, surfactantVar=None, levelSetValue=0.0, title=None, smooth=0, zoomFactor=1.0, animate=False, limits={}, **kwlimits)¶
Bases:
AbstractViewer
The MayaviSurfactantViewer creates a viewer with the Mayavi python plotting package that displays a DistanceVariable.
Create a MayaviSurfactantViewer.
>>> from fipy import * >>> dx = 1. >>> dy = 1. >>> nx = 11 >>> ny = 11 >>> Lx = ny * dy >>> Ly = nx * dx >>> mesh = Grid2D(dx = dx, dy = dy, nx = nx, ny = ny) >>> # from fipy.models.levelSet.distanceFunction.distanceVariable import DistanceVariable >>> var = DistanceVariable(mesh = mesh, value = -1)
>>> x, y = mesh.cellCenters
>>> var.setValue(1, where=(x - Lx / 2.)**2 + (y - Ly / 2.)**2 < (Lx / 4.)**2) >>> var.calcDistanceFunction() >>> viewer = MayaviSurfactantViewer(var, smooth = 2) >>> viewer.plot() >>> viewer._promptForOpinion() >>> del viewer
>>> var = DistanceVariable(mesh = mesh, value = -1)
>>> var.setValue(1, where=(y > 2. * Ly / 3.) | ((x > Lx / 2.) & (y > Ly / 3.)) | ((y < Ly / 6.) & (x > Lx / 2))) >>> var.calcDistanceFunction() >>> viewer = MayaviSurfactantViewer(var) >>> viewer.plot() >>> viewer._promptForOpinion() >>> del viewer
>>> viewer = MayaviSurfactantViewer(var, smooth = 2) >>> viewer.plot() >>> viewer._promptForOpinion() >>> del viewer
- Parameters:
distanceVar (DistanceVariable) –
levelSetValue (float) – the value of the contour to be displayed
title (str) – displayed at the top of the Viewer window
animate (bool) – whether to show only the initial condition and the moving top boundary or to show all contours (Default)
limits (dict, optional) – a (deprecated) alternative to limit keyword arguments
xmin (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
xmax (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
ymin (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
ymax (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
zmin (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
zmax (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
datamin (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
datamax (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
- plotMesh(filename=None)¶
Display a representation of the mesh
- Parameters:
filename (str) – If not None, the name of a file to save the image into.
- setLimits(limits={}, **kwlimits)¶
Update the limits.
- Parameters:
limits (dict, optional) – a (deprecated) alternative to limit keyword arguments
xmin (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
xmax (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
ymin (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
ymax (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
zmin (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
zmax (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
datamin (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
datamax (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.