1 
ahallam 
3003 

2 


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
3 


% 
4 


% Copyright (c) 20032010 by University of Queensland 
5 


% Earth Systems Science Computational Center (ESSCC) 
6 


% http://www.uq.edu.au/esscc 
7 


% 
8 


% Primary Business: Queensland, Australia 
9 


% Licensed under the Open Software License version 3.0 
10 


% http://www.opensource.org/licenses/osl3.0.php 
11 


% 
12 


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
13 



14 



15 



16 


The acoustic wave equation governs the propagation of pressure waves. Wave 
17 


types that obey this law tend to travel in liquids or gases where shear waves 
18 
ahallam 
3004 
or longitudinal style wave motion is not possible. An obvious example is sound 
19 
ahallam 
3003 
waves. 
20 



21 
ahallam 
3004 
The acoustic wave equation is defined as; 
22 
ahallam 
3003 
\begin{equation} 
23 


\nabla ^2 p  \frac{1}{c^2} \frac{\partial ^2 p}{\partial t^2} = 0 
24 


\label{eqn:acswave} 
25 


\end{equation} 
26 
ahallam 
3004 
where $p$ is the pressure, $t$ is the time and $c$ is the wave velocity. 
27 
ahallam 
3003 

28 
ahallam 
3004 
\section{The Laplacian in \esc} 
29 


The Laplacian opperator which can be written as $\Delta$ or $\nabla^2$ is 
30 


calculated via the divergence of the gradient of the object, which is in this 
31 


example $p$. Thus we can write; 
32 


\begin{equation} 
33 


\nabla^2 p = \nabla \cdot \nabla p = \frac{\partial^2 p}{\partial 
34 


x^2\hackscore{i}} 
35 


\label{eqn:laplacian} 
36 


\end{equation} 
37 


For the two dimensional case in Cartesian coordinates \refEq{eqn:laplacian} 
38 


becomes; 
39 


\begin{equation} 
40 


\nabla^2 p = \frac{\partial^2 p}{\partial x^2} 
41 


+ \frac{\partial^2 p}{\partial y^2} 
42 


\end{equation} 
43 
ahallam 
3003 

44 
ahallam 
3004 
In \esc the Laplacian is calculated using the divergence representation and the 
45 


intrinsic functions \textit{grad()} and \textit{trace()}. The fucntion 
46 


\textit{grad{}} will return the spatial gradients of an object. 
47 


For a rank 0 solution, this is of the form; 
48 


\begin{equation} 
49 


\nabla p = \left[ 
50 


\frac{\partial p}{\partial x \hackscore{0}}, 
51 


\frac{\partial p}{\partial x \hackscore{1}} 
52 


\right] 
53 


\label{eqn:grad} 
54 


\end{equation} 
55 


Larger ranked solution objects will return gradient tensors. For example, a 
56 


pressure field which acts in the directions $p \hackscore{0}$ and $p 
57 


\hackscore{1}$ would return; 
58 


\begin{equation} 
59 


\nabla p = \begin{bmatrix} 
60 


\frac{\partial p \hackscore{0}}{\partial x \hackscore{0}} & 
61 


\frac{\partial p \hackscore{1}}{\partial x \hackscore{0}} \\ 
62 


\frac{\partial p \hackscore{0}}{\partial x \hackscore{1}} & 
63 


\frac{\partial p \hackscore{1}}{\partial x \hackscore{1}} 
64 


\end{bmatrix} 
65 


\label{eqn:gradrank1} 
66 


\end{equation} 
67 
ahallam 
3003 

68 
ahallam 
3004 
\refEq{eqn:grad} corresponds to the Linear PDE general form value 
69 


$X$. Notice however that the gernal form contains the term $X \hackscore{i,j}$, 
70 


hence for a rank 0 object there is no need to do more than calculate the 
71 


gradient and submit it to the solver. In the case of the rank 1 or greater 
72 


object, it is nesscary to calculate the trace also. This is the sum of the 
73 


diagonal in \refeq{eqn:gradrank1}. 
74 



75 


Thus when solving for equations containing the Laplacian one of two things must 
76 


be completed. If the object \verb p is less than rank 1 the gradient is 
77 


calculated via; 
78 


\begin{verbatim} 
79 


gradient=grad(p) 
80 


\end{verbatim} 
81 


and if the object is greater thank or equal to a rank 1 tensor, the trace of 
82 


the gradient is calculated. 
83 


