FiPy: A Finite Volume PDE Solver Using Python

Simple Mac OS X Installation

We present four comparatively simple routes to installing FiPy on Mac OS X. The Fink Installation procedure is appropriate if you are already familiar with the Fink package manager. Either EasyInstall or Enthought Python Edition will get FiPy running in a minumum number of steps. The Binary Installation procedure is the next most expedient if you have never heard of Fink or if you are not comfortable with it. Please see the more general the Installation Guide for detailed installation instructions. These instructions are not the only ways to set up FiPy on Mac OS X but represent the most expedient ways, from our experience, to have a usable installation up and running.

Attention!

You must have an administrator account to install most of the following packages.

EasyInstall

http://peak.telecommunity.com/DevCenter/EasyInstall

Note

Several packages installed with easy_install will need be automatically compiled, which requires that you install the Xcode Development Tools before proceding.

If Python and setuptools are already available, a minimally functional installation of FiPy can be obtained by issuing the commands:

$ easy_install numpy
$ easy_install matplotlib
$ easy_install pysparse
$ easy_install fipy

Some of the Optional Packages may also be available via easy_install, but not all are.

Enthought Python Edition

http://www.enthought.com/epd

This installer provides a very large number of useful scientific packages for Python, including Python, NumPy, SciPy, Matplotlib, and IPython.

Attention!

PySparse and FiPy are not presently included in EPD, so you will need to separately install them, either manually or via EasyInstall.

Binary Installation

Attention!

Choose this method if you have never heard of Fink or if you are not comfortable with it for any reason. Binary installation is the fastest way to get FiPy up and running, but may offer less flexibility in the long run.

Note

If you wish to view 3D models, the MayaVi viewer is required, which is best installed via Fink, so you should follow the Fink Installation instructions.

Pre-built binaries for many of the required packages are available at http://pythonmac.org/packages/py24-fat/.

Python

Python is pre-installed on Mac OS X, but installation of other packages is much easier if you upgrade to the latest version of python-2.4.X-XXXX-XX-XX.dmg from pythonmac (or possibly some variant on Universal-MacPython-2.4.X-XXXX-XX-XX.dmg). Your existing installation will not be harmed.

Note

Any command-line instructions that start with python will either need to be explicitly typed as /usr/local/bin/python or you will need to adjust your $path variable so that this version of python is found before the pre-installed version.

Note

Another option is ActivePython, which probably is the most heavily supported installation on the Mac, but seems to lack readline support, but these instructions

http://www.friday.com/bbum/2006/03/06/python-mac-os-x-and-readline/

worked for us.

NumPy

Download and install the latest version of numpy-X.XX-py2.4-macosx10.4.mpkg.zip from pythonmac.

matplotlib

In order to see simulation results, you will need a viewer. We recommend you download and install the latest version of matplotlib-X.XX.X-py2.4-macosx10.4.mpkg.zip from pythonmac.

matplotlib requires:

wxPython

Download and install the latest version of wxPythonX.X-osx-unicode-X.X.X.X-universal10.4-py2.4.dmg from pythonmac.

PySparse

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

Download and install the latest version of pysparse-X.XX.XXX.macosx-10.4-py24.dmg

FiPy

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

Download and unpack the source archive (FiPy-x.y.tar.gz).

From within the FiPy directory, execute the command-line instruction:

$ python setup.py build
$ sudo python setup.py install

Note

You may now choose to install Optional Packages or you may choose proceed directly to Using FiPy on Mac OS X.

Fink Installation

Attention!

Choose this method if you are already familiar with Fink or with Linux package managers in general (such as Debian packages or RPMs). Fink installation takes considerably longer than Binary Installation, but offers a wealth of other programs that can make it worthwhile.

The Fink package manager automatically handles the many intricate dependencies involved in building open source software. Fink is based on the Debian tools and the package manager model will be familiar to Linux users.

Xcode Development Tools

http://developer.apple.com/tools/xcode

Some required packages are not available from Fink as binaries, so you will need to have the developer tools for Mac OS X. They may already be installed in the /Developer/ directory, but a different version may be required by Fink; see the recommendations at http://fink.sourceforge.net/download

Note

Free registration with the Apple Developer Connection is required.

X11

Open the X11 application.

Set your $DISPLAY environment variable to :0.0.

Note

If the X11 application is not already present in the /Applications/Utilities/ directory, it should be available as an optional package on the OS installation media that came with your computer.

Fink

