CFD Python: 12 steps to Navier-Stokes
We announce the public release of online educational materials for self-learners of CFD using IPython Notebooks: the CFD Python Class on Bitbucket
This post describes the first practical module of Prof. Barba's Computational Fluid Dynamics class, as taught between 2010 and 2013 at Boston University. The module is called "12 steps to Navier-Stokes equations" (yes, it's a tongue-in-check allusion of the recovery programs for behavioral problems). It was inspired by the ideas of Dr. Rio Yokota, who was a post-doc in Barba's lab, and has been refined by Prof. Barba and her students over several semesters teaching the course.
The course is for beginners. It assumes only basic programming skills —the concepts of iterations, loops, function calls and so on— and builds immediate hands-on experience via this module and several others that come after. In the future, we hope to publish materials for the other modules also (e.g., convection schemes with Burgers equation, Euler equations and shock-tube problem, and others).
We use Python for this class, and those engineering students that are dependent on Matlab just have to bite the bullet and learn Python. (The reasons for this are many and would be subject for another blog post!)
Prof. Barba has a long track record of sharing educational materials freely online. Recordings of her lectures for the CFD course were made available first on iTunesU in 2010. Then, in 2012, she decided to use the flipped classroom model and re-posted the videos on YouTube, after editing for length and with some additions.
The new CFD Python Class Notebooks are her latest free online materials!
The simplest way to enjoy these materials is to view each lesson online (follow the links below), as rendered by the IPython Notebook Viewer. In that case, you could follow along and write your own version of the programs to run with your local Python installation.
But you can also download the whole collection of Notebooks from the CFD Python class Bitbucket repository. If you have a full distribution of the Python "ecosystem," then navigate to the directory where you've downloaded the collection, and launch IPython Notebook with:
ipython notebook --pylab inline
Description of the practical module
This module has been proved in the classroom for four consecutive years. It has brought several dozen students to develop their own 2D Navier-Stokes finite-difference solver from scratch in just over a month (with two class meetings per week). The module consists of the following steps (links are to the individual IPython Notebooks):
Steps 1–4 are in one dimension:
(i) linear convection with a step-function initial condition (IC) and appropriate boundary conditions (BC);
with the same IC/BCs:
(ii) nonlinear convection, and
(iii) diffusion only;
with a saw-tooth IC and periodic BCs
(iv) Burgers' equation.
Steps 5–10 are in two dimensions:
(v) linear convection with square function IC and appropriate BCs;
(vi) nonlinear convection, with the same IC/BCs
(vii) diffusion only, with the same IC/BCs;
(viii) Burgers' equation;
(ix) Laplace equation, with zero IC and both Neumann and Dirichlet BCs;
(x) Poisson equation in 2D.
Steps 11–12 solve the Navier-Stokes equation in 2D:
(xi) cavity flow;
(xii) channel flow.
Students are instructed to follow these steps one by one, without skipping any! The most important step is #1, in fact. Everything builds from there.
We know that self-learners around the world have already started following this "12-step program" using the videos on iTunesU and YouTube since 2010. In fact, at least two students have blogged about their experience: DaFeda in Norway (June 2011) and Sidafa Conde at UMass-Dartmouth (January 2012).
And clearly the contributions of Suraj Shankar to the Matlab Central file exchange were also result of his following the class online.
Prof. Barba often receives emails of appreciation from students in far-away places who are learning with her free online materials. And in 2012, she opened her CFD Piazza class to off-campus students, resulting in about 180 students "auditing" and participating in the online class discussions —this effort resulted in Prof. Barba being featured in the Piazza Blog as "Innovator of the Week" in April 2012.
We hope that the CFD IPython Notebooks will help a new cohort of students and self-learners gain basic CFD skills. Let us know what you think!
- Prof. Lorena Barba's educational program is supported by NSF via CAREER award #1149784