1. The equations for fluid motion

The goal of a flow solver

What does it mean to “solve” a flow problem? Well, it means that we find a vector flow field that satisfies (i.e solves) the Navier-stokes equations for a specific set of boundary conditions (in both time and space). The pressure field in the fluid may also be regarded as a part of the solution. This aspect is covered in a later chapter. Having access to the full four-dimensional (4D, space + time) flow field allows to compute interesting flow statistics like wind loads, mixing characteristics, flow transport properties, etc.

The equations for fluid motion

In order to achieve an algorithmic solver for flow problems, we must first have a mathematical description of fluid flows. A central result from the classical mechanics era are the Navier-Stokes equations for incompressible flows. In vector form (i.e. it has multiple components) they read,

𝐮t+(𝐮)𝐮=1ρp*+ν2𝐮,\frac{\partial \mathbf{u}}{\partial t} + \left(\mathbf{u} \cdot \nabla \right)\mathbf{u} = -\frac{1}{\rho}\nabla p^* + \nu \nabla^2 \mathbf{u},

with the constraint that,

𝐮=0.\nabla \cdot \mathbf{u} = 0.

Here, 𝐮(𝐱,t)\mathbf{u}(\mathbf{x},t) is the velocity vector as a function of space 𝐱={x,y,z}\mathbf{x} = \{x, y , z\} and time tt, ρ\rho is the fluid’s density, \nabla is the gradient operator, p*p^* the (scalar) pressure field in the fluid and ν\nu is the fluid’s kinematic viscosity. In this course we limit ourselves to solving for flows of incompressible fluids with a constant density and viscosity parameter. This leads us to introduce a modified pressure, p=p*ρp = \frac{p^*}{\rho}, so that we can forget about the density of the fluid.

because the computer does not understand vector mathematics, it will prove useful to decompose the equations into their scalar components. For the first velocity component (uxu_x) we write,

uxt+uxuxx+uyuxy+uzuxz=px+ν(2uxx2+2uxy2+2uxz2), \frac{\partial u_x}{\partial t} + u_x \frac{\partial u_x}{\partial x} + u_y \frac{\partial u_x}{\partial y} + u_z \frac{\partial u_x}{\partial z} = -\frac{\partial p}{\partial x} + \nu \left( \frac{\partial^2 u_x}{\partial x^2} + \frac{\partial^2 u_x}{\partial y^2} + \frac{\partial^2 u_x}{\partial z^2}\right) ,

and the other components follow analogous.

The goal of our flow solver

In science and engineering practice, efficient and feature-rich flow solvers are required. It appears that for each application, the discretization style, grid structure and algorithms are different. This indicates that there is not a single recipe to solve flow problems and there is no consensus on what is best. Because our goal is more didactical in nature than gaining fame by rivaling solvers such as Openfoam, our solver will aim to be “minimalistic”. Where we will prefer coding simplicity over features and the solver’s speed performance. However, we will also write our solver in a modular fashion, seperating its components so they may be improved later. The final chapter includes some suggestions.

Continue to Chapter 2

The marvelous design of this website is taken from Suckless.org