In this chapter, we’ll implement the minimal working version of the tsunami simulator. For simplicity, we’ll start by simulating the movement of water in space due to background flow, without changing its shape. This problem is sufficiently complex to introduce basic elements of Fortran: numeric data types, declaration, arithmetic expressions and assignment, and control flow. Once we successfully simulate the movement of an object in this chapter, we’ll refactor the code to add other physics processes in chapters 3 and 4, which will allow the simulated water to flow more realistically. Implementing the other processes will be easier because we’ll be able to reuse much of the code that we’ll write in this chapter.
We’ll start off by compiling, linking, and running your first Fortran program. Then I’ll introduce the physical problem that we want to solve and show you how to express it in the form of a computer program. We’ll then dive into the essential elements of Fortran: data types, declaration, arithmetic, and control flow. At the end of the chapter, you’ll have the working knowledge to write basic, yet useful, Fortran programs.