We think that FiPy is well suited to teaching some aspects of computational materials science, either in a dedicated course on continuum methods, or in conjunction with other materials modeling techniques.

Specific Teaching Materials for Use with FiPy.

Prof. R. Edwin García, Purdue University: FiPy Examples

Prof. Daniel J. Lewis, Rensselaer Polytechnic Institute: FiPy Workbook

As a starting point, we've put together this page based on some discussions we've already had with a potential FiPy instructor. Please feel free to add questions, expand on our answers, or branch off new pages to explore particular ideas. Hopefully FiPy's existing suite of examples will form a solid foundation for any curriculum, but feel free to post new examples (or ask how to do them) that would be useful in your own class.

The base language is fortran 90 for the course. Matlab is another option that some of my colleagues have used. I assume that the whole course could be taught in FiPy but this would leave the students without a standard language experience. Perhaps that's not important.

Depending on the scope of the course, I'd say it's more accurate that the whole course could be taught in Python, with FiPy as an important element (i.e., I don't think FiPy would help you do an Ising model). There are a number of people working to make Python and its supporting libraries (NumPy, SciPy, Matplotlib, etc.) serve as a wholesale replacement for Matlab. I don't know if that job is complete (Matlab is obviously a very big and very mature software package), but it's significantly done.

There's an argument to be made that your students will better understand what's happening, and what the value of something like FiPy is, if they have to suffer through writing a few explicit finite difference codes in Fortran (much less suffering through writing their own implicit solvers). If you've got limited time to teach them any language, Fortran's not crucial; you could write all of the same algorithms in plain Python; it just wouldn't be very fast. It's the supporting libraries (written in C and Fortran) that make Python a viable scientific tool.

As to "standard language experience", I don't know whether that's important or not. I know a lot of engineers who feel that Matlab experience is crucial to put on a resume and a lot of scientists, particularly from a generation ago, who are dismissive of anything that's not done in Fortran. I learned computer programming so long ago, and have learned so many languages along the way, that I think it's more important to teach the logic and methodology of programming than it is to teach the syntax of any one particular language or software package. There are languages that I like and ones that I don't, but I can work productively in any of them, and I think that's probably the most important lesson you could teach in a programming class. Python is probably the cleanest and easiest to learn that I've come across, so given a limited amount of time, I think it's actually a good choice for a first language. Moreover, in many circles it is becoming a standard (most of google is done in Python; Python is a key tool in the operations and data management for Hubble; Lawrence Livermore has had a strong involvement in Python for many years).

Is there a free version of Python that will work on the PCs in our teaching lab?

Python is free (in both senses of the word) on all platforms. There are installers and source tarballs available at There is an integrated development environment called IDLE, along the lines of Microsoft's Visual Studio, included with Python distributions, although all that's strictly required is a command-line shell and a text editor. We've found that Windows users, in particular, tend to gravitate to IDLE as they no longer seem comfortable with the command line. I don't have much experience with IDLE, but it may lower the barrier to entry for a class of non-programmers.

Do the gnu compilers have Python?

As an interpreted language, Python sits apart from what's in gnu. Think of it more along the lines of Perl or Java or shell scripting. It's preinstalled on most unix systems, but you'd need to install it (for free) on Windows or on older Macs.

What would be a good learning tool for Python? Book or online.

The tutorial that comes with Python isn't bad, particularly when used in conjunction with the other official Python documentation.

I was writing productive code after a couple of hours with

Although I haven't worked through them in detail:

    author =    {Hans Petter Langtangen},
    title =     {{P}ython Scripting for Computational Science},
    publisher = {Springer-Verlag Berlin Heidelberg},
    year =      2004,
    author =    {Jaan Kiusalaas},
    title =     {Numerical Methods in Engineering with {P}ython},
    publisher = {Cambridge University Press},
    year =      2005,

Learning Python has been useful, too. It is very basic, but, provides a starting point for those who do not know python and don't like the brevity of the tutorial.

    author =    {Mark Lutz and David Ascher},
    title =     {Learning {P}ython, Second Edition},
    publisher = {O'Reilly},
    year =      200?,

Specific Teaching Materials for Use with FiPy.

Last modified 5 years ago Last modified on 09/11/09 11:52:05