\begin{verbatim} 
84 


gradient=trace(grad(p)) 
85 


\end{verbatim} 
86 



87 


These valuse can then be submitted to the PDE solver via the general form term 
88 


$X$. The Laplacian is then computed in the solution process by taking the 
89 


divergence of $X$. 
90 



91 
ahallam 
3003 
\section{Numerical Solution Stability} 
92 
ahallam 
3004 
Unfortunately, the wave equation belongs to a class of equations called 
93 


\textbf{stiff} PDEs. These types of equations can be difficult to solve 
94 
ahallam 
3003 
numerically as they tend to oscilate about the exact solution and can 
95 
ahallam 
3004 
eventually fail. To counter this problem, explicitly stable schemes like 
96 


the backwards Euler method are required. There are two variables which must be 
97 


considered for stability when numerically trying to solve the wave equation. 
98 



99 


\begin{equation} \label{eqn:freqvel} 
100 


f=\frac{v}{\lambda} 
101 


\end{equation} 
102 



103 



104 


Velocity is one of these variables. For stability the 
105 
ahallam 
3003 
analytical wave must not propagate faster than the numerical wave is able to, 
106 


and in general, needs to be much slower than the numerical wave. 
107 


For example, a line 100m long is discretised into 1m intervals or 101 nodes. If 
108 


a wave enters with a propagation velocity of 100m/s then the travel time for 
109 


the wave between each node will be 0.01 seconds. The time step, must therefore 
110 


be significantly less than this. Of the order $10E4$ would be appropriate. 
111 



112 
ahallam 
3004 
The wave frequency content also plays a part in numerical stability. The 
113 


nyquistsampling theorem states that a signals bandwidth content will be 
114 


accurately represented when an equispaced sampling rate $f \hackscore{n}$ is 
115 


equal to or greater than twice the maximum frequency of the signal 
116 


$f\hackscore{s}$, or; 
117 


\begin{equation} \label{eqn:samptheorem} 
118 


f\hackscore{n} \geqslant f\hackscore{s} 
119 


\end{equation} 
120 


For example a 50Hz signal will require a sampling rate greater than 100Hz or 
121 


one sample every 0.01 seconds. The wave equation relies on a spatial frequency, 
122 


thus the sampling theorem in this case applies to the solution mesh spacing. In 
123 


this way, the frequency content of the input signal directly affects the time 
124 


discretisation of the problem. 
125 



126 


To accurately model the wave equation with high resolutions and velocities 
127 


means that very fine spatial and time discretisation is necessary for most 
128 


problems. 
129 


This requirement makes the wave equation arduous to 
130 
ahallam 
3003 
solve numerically due to the large number of time iterations required in each 
131 
ahallam 
3004 
solution. Models with very high velocities and frequencies will be the worst 
132 


effected by this problem. 
133 
ahallam 
3003 

134 


\section{Displacement Solution} 
135 


\sslist{example07a.py} 
136 



137 


We begin the solution to this PDE with the centred difference formula for the 
138 


second derivative; 
139 


\begin{equation} 
140 