http://fink.sourceforge.net/download

Ensure that Fink is installed and up to date for your OS.

Note

The following steps have been tested with Fink 0.8.1 on Mac OS X 10.4 "Tiger". Variations may be necessary for other OS versions.

unstable tree

Follow the directions at http://www.finkproject.org/faq/usage-fink.php#unstable

Note

We recommend that you accept all defaults presented by fink selfupdate.

Note

"unstable" is not as scary as it sounds. The Fink administrators tend to be very conservative about what packages are designated "stable".

Remaining Fink packages

Execute the following commands from Terminal application (you can use xterm or any other terminal application of your choosing):

$ fink --use-binary-dist install python

Take note of the version of Python that gets installed (python --version). Many other packages, indicated by a "-pyXX" suffix, require you substitute the Python version. E.g., Python 2.4 takes "-py24", Python 2.5 takes "-py25", and so on:

$ fink --use-binary-dist install matplotlib-pyXX

Attention!

The matplotlib installation will automatically download and build a number of other packages. This process can take quite awhile. We recommend that you accept all defaults offered at the beginning of this process.

Note

If the installation of matplotlib-pyXX fails for some reason, we recommend you execute the install command again.

A few changes are needed to allow matplotlib to run:

$ mkdir ~/.matplotlib
$ curl http://matplotlib.sourceforge.net/matplotlibrc \
> ~/.matplotlib/matplotlibrc

You may now choose to either edit the "backend" configuration in ~/.matplotlib/matplotlibrc to read:

backend      : TkAgg

or you can install wxPython with:

$ fink --use-binary-dist install wxpython-pyXX

(the second choice takes awhile, as it needs to build things).

PySparse installation

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

Download and unpack the latest version of pysparse-X.XX.XXX.tar.gz

From within the PySparse directory, execute:

$ python setup.py build
$ sudo python setup.py install

FiPy installation

Install FiPy packages as explained above.

Note

You may now choose to install Optional Packages or you may choose proceed directly to Using FiPy on Mac OS X.

Optional Packages

IPython

http://ipython.scipy.org/

This interactive Python shell is nicer to use than the default, and integrates nicely with matplotlib. Download the source and follow the building and installation instructions for Mac OS X.

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 Mac OS X. Create a link on your $path or a shell alias that points to <Gmsh path>/Gmsh.app/Contents/MacOS/Gmsh.

Note

This is a required package for superfill examples.

MayaVi

MayaVi 1 is a requirement if you wish to view 3D problems or improve the viewing capabilities of the superfill examples. This is one package that is probably much easier to install via Fink than by hand. You might attempt to follow the instructions at http://mayavi.sourceforge.net/mwiki/BuildingVTKOnOSX but they are quite out of date and did not work for us.

If you have already followed the Fink Installation instructions, then you can go to the command line and type:

$ sudo apt-get install mayavi-pyXX

Note

MayaVi 1 is outdated and we hope to have compatilibiltiy with MayaVi 2 as soon as possible.

SciPy

http://www.scipy.org/

This is a very powerful set of tools that augments the capabilities of FiPy . Although not required for using FiPy , some tests will fail if it is not present:

  • If you followed the Binary Installation procedure, there are a few different choices for obtaining prebuilt binaries of SciPy, each with their own issues:

  • If you followed the Fink Installation procedure, then you should be able to type:

    $ sudo apt-get install scipy-pyXX
    

Note

You are now ready to proceed to Using FiPy on Mac OS X.

Using FiPy on Mac OS X

We do a substantial amount of our FiPy development on Mac OS X, so you can assume that it is well-tested on this platform. See Using FiPy for more information.

IDLE Environment

For those that are averse to the command line, the IDLE environment is installed by the pythonmac Python installer and will appear in the MacPython 2.4 folder of the Applications folder.

Note

We are not aware of a Fink package for IDLE.

Attention!

We have no experience with using the IDLE environment on Mac OS X, but the following steps do work.

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

  • Open the IDLE application, located in /Applications/MacPython 2.4/
  • Select the Python Shell window. You can close the Console window if it appears.
  • Choose File > Open
  • Select /Path/To/Base/FiPy/Directory/examples/diffusion/mesh1D.py and click the Open button

The script will open in an editor window.

  • Choose Run > Run Module

A matplotlib viewer should appear and the Python Shell should prompt you through a series of examples.

Cahn Hilliard

Cahn Hilliard

Dendrite

Phase Field

Superfill

Level Set