Let’s narrow down on the specification for our tsunami simulator:
- Parallel –The model will scale to hundreds of processors with nothing but pure Fortran code. This is not only important for speeding up the program and reducing compute time, but also for enabling very large simulations that otherwise wouldn’t fit into the memory of a single computer. With most modern laptops having at least four cores, you should be able to enjoy the fruits of your (parallel programming) labor.
- Extensible –Physics terms can be easily formulated and added to the solver. This is important for the general usability of the model. If we can design our computational kernel in the form of reusable classes and functions, we can easily add new physics terms as functional, parallel operators, following the approach by Damian Rouson (http://mng.bz/vxPq). This way, the technical implementation is abstracted inside these functions, and on a high level we’d program our equations much like we’d write them on a blackboard.
- Software library –This will provide a reusable set of classes and functions that can be used to build other parallel models.
- Documented –All software should be useful, and no user should have to guess what the author of the program intended. We’ll write and document our app in such way that the code can be easily read and understood.
- Discoverable online –Writing a program just for yourself is great for learning and discovery. However, software becomes truly useful when you can share it with others to solve their problems. The tsunami simulator and other projects developed in this book are all online at https://github.com/modern-fortran. Feel free to explore them and poke around, and we’ll dive together into the details as we work through this book.
By working through this book chapter by chapter, you’ll gain the experience of developing a fully featured parallel app from scratch. If it’s your first software project, I hope it excites your inner software developer and inspires you to go make something on your own. We’ll start the next chapter by setting up the development environment so that you can compile and run the minimal working version of the tsunami simulator.
As we build and run our simulator, we’ll mostly look at raw numbers and time step counts that it logs to the terminal. However, it’s both helpful and satisfying to be able to visualize the output of the model. We’ll do so every time we add a new piece to the simulator, which makes the solution different and more interesting. I provide Python scripts in the GitHub repository of the project so you can visualize the output yourself. Although it’s possible to create high-quality graphics directly from Fortran, it’s not as easy to do as it is with Python.