1 
% 
2 
% $Id: wave.tex 1318 20070926 04:39:14Z ksteube $ 
3 
% 
4 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
5 
% 
6 
% Copyright 20032007 by ACceSS MNRF 
7 
% Copyright 2007 by University of Queensland 
8 
% 
9 
% http://esscc.uq.edu.au 
10 
% Primary Business: Queensland, Australia 
11 
% Licensed under the Open Software License version 3.0 
12 
% http://www.opensource.org/licenses/osl3.0.php 
13 
% 
14 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
15 
% 
16 

17 
\section{RayleighTaylor Instability} 
18 
\label{LEVELSET CHAP} 
19 

20 
In this chapter we will implement the Level Set Method in Escript for tracking the interface between two fluids for Computational Fluid Dynamics (CFD). 
21 
Normally in Earth science problems two or more fluids in a system with different properties are of interest. For example, lava dome growth in volcanology, with the contrast of the two mediums as being lava and air. The interface between the two mediums is often referred to as a free surface (free boundary value problem); the problem arises due to the large differences in densities between the lava and air, with their ratio being around 2000, and so the interface between the two fluids move with respect to each other. 
22 
%and so the lava with the much higher density is able to move independently with respect to the air, and the interface between the two fluids is not constrained. 
23 
There are a number of numerical techniques to define and track the free surfaces. One of these methods, which is conceptually the simplest, is to construct a Lagrangian grid which moves with the fluid, and so it tracks the free surface. The limitation of this method is that it cannot track surfaces that break apart or intersect. Another limitation is that the elements in the grid can become severely distorted, resulting in numerical instability. The Arbitrary LagrangianEulerian (ALE) method for CFD in moving domains is used to overcome this problem by remeshing, but there is an overhead in computational time, and it results in a loss of accuracy due to the process of mapping the state variables every remesh by interpolation. 
24 

25 
There is a technique to overcome these limitations called the Level Set Method, for tracking interfaces between two fluids. The advantages of the method is that CFD can be performed on a fixed Cartesian mesh, and therefore problems with remeshing can be avoided. The field equations for calculating variables such as velocity and pressure are solved on the the same mesh. The Level Set Method is based upon the implicit representation of the interface by a continuous function. The function takes the form as a signed distance function, $\phi(x)$, of the interface in a Eulerian coordinate system. For example, the zero isocontour of the unit circle $\phi(x)=x^2 + y^2 1$ is the set of all points where $\phi(x)=0$. 
26 
% 
27 
\begin{figure} 
28 
\center 
29 
\scalebox{0.5}{\includegraphics{figures/unitcircle.eps}} 
30 
\caption{Implicit representation of the curve $x^2 + y^2 = 1$.} 
31 
\label{UNITCIRCLE} 
32 
\end{figure} 
33 
% 
34 
The implicit representation can be used to define the interior and exterior of a fluid region. Since the isocontour at $\phi(x)=0$ has been defined as the interface, a point in the domain can be determined if its inside or outside of the interface, by looking at the local sign of $\phi(x)$. A point is inside the interface when $\phi(x)<0$, and outside the interface when $\phi(x)>0$. Parameters values such as density and viscosity can then be defined for two different mediums, depending on which side of the interface they are located. The displacement of the interface at the zero isocontour of $\phi(x)$ is calculated each time step by using the velocity field. This is achieved my solving the advection equation: 
35 

36 
\begin{equation} 
37 
\frac{\partial \phi}{\partial t} + \vec{v} \cdot \nabla \phi = 0, 
38 
\label{ADVECTION} 
39 
\end{equation} 
40 

41 
where $\vec{v}$ is the velocity field. The advection equation is solved using a midpoint method, which is a two step procedure: 
42 

43 
Firstly, $\phi^{1/2}$ is calculated solving: 
44 

45 
\begin{equation} 
46 
\frac{\phi^{1/2}  \phi^{}}{dt/2} + \vec{v} \cdot \nabla \phi^{} = 0. 
47 
\label{MIDPOINT FIST} 
48 
\end{equation} 
49 

50 
Secondly, using $\phi^{1/2}$, $\phi^{+}$ is calculated solving: 
51 

52 
\begin{equation} 
53 
\frac{\phi^{+}  \phi^{}}{dt} + \vec{v} \cdot \nabla \phi^{1/2} = 0. 
54 
\label{MIDPOINT SECOND} 
55 
\end{equation} 
56 

57 
For more details on the midpoint procedure see reference \cite{BOURGOUIN2006}. In certain situations the midpoint procedure has been shown to produce artifacts in the numerical solutions. A more robust procedure is to use the TaylorGalerkin scheme with the presence of diffusion, which gives more stable solutions. The expression is derived by either inserting Equation (\ref{MIDPOINT FIST}) into Equation (\ref{MIDPOINT SECOND}), or by expanding $\phi$ into a Taylor series: 
58 

59 
\begin{equation} 
60 
\phi^{+} \simeq \phi^{} + dt\frac{\partial \phi^{}}{\partial t} + \frac{dt^2}{2}\frac{\partial^{2}\phi^{}}{\partial t^{2}}, 
61 
\label{TAYLOR EXPANSION} 
62 
\end{equation} 
63 

64 
by inserting 
65 

66 
\begin{equation} 
67 
\frac{\partial \phi^{}}{\partial t} =  \vec{v} \cdot \nabla \phi^{}, 
68 
\label{INSERT ADVECTION} 
69 
\end{equation} 
70 

71 
and 
72 

73 
\begin{equation} 
74 
\frac{\partial^{2} \phi^{}}{\partial t^{2}} = \frac{\partial}{\partial t}(\vec{v} \cdot \nabla \phi^{}) = \vec{v}\cdot \nabla (\vec{v}\cdot \nabla \phi^{}), 
75 
\label{SECOND ORDER} 
76 
\end{equation} 
77 

78 
into Equation \ref{TAYLOR EXPANSION} 
79 

80 
\begin{equation} 
81 
\phi^{+} = \phi^{}  dt\vec{v}\cdot \nabla \phi^{} + \frac{dt^2}{2}\vec{v}\cdot \nabla (\vec{v}\cdot \nabla \phi^{}). 
82 
\label{TAYLOR GALERKIN} 
83 
\end{equation} 
84 

85 

86 
The fluid dynamics is governed by the Stokes equations. 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 NavierStokes equations can be ignored. For a body force $f$ the governing equations are given by: 
87 

88 
\begin{equation} 
89 
\nabla \cdot (\eta(\nabla \vec{v} + \nabla^{T} \vec{v}))  \nabla p = f, 
90 
\label{GENERAL NAVIER STOKES} 
91 
\end{equation} 
92 

93 
with the incompressibility condition 
94 

95 
\begin{equation} 
96 
\nabla \cdot \vec{v} = 0. 
97 
\label{INCOMPRESSIBILITY} 
98 
\end{equation} 
99 

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

103 
\begin{equation} 
104 
(\eta(v\hackscore{i,j} + v\hackscore{j,i})),\hackscore{j}  p,\hackscore{i} = f\hackscore{i}, 
105 
\label{GENERAL NAVIER STOKES COM} 
106 
\end{equation} 
107 

108 
with the incompressibility condition 
109 

110 
\begin{equation} 
111 
v\hackscore{i,i} = 0. 
112 
\label{INCOMPRESSIBILITY COM} 
113 
\end{equation} 
114 

115 
The subscript $,i$ denotes the derivative of the function with respect to $x\hackscore{i}$. A linear relationship between the deviatoric stress $\sigma^{'}\hackscore{ij}$ and the stretching $D\hackscore{ij} = \frac{1}{2}(v\hackscore{i,j} + v\hackscore{j,i})$ is defined as \cite{GROSS2006}: 
116 

117 
\begin{equation} 
118 
\sigma^{'}\hackscore{ij} = 2\eta D^{'}\hackscore{ij}, 
119 
\label{STRESS} 
120 
\end{equation} 
121 

122 
where the deviatoric stretching $D^{'}\hackscore{ij}$ is defined as 
123 

124 
\begin{equation} 
125 
D^{'}\hackscore{ij} = D^{'}\hackscore{ij}  \frac{1}{3}D\hackscore{kk}\delta\hackscore{ij}. 
126 
\label{DEVIATORIC STRETCHING} 
127 
\end{equation} 
128 

129 
The $\delta\hackscore{ij}$ is the Kronecker $\delta$symbol, which is a matrix with ones for its diagonal entries ($i = j$) and zeros for the remaining entries ($i \neq j$). The body force $f$ in Equation (\ref{GENERAL NAVIER STOKES COM}) is the gravity acting in the $x\hackscore{3}$ direction and is given as $f = g \rho \delta\hackscore{i3}$. 
130 

131 
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. 
132 
In order to keep numerical stability, the time step size needs to be below a certain value, known as the Courant number. The Courant number is defined as: 
133 

134 
\begin{equation} 
135 
C = \frac{v \delta t}{h}. 
136 
\label{COURANT} 
137 
\end{equation} 
138 

139 
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 Courant number is taken to be 0.4 \cite{BOURGOUIN2006}. 
140 

141 
As the computation of the distance function progresses, it becomes distorted, and so it needs to be updated in order to stay regular. This process is known as the reinitialization procedure. The aim is to iteratively find a solution to the reinitialization equation: 
142 

143 
\begin{equation} 
144 
\frac{\partial \psi}{\partial \tau} + sign(\psi)(1  \nabla \psi) = 0. 
145 
\label{REINITIALISATION} 
146 
\end{equation} 
147 

148 
where $\tau$ is artificial time. This equation is solved to meet the definition of the level set function, $\lvert \nabla \psi \rvert = 1$; the normalization condition. However, it has been shown that in using this reinitialization procedure it is prone to mass loss and inconsistent positioning of the interface \cite{SUCKALE2008}. 
149 

150 
The RayleighTaylor instability problem is used as a benchmark to validate CFD implementations \cite{VANKEKEN1997}. Figure \ref{RT2DSETUP} shows the setup of the problem. A rectangular domain with two different fluids is considered, with the greater density fluid on the top and the lighter density fluid on the bottom. The viscosities of the two fluids are equal (isoviscos). An initial perturbation is given to the interface of $\phi=0.02cos(\frac{\pi x}{\lambda}) + 0.2$. The aspect ratio, $\lambda = L/H = 0.9142$, is chosen such that it gives the greatest disturbance of the fluids. 
151 

152 
\begin{figure} 
153 
\center 
154 
\scalebox{0.7}{\includegraphics{figures/RT2Dsetup.eps}} 
155 
\caption{Parameters, initial interface and boundary conditions for the RayleighTaylor instability problem. The interface is defined as $\phi=0.02cos(\frac{\pi x}{\lambda}) + 0.2$. The fluids have been assigned different densities and equal viscosity (isovisous).} 
156 
\label{RT2DSETUP} 
157 
\end{figure} 
158 

159 
%The Level Set Method can be applied to many areas of science, for example simulating subduction zones in geophysics, motion of bubbles, and flame propagation. Its also used in image processing. However, the Level Set Method does have limitations. The level set function can still become irregular after reinitialisation, leading to artifacts in the simulations, requiring more thought into the implementation of the reinitialisation step. 