Preface
现在计划将LorenaABarba的《12 steps to Navier-Stokes》系列做一个诠释版。不做完全翻译版的目的是感觉现阶段我的翻译水平并不能完全驾驭作者想要表达的。为了不改变经典的原貌,只做部分注释。在这个过程中大家共同进步。
Introductions
Hello! Welcome to the 12 steps to Navier-Stokes. This is a practical module that is used in the beginning of an interactive Computational Fluid Dynamics (CFD) course taught by Prof. Lorena Barba since Spring 2009 at Boston University. The course assumes only basic programming knowledge (in any language) and of course some foundation in partial differential equations(偏微分方程)and fluid mechanics(流体力学). The practical module 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 taught entirely using Python and students who don’t know Python just learn as we work through the module.
This IPython notebook will lead you through the first step of programming your own Navier-Stokes solver in Python from the ground up(从头开始). We’re going to dive right in. Don’t worry if you don’t understand everything that’s happening at first, we’ll cover it in detail as we move forward and you can support your learning with the videos of Prof. Barba’s lectures on YouTube.(需要翻墙,视频中包含详细的推导过程)
For best results, after you follow this notebook, prepare your own code for Step 1, either as a Python script or in a clean IPython notebook.
To execute this Notebook, we assume you have invoked the notebook server using: ipython notebook.(原作者采用IPython,笔者采用Anaconda来替代,版本为Anaconda3,其中Python版本为3.5.1)
Step 1: 1-D Linear Convection
The 1-D Linear Convection equation(对流方程) is the simplest, most basic model that can be used to learn something about CFD. It is surprising that this little equation can teach us so much! Here it is:
With given initial conditions (understood as a wave), the equation represents the propagation of that initial wave with speed c , without change of shape. Let the initial condition be