User login


You are here

Wonderful iPython notebooks/Jupyter based FEM learning materials

Check out Dr. Tim Fuller's work at

-- Biswajit


Ummm... Am not sure.

1. Notes-wise, there is a lot of material here, which is a good thing, but the course looks a bit too fast-paced to me. ... Depends on what the evaluation scheme is like: whether exams are extended time or open-book or not (or whether lengthy cheat-sheets/student's own hand-written notes are allowed or not), does homework count significantly in the final grades or not, the pre-requisites taken by the students, etc. In a typical Indian university, with closed-book exams and all, I am afraid, this kind of a pace will be too much for a typical undergraduate student to handle in an introductory (i.e. first) course on FEM.

2. Code-wise, it looks too intricate to me. I don't know if students are expected to understand or modify the code too, during the course. If so, I believe the code is too demanding.

Of course, there are a lot of optional ways as to how a code should be organized, and a bit of personal bias inevitably creeps in while reading someone else's code. And, yes, I will also readily admit that I am new to Python.

Still, I think, this code is a bit too complex to read. Of course, some of the linguistic weaknesses of Python obviously are responsible to a certain extent here. For instance, Python allows multiple returns and easy manipulation of tuples, both of which are very neat things, but if there are a lot of tuples being returned by functions, requiring a lot of intricate indexing on them on the return values but the indexing isn't obvious, then it probably also means that not enough number of small classes are present in the code.

As an example of a well-written Python code, I would point out to PySPH ( by Prabhu Ramachandran and several students (mostly master's students) at IIT Bombay. [I am still learning SPH, but that's a different matter :) .]

3. Yet, coming back to this iPython notebook, I do like the basic idea itself very much. Using Python (rather than Matlab etc.) is welcome, simply because Python is a far more comprehensive and general-purpose language; it's not just a matrix-manipulation script that grew too big. Also, the notes are amazingly well-compressed. For instance, the tables on different kinds of fluxes, the logical flow diagrams etc.

All in all, I would sure point out the site to students, but I don't think I will be able to use this material, in its present state, in an actual University course in India.

But then, I also don't find SfePy all well-suited for that purpose either.

Interesting idea, anyway---to use Python in university course. I am sure the material will evolve as the time goes and student/user feedback comes in. ... After all, one has to make a beginning somewhere, and in that sense, the material here has already a lot of very good points going for it.




What I find most amazing is the way Python can be used to nonnect so easily to web services.

I don't thing programming FEA codes is something that needs to be done by most students.   Very few mechanical/civil engineers actually need to write code at work.

-- Biswajit

Even if programming isn't necessary, still, stepping through someone's code helps, if it is small enough. It helps develop an appreciation of the underlying complexity. And, trying out a few modifications to an existing small piece of code can be done quite effortlessly. Trying out source code gives you something that a ready-made package will never give you. For instance, for FEM: the gimmicks implemented in stress recovery, the importance of regularity of shape in meshes, the insight into how the boundary conditions are really handled, etc. Matters like these remain very important in practical applications. And there is that satisfaction of having looked "under the hood."

The only trouble is, a code that is small enough to be comprehensible by the non-CS engineers, but is sizeable enough to implement a sufficient number of features, is hard to find (and in fact, also hard to design for).

At least for CFD, I have never a found a suitable code, and so, these days, I am trying to write something in that direction. However,  after trying my hand a little, I now realize how hard it is to find the right kind of programming abstractions. I could much more easily write a comparatively very large code full of features, or a very small code that does away with all classes and uses only arrays and so isn't reusable even from one chapter to the next, let alone be extensible/modifiable by students. The difficulty is in writing the intermediate kind of a code.

Here, as far as FEM is concerned, there indeed is a piece of a preliminary code that I find almost fitting the bill. I mean the code in Belegundu and Chandrupatla's text-book. Their input/output file-design is simple but surprisingly effective (and extensible), and the code is small enough to be easily understood (and built upon) by students. It would be nice if someone converts it into Python, using a few minimal number of classes (instead of using only the arrays and their indexing schemes). Also, mesh generators that have by now come in the public domain could be easily used to try more complicated geometries. (Their old mesh generator is too limited.)

On the CFD side, I didn't find anything similar. But the next time I teach FEM, guess I will sure translate (with classes) the BASIC code by Belegundu & Chandrupatla, and ask the students to at least step through it and try out various exercises with it.




Subscribe to Comments for "Wonderful iPython notebooks/Jupyter based FEM learning materials"

Recent comments

More comments


Subscribe to Syndicate