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

pyMesh Package Documentation

This page contains the pyMesh Package documentation.

The cell Module

Cell within a mesh

class fipy.meshes.pyMesh.cell.Cell(faces, faceOrientations, id)

Cell within a mesh

Cell objects are bounded by Face objects.

Cell is initialized by Mesh

Parameters :
  • faces: list or tuple of bounding faces that define the cell
  • faceOrientations: list, tuple, or numerix.array of orientations (+/-1) to indicate whether a face points into this face or out of it. Can be calculated, but the mesh typically knows this information already.
  • id: unique identifier
getBoundingCells()
getCenter()

Return the coordinates of the Cell center.

getFaceIDs()
getFaceOrientations()
getFaces()

Return the faces bounding the Cell.

getID()

Return the id of this Cell.

getVolume()

Return the volume of the Cell.

The face Module

Face within a Mesh

class fipy.meshes.pyMesh.face.Face(vertices, id)

Face within a Mesh

Face objects are bounded by Vertex objects. Face objects separate Cell objects.

Face is initialized by Mesh

Parameters :
  • vertices: the Vertex points that bound the Face
  • id: a unique identifier
addBoundingCell(cell, orientation)

Add cell to the list of Cell objects which lie on either side of this Face.

getArea()

Return the area of the Face.

getCellDistance()

Return the distance between adjacent Cell centers.

getCellID(index=0)

Return the id of the specified Cell on one side of this Face.

getCells()

Return the Cell objects which lie on either side of this Face.

getCenter()

Return the coordinates of the Face center.

getID()
getNormal()

Return the unit normal vector

The face2D Module

1D (edge) Face in a 2D Mesh

class fipy.meshes.pyMesh.face2D.Face2D(vertices, id)

Bases: fipy.meshes.pyMesh.face.Face

1D (edge) Face in a 2D Mesh

Face2D is bounded by two Vertices.

Face is initialized by Mesh

Parameters :
  • vertices: the Vertex points that bound the Face
  • id: a unique identifier

The grid2D Module

2D rectangular Mesh

class fipy.meshes.pyMesh.grid2D.Grid2D(dx, dy, nx, ny)

Bases: fipy.meshes.pyMesh.mesh.Mesh

2D rectangular Mesh

Numbering system

nx=5

ny=3

Cells:

*************************************
*      *      *       *      *      *
* 10   * 11   * 12    * 13   * 14   *
*************************************
*      *      *       *      *      *
* 5    * 6    * 7     * 8    * 9    *
*************************************
*      *      *       *      *      *
* 0    * 1    * 2     * 3    * 4    *
*************************************

Faces (before reordering):

***15******16*****17******18****19***
*      *      *       *      *      *
32    33      34      35     36     37
***10******11*****12******13*****14**
*      *      *       *      *      *
26     27     28      29     30     31
***5*******6******7*******8******9***
*      *      *       *      *      *
20     21     22      23     24     25
***0*******1******2*******3******4***

Faces (after reordering):

***27******28*****29******30****31***
*      *      *       *      *      *
34     18     19      20     21     37
***5*******6******7*******8******9***
*      *      *       *      *      *
33     14     15      16     17     36
***0*******1******2*******3******4***
*      *      *       *      *      *
32     10     11      12     13     35
***22******23*****24******25*****26**

Vertices:

18*****19*****20******21*****22****23
*      *      *       *      *      *
*      *      *       *      *      *
12*****13*****14******15*****16****17
*      *      *       *      *      *
*      *      *       *      *      *
6******7******8*******9******10****11
*      *      *       *      *      *
*      *      *       *      *      *
0******1******2*******3******4******5

Grid2D is initialized by caller

Parameters :
  • dx: dimension of each cell in x direction
  • dy: dimension of each cell in y direction
  • nx: number of cells in x direction
  • ny: number of cells in y direction
getCellCenters()
getCellVolumes()
getFacesBottom()

Return list of faces on bottom boundary of Grid2D with the y-axis running from bottom to top.

getFacesLeft()

Return list of faces on left boundary of Grid2D with the x-axis running from left to right.

getFacesRight()

Return list of faces on right boundary of Grid2D with the x-axis running from left to right.

getFacesTop()

Return list of faces on top boundary of Grid2D with the y-axis running from bottom to top.

getPhysicalShape()

Return physical dimensions of Grid2D.

getShape()

Return cell dimensions Grid2D.

The mesh Module

Generic mesh class

Meshes contain cells, faces, and vertices.

class fipy.meshes.pyMesh.mesh.Mesh(cells, faces, interiorFaces, vertices)

Bases: fipy.meshes.common.mesh.Mesh

getExteriorFaces()

Return only the faces that have one neighboring cell.

getFaceOrientations()
getPhysicalShape()

Return physical dimensions of Mesh.

getScale()
setScale(scale)

The test Module

Test numeric implementation of the mesh

The vertex Module

Vertex within a Mesh

Vertices bound Faces.

class fipy.meshes.pyMesh.vertex.Vertex(coordinates)

Vertex is initialized by Mesh with its coordinates.

getCoordinates()

Return coordinates of Vertex.