Stokes Flow

In this section we will look at Computational Fluid Dynamics (CFD) to simulate the flow of fluid under the influence of gravity. The StokesProblemCartesian class will be used to calculate the velocity and pressure of the fluid. The fluid dynamics is governed by the Stokes equation. In geophysical problems the velocity of fluids are low; that is, the inertial forces are small compared with the viscous forces, therefore the inertial terms in the Navier-Stokes equations can be ignored. For a body force, $ f$, the governing equations are given by:

$\displaystyle \nabla \cdot (\eta(\nabla \vec{v} + \nabla^{T} \vec{v})) - \nabla p = -f,$ (59)

with the incompressibility condition

$\displaystyle \nabla \cdot \vec{v} = 0.$ (60)

where $ p$, $ \eta$ and $ f$ are the pressure, viscosity and body forces, respectively. Alternatively, the Stokes equations can be represented in Einstein summation tensor notation (compact notation):

$\displaystyle -(\eta(v\hackscore{i,j} + v\hackscore{j,i})),\hackscore{j} - p,\hackscore{i} = f\hackscore{i},$ (61)

with the incompressibility condition

$\displaystyle -v\hackscore{i,i} = 0.$ (62)

The subscript comma $ i$ denotes the derivative of the function with respect to $ x\hackscore{i}$. The body force $ f$ in Equation (1.65) is the gravity acting in the $ x\hackscore{3}$ direction and is given as $ f = -g \rho \delta\hackscore{i3}$. The Stokes equations is a saddle point problem, and can be solved using a Uzawa scheme. A class called StokesProblemCartesian in Escript can be used to solve for velocity and pressure; more detail on the class can be view in Chapter 6. In order to keep numerical stability, the time-step size needs to be kept below a certain value, to satisfy the Courant condition. The Courant number is defined as:

$\displaystyle C = \frac{v \delta t}{h}.$ (63)

where $ \delta t$, $ v$, and $ h$ are the time-step, velocity, and the width of an element in the mesh, respectively. The velocity $ v$ may be chosen as the maximum velocity in the domain. In this problem the time-step size was calculated for a Courant number of 0.4.

The following PYTHON script is the setup for the Stokes flow simulation, and is available in the example directory as 'fluid.py'. It starts off by importing the classes, such as the StokesProblemCartesian class, for solving the Stokes equation and the incompressibility condition for velocity and pressure. Physical constants are defined for the viscosity and density of the fluid, along with the acceleration due to gravity. Solver settings are set for the maximum iterations and tolerance; the default solver used is PCG. The mesh is defined as a rectangle, to represent the body of fluid. The gravitational force is calculated base on the fluid density and the acceleration due to gravity. The boundary conditions are set for a slip condition at the base of the mesh; fluid movement in the x-direction is free, but fixed in the y-direction. An instance of the StokesProblemCartesian is defined for the given computational mesh, and the solver tolerance set. Inside the while loop, the boundary conditions, viscosity and body force are initialized. The Stokes equation is then solved for velocity and pressure. The time-step size is calculated base on the Courant condition, to ensure stable solutions. The nodes in the mesh are then displaced based on the current velocity and time-step size, to move the body of fluid. The output for the simulation of velocity and pressure is then save to file for visualization.
\begin{python}
from esys.escript import *
import esys.finley
from esys.escript.l...
...u''%(t),vel=vel_mag,vec=velocity,pressure=pressure)
t = t+1.0
\par
\end{python}
The results from the simulation can be viewed with mayavi, by executing the following command:
\begin{python}
mayavi -d vel.00.vtu -m SurfaceMap
\end{python}
Colour coded scalar maps and velocity flow fields can be viewed by selecting them in the menu. The time-steps can be swept through to view a movie of the simulation. Figures 1.12 and 1.13 shows the simulation output. Velocity vectors and a colour map for pressure are shown. As the time progresses the body of fluid falls under the influence of gravity.

Figure 1.12: Simulation output for Stokes flow. Fluid body starts off as a rectangular shape, then progresses downwards under the influence of gravity. Color coded distribution represents the scalar values for pressure. Velocity vectors are displayed at each node in the mesh to show the flow field. Computational mesh used was 20$ \times $20 elements.
[t=1]\includegraphics[scale=0.25]{figures/stokes-fluid-t01} [t=20]\includegraphics[scale=0.25]{figures/stokes-fluid-t10} [t=30]\includegraphics[scale=0.25]{figures/stokes-fluid-t20} \includegraphics[scale=0.25]{figures/stokes-fluid-colorbar}
Figure 1.13: Simulation output for Stokes flow.
[t=40]\includegraphics[scale=0.25]{figures/stokes-fluid-t30} [t=50]\includegraphics[scale=0.25]{figures/stokes-fluid-t40} [t=60]\includegraphics[scale=0.25]{figures/stokes-fluid-t50} \includegraphics[scale=0.25]{figures/stokes-fluid-colorbar}
The view used here to track the fluid is the Lagrangian view, since the mesh moves with the fluid. One of the disadvantages of using the Lagrangian view is that the elements in the mesh become severely distorted after a period of time and introduce solver errors. To get around this limitation the Level Set Method can be used, with the Eulerian point of view for a fixed mesh.
esys@esscc.uq.edu.au