FiPy: A Finite Volume PDE Solver Using Python

Simple Windows Installation

These instructions are for the Windows XP and Windows 2000 platforms. Please see the more general the Installation Guide for detailed installation instructions. These instructions are not the only way to set up FiPy on a Windows OS but represent the most expedient way from our experience to have a usable installation up and running.

Note

These steps require downloading installation .exe binary files from various web sites. When given the choice to run (open) or save these files it is best to simply choose run (open).

Required Packages

Python

http://code.enthought.com/enthon/

We recommend the use of Enthought Python. This version of Python has some of the packages for FiPy already included. Download and install the latest version.

PySparse

http://sourceforge.net/project/showfiles.php?group_id=101403

Download and install the latest version of PySparse for Windows (pysparse-x.y.z.win32-py2.X.exe). Be sure to select the version compiled with the correct version of Python to match the Enthought Python installation.

FiPy

http://www.ctcms.nist.gov/fipy/download/

Download and unpack the zip file (FiPy-x.y.win32.zip). Run the FiPy installer FiPy-x.y.win32.exe, which is in the base FiPy-x.y directory.

Optional Packages

Gmsh

http://www.geuz.org/gmsh

If you wish to run examples that have unstructured meshes, it is necessary to install Gmsh. Download and unpack the latest version of Gmsh for Windows. Open the unpacked folder with a browser and copy the gmsh.exe file to C:\Python2X.

Note

This is a required package for superfill examples.

Warning

FiPy does not currently work with version 2.0 or higher of Gmsh. Be certain to use older versions.

PyVTK

http://www.ctcms.nist.gov/fipy/download/

If you wish to use MayaVi, PyVTK is a requirement. Download and install the latest version from the FiPy downloads page (PyVTK-x.y.z.win32.exe).

Note

This is a required package for superfill examples.

MayaVi

MayaVi comes with Enthought Python, so no installation steps need to be taken.

Note

This is a required step for superfill examples.

Using FiPy on Windows

Both the IDLE and Ipython environments are packaged with Enthought Python. Ipython is recommended over IDLE with some caveats that will be outlined below. Both of these environments will appear in the Windows Program menu after installation. The following videos may be useful for explaining the use of Ipython on Windows:

http://showmedo.com/videos/series?name=PythonIPythonSeries

Interactive Viewing

Ipython works well with Matplotlib, but does not seem to display the Mayavi viewer correctly. IDLE has problems with interactive viewing, but this can be remedied by the following:

  • Click on Start
  • Click on Programs
  • Click on Python 2.X (Enthought Edition)
  • Right click on IDLE (Python GUI) and click on Create Shortcut which creates IDLE (Python GUI)(2)
  • Right click on IDLE (Python GUI)(2)
  • Click on properties
  • Add the -n option to Target being sure to leave a space after the last quote and before -n
  • Drag and drop IDLE (Python GUI)(2) to the desktop to create an icon.

Testing

If you have a working copy of the source, not an installed version of FiPy , you can run the tests using Ipython from the base FiPy directory, by typing

>>> run setup.py test

in the Ipython shell. There does not seem to be a good way to run the tests using IDLE.

Running Examples

Running the FiPy examples can be problematic in Ipython as there seems to be a bug with the execution of the doctest environment. One way to overcome this is to extract the example doctests to regular script files using:

>>> run setup.py copy_script --From=path/to/doctest/script.py --To=script.py``

and then execute using:

>>> run script.py

You can edit python files with the edit command:

>>> edit script.py

Yoou can also use IDLE to run the examples. You can use the IDLE file browser to open the examples and run the module.

  • Click on File
  • Click on Open
  • Open C:\Path\To\Base\FiPy\directory\examples\diffusion\steadyState\mesh50x50\input.py

This will open an editor, press the F5 key to run the example. A matplotlib viewer should appear with rainbow stripes.

Another way to use FiPy examples is to import the example file and then run any functionality it may have. For example at the IDLE command line run the following code:

>>> import sys
>>> sys.path.append('C://Path//To//Base//FiPy//Directory')
>>> from examples.levelSet.electroChem.inputGold import runGold
>>> runGold(numberOfSteps = 100)

If you have installed the optional packages, a MayaVi viewer should appear with a trench filling simulation.

Cahn Hilliard

Cahn Hilliard

Dendrite

Phase Field

Superfill

Level Set