f''(x) \approx \frac{f(x+h  2f(x) + f(xh)}{h^2} 
141 


\label{eqn:centdiff} 
142 


\end{equation} 
143 


substituting \refEq{eqn:centdiff} for $\frac{\partial ^2 p }{\partial t ^2}$ 
144 


in \refEq{eqn:acswave}; 
145 


\begin{equation} 
146 
ahallam 
3004 
\nabla ^2 p  \frac{1}{c^2h^2} \left[p\hackscore{(t+1)}  2p\hackscore{(t)} + 
147 


p\hackscore{(t1)} \right] 
148 
ahallam 
3003 
= 0 
149 


\label{eqn:waveu} 
150 


\end{equation} 
151 


Rearranging for $p_{(t+1)}$; 
152 


\begin{equation} 
153 
ahallam 
3004 
p\hackscore{(t+1)} = c^2 h^2 \nabla ^2 p\hackscore{(t)} +2p\hackscore{(t)}  
154 


p\hackscore{(t1)} 
155 
ahallam 
3003 
\end{equation} 
156 


this can be compared with the general form of the \modLPDE module and it 
157 
ahallam 
3004 
becomes clear that $D=1$, $X\hackscore{i,j}=c^2 h^2 \nabla ^2 p_{(t)}$ and 
158 


$Y=2p_{(t)}  p_{(t1)}$. 
159 
ahallam 
3003 

160 
ahallam 
3004 
The solution script is similar to other that we have created in previous 
161 


chapters. The general steps are; 
162 


\begin{enumerate} 
163 


\item The necessary libraries must be imported. 
164 


\item The domain needs to be defined. 
165 


\item The time iteration and control parameters need to be defined. 
166 


\item The PDE is initialised with source and boundary conditions. 
167 


\item The time loop is started and the PDE is solved at consecutive time steps. 
168 


\item All or select solutions are saved to file for visualisation lated on. 
169 


\end{enumerate} 
170 



171 


Parts of the script which warrant more attention are the definition of the 
172 


source, visualising the source, the solution time loop and the VTK data export. 
173 



174 


\subsection{Pressure Sources} 
175 


As the pressure is a scalar, one need only define the pressure for two 
176 


time steps prior to the start of the solution loop. Two known solutions are 
177 


required because the wave equation contains a double partial derivative with 
178 


respect to time. This is often a good opportunity to introduce a source to the 
179 


solution. This model has the source located at it's centre. The source should 
180 


be smooth and cover a number of samples to satisfy the frequency stability 
181 


criterion. Small sources will generate high frequency signals. Here, the source 
182 


is defined by a cosine function. 
183 


\begin{verbatim} 
184 


U0=0.01 # amplitude of point source 
185 


xc=[500,500] #location of point source 
186 


# define small radius around point xc 
187 


src_radius = 30 
188 


# for first two time steps 
189 


u=U0*(cos(length(xxc)*3.1415/src_radius)+1)*whereNegative(length(xxc)src_radi 
190 


us) 
191 


u_m1=u 
192 


\end{verbatim} 
193 


When using a rectangular domain 
194 



195 
ahallam 
3003 
\section{Acceleration Solution} 
196 


\sslist{example07b.py} 
197 



198 


An alternative method is to solve for the acceleration $\frac{\partial ^2 
199 


p}{\partial t^2}$ directly, and derive the the displacement solution from the 
200 


PDE solution. \refEq{eqn:waveu} is thus modified; 
201 


\begin{equation} 
202 


\nabla ^2 p  \frac{1}{c^2} a = 0 
203 


\label{eqn:wavea} 
204 


\end{equation} 
205 
ahallam 
3004 
and can be solved directly with $Y=0$ and $X=c^2 \nabla ^2 p\hackscore{(t)}$. 
206 
ahallam 
3003 
After each iteration the displacement is reevaluated via; 
207 


\begin{equation} 
208 
ahallam 
3004 
p\hackscore{(t+1)}=2p\hackscore{(t)}  p\hackscore{(t1)} + h^2a 
209 
ahallam 
3003 
\end{equation} 
210 



211 
ahallam 
3004 
For \esc, the acceleration solution is prefered as it allows the use of matrix 
212 


lumping. Lumping or mass lumping as it is sometimes known, is the process of 
213 


aggressively approximating the density elements of a mass matrix into the main 
214 


diagonal. The use of Lumping is motivaed by the simplicity of diagonal matrix 
215 


inversion. As a result, Lumping can significantly reduce the computational 
216 


requirements of a problem. 
217 
ahallam 
3003 

218 
ahallam 
3004 
To turn lumping on in \esc one can use the command; 
219 


\begin{verbatim} 
220 


mypde.getSolverOptions().setSolverMethod(mypde.getSolverOptions().LUMPING) 
221 


\end{verbatim} 
222 


It is also possible to check if lumping is set using; 
223 


\begin{verbatim} 
224 


print mypde.isUsingLumping() 
225 


\end{verbatim} 
226 



227 


\section{Stability Investigation} 
228 


It is now prudent to investigate the stability limitations of this problem. 
229 


First, we let the frequency content of the source be very small. If the radius 
230 


of the source which equals the wavelength is 5 meters, than the frequency is 
231 


the inverse of the wavelength The velocity is $c=380.0ms^{1}$ thus the source 
232 


frequency is $f\hackscore{r} = \frac{380.0}{5} = 76.0 Hz$. The sampling 
233 


frequency must be at least twice this. Assuming a rectangular equispaced grid, 
234 


the sampling interval is $\Delta x = \frac{1000.0}{400} = 2.5$ and the sampling 
235 


frequency $f\hackscore{s}=\frac{380.0}{2.5}=152$ this is just equal to the 
236 


required rate satisfying \refeq{eqn:samptheorem}. 
237 



238 



239 



240 


