[SciPy-user] FEM

Alexander Michael lxander.m@gmail....
Sun Mar 18 07:18:19 CDT 2007

On 3/16/07, Håkan Jakobsson <hakan.jakobsson@gmail.com> wrote:
> Hi list,
> Python/scipy newbie here. I'm currently writing my master's thesis in
> computational mathematics - discontinuous galerkin methods to be
> precise. I'v been doing all the numerics for my thesis in Matlab but
> stumbled upon Python and scipy by chance. As a little experiment I
> translated one of my solvers into Python using numpy, scipy and the
> pysparse packages, and I was very impressed with the effort/performance
> ratio. Now, to the point..
> If you're doing finite element analysis, what are you're experiences
> using Python? Do you use Python as your main development tool? In
> conjunction with C, Fortran? Is there any drawbacks with using Python
> for this type of work? Anything else?
> I hope I'm not asking to much here, but it would be really interesting
> to know a bit about what the situation's like. I think Python and scipy
> is really great, and now I'm trying to convince everyone else...
> Please, share with me your experiences.
> /Håkan J

I haven't built any FEM work in Python, but it looks like others have
given it a go (I remember seeing [1] and [2], for instance). If you
are building matrix-less solvers (i.e. you're not explicitly forming
the large sparse matrix for the whole system), then I think Python and
NumPy could potentially take you a long way. If you're solver requires
forming the complete sparse system matrix, then you'll need something
more than NumPy for the sparse matrix representation. PySparse looks
like a reasonable (but I haven't used it) candidate
(<http://pysparse.sourceforge.net/>). It provides iterative solvers
and access to SuperLU (I personally like UMFPACK as well, but the
matrix solver is secondary if this is not the focus of your research).
I've used PETSc and C++ in my pre-Python days for building FEM, but it
looks like some people have shoe-horned it into a Python-centric
environment (<http://www.cimec.org.ar/python/>). They also provide
access to ParMETIS, which may be helpful depending on your goals.

Honestly, though, if you are being productive in your current
computational environment and Matlab meets your peformance and
architectural requirements, then my *guess* would be that a switch to
Python will cost you a month of progress. If Matlab won't scale to the
size of problems you wish to solve, then you will need to move closer
to the metal and Python over something like SuperLU or PETSc (if you
need parallelization) will save you from working in C/C++ (and provide
a better development environment). If your goal is to build flexible
"end-user software," then I don't think Matlab will cut it
architecturally and you will need to switch to something else anyway.

[1] <http://www.python.org/pycon/papers/pysparse.html>
[2] <http://www.fenics.org/syfi/>

More information about the SciPy-user mailing list