This master’s thesis explains how a 2D Navier-Stokes solver can be implemented. The numerical methods used, how the solver works and how it can be used to solve flow problems are documented in detail.
The Navier-Stokes equations have been solved numerically since the 1960s, and consequently there exists lots of codes. One problem with commercial codes is the difficulty in modifying the source code and make new software interacting with the codes. Open source codes have a quite steep learning curve and aim at professional activity in computational fluid dynamics (CFD). For educational purposes, and for numerical methods research, it is handy to have a quite simple code, written in a high-level (“Matlab-like”) language, supplied with a documentation of all numerical methods and “tricks” in the code. With such a simple code, one can learn the solution technology and quite easily extend the program to more advanced problems. This experience may be very valuable before approaching professional CFD codes.
The Navier-Stokes solver presented here is set up and run from a Python script, which gives much more control and “power”, but requires some programming skills from the user. The solver is restricted to rectangular domains, and the discretisation is based on finite differences. Both single- and two-phase laminar, incompressible flow can be simulated. Hopefully, this text will show how simple the programming can be to solve new problems with this solver.
A new method to reduce spurious currents caused by inaccurate surface tension is introduced. The method is built on the direction averaged curvature method.