source: anuga_work/publications/linuxconf_2006/paper_ole_nielsen.tex @ 7077

Last change on this file since 7077 was 4128, checked in by steve, 18 years ago

Changed to code a few python commands

File size: 22.0 KB
Line 
1% Use the standard \LaTeXe\ article style in 12pt Computer Modern font
2% on A4 paper by
3\documentclass[12pt,a4paper]{article}
4% Do \emph{not} change the width nor the height of the text from the
5% defaults set by this document class.
6%
7% The alternative which is closer to what we actually use is
8% \documentclass[11pt,a5paper]{article}
9% \usepackage[a5paper]{geometry}
10% Because it is a great size for on screen reading
11% and prints nicely on a4paper either 2up or booklet.
12
13% The preamble is to contain your own \LaTeX\ commands and to say
14% what packages to use.  Three useful packages are the following:
15\usepackage{graphicx} % avoid epsfig or earlier such packages
16\usepackage{url}      % for URLs and DOIs
17\newcommand{\doi}[1]{\url{http://dx.doi.org/#1}}
18\usepackage{amsmath}  % many want amsmath extensions
19\usepackage{amsfonts}
20\usepackage{underscore}
21% Avoid loading unused packages (as done by some \LaTeX\ editors).
22
23% Create title and authors using \verb|\maketitle|.  Separate authors by
24% \verb|\and| and put addresses in \verb|\thanks| command with
25% \verb|\url| command \verb|\protect|ed.
26\title{Open Source Software for Computational Modelling of Fluid Flow}
27
28\author{
29O.~M.~Nielsen\thanks{Risk Assessment Methods Project, Geospatial and
30Earth Monitoring Division, Geoscience Australia, Symonston,
31\textsc{Australia}. \protect\url{mailto:Ole.Nielsen@ga.gov.au}}\footnotemark[1]
32\and
33S.~G.~Roberts\thanks{Department of Mathematics, Australian National University,
34Canberra, \textsc{Australia}. \protect\url{mailto:stephen.roberts@anu.edu.au}}}
35
36\date{28 December 2006}
37
38\newcommand{\AnuGA}{\textsc{Anuga}}
39\newcommand{\Python}{\textsc{Python}}
40\newcommand{\VPython}{\textsc{VPython}}
41\newcommand{\pypar}{\textsc{mpi}}
42\newcommand{\Metis}{\textsc{Metis}}
43\newcommand{\mpi}{\textsc{mpi}}
44
45\newcommand{\UU}{\mathbf{U}}
46\newcommand{\VV}{\mathbf{V}}
47\newcommand{\EE}{\mathbf{E}}
48\newcommand{\GG}{\mathbf{G}}
49\newcommand{\FF}{\mathbf{F}}
50\newcommand{\HH}{\mathbf{H}}
51\newcommand{\SSS}{\mathbf{S}}
52\newcommand{\nn}{\mathbf{n}}
53
54\newcommand{\code}[1]{\texttt{#1}}
55
56
57
58\begin{document}
59
60% Use default \verb|\maketitle|.
61\maketitle
62
63% Use the \verb|abstract| environment.
64\begin{abstract}
65Modelling the effects on the built environment of natural hazards such
66as riverine flooding, storm surges and tsunami is critical for
67understanding their economic and social impact on our urban
68communities.  Geoscience Australia and the Australian National
69University have developed a hydrodynamic inundation modelling tool
70called \AnuGA{} to help simulate the impact of these hazards.
71The core of \AnuGA{} is a \Python{} implementation of a finite-volume method
72for solving the conservative form of the Shallow Water Wave equation.
73In this paper we describe the model, the architecture and some applications.
74ANUGA has recently been released as Open Source to enable
75free access to the software and allow the scientific community to
76use, validate and contribute to the software in the future.
77
78%This method allows the study area to be represented by an unstructured
79%mesh with variable resolution to suit the particular problem.  The
80%conserved quantities are water level (stage) and horizontal momentum.
81%An important capability of ANUGA is that it can robustly model the
82%process of wetting and drying as water enters and leaves an area. This
83%means that it is suitable for simulating water flow onto a beach or
84%dry land and around structures such as buildings.
85
86
87\end{abstract}
88
89% By default we include a table of contents in each paper.
90%\tableofcontents
91
92% Use \verb|\section|, \verb|\subsection|, \verb|\subsubsection| and
93% possibly \verb|\paragraph| to structure your document.  Make sure
94% you \verb|\label| them for cross-referencing with \verb|\ref|\,.
95
96%\clearpage
97\section{Introduction}
98\label{sec:intro}
99
100The Indian Ocean tsunami on 26 December 2004 demonstrated the
101potentially catastrophic consequences of natural hazards.  While the
102scale of the impact from such events is not common, smaller-scale
103tsunami regularly threaten coastal communities
104around the world. Earthquakes which occur in the Java Trench near
105Indonesia (e.g.~\cite{TsuMIS1995} or \cite{Baldwin-2006}) and along
106the Puysegur Ridge to the south of New Zealand (e.g.~\cite{LebKC1998})
107have potential to generate tsunami that may threaten Australia's
108northwestern and southeastern coastlines. In addition, the
109preferential development of Australian coastal corridors means that
110inundation from hydrological disasters such as tsunami or storm-surge
111of even a few hundred metres beyond the shoreline has increased
112potential to cause significant disruption and loss. The extent of
113inundation is critically linked to the event, tidal conditions,
114bathymetry and topography and it not feasible to make impact
115predictions using heuristics alone.
116
117Hydrodynamic modelling allows impacts from flooding, storm-surge and
118tsunami to be better understood, their impacts to be anticipated and,
119with appropriate planning, their effects to be mitigated.  Geoscience
120Australia in collaboration with the Mathematical Sciences Institute,
121Australian National University, is developing a software application
122called \AnuGA{} to model the hydrodynamics of floods, storm surges and
123tsunami. These hazards are modelled using the conservative shallow
124water equations which are described in section~\ref{sec:model}. In
125\AnuGA{} these equations are solved using a finite volume method as
126described in section~\ref{sec:fvm}.  A more complete discussion of the
127method can be found in \cite{modsim2005} where the model and solution
128technique is validated on a standard tsunami benchmark data set.
129Section~\ref{sec:software} describes the software implementation and
130the API while section~\ref{sec:validation} presents some
131validation results.
132
133
134\section{Model}
135\label{sec:model}
136
137The shallow water wave equations are a system of differential
138conservation equations which describe the flow of a thin layer of
139fluid over terrain. The form of the equations are:
140\[
141\frac{\partial \UU}{\partial t}+\frac{\partial \EE}{\partial
142x}+\frac{\partial \GG}{\partial y}=\SSS
143\]
144where $\UU=\left[ {{\begin{array}{*{20}c}
145 h & {uh} & {vh} \\
146\end{array} }} \right]^T$ is the vector of conserved quantities; water depth
147$h$, $x$-momentum $uh$ and $y$-momentum $vh$. Other quantities
148entering the system are bed elevation $z$ and stage (absolute water
149level) $w$, where the relation $w = z + h$ holds true at all times.
150The fluxes in the $x$ and $y$ directions, $\EE$ and $\GG$ are given
151by
152\[
153\EE=\left[ {{\begin{array}{*{20}c}
154 {uh} \hfill \\
155 {u^2h+gh^2/2} \hfill \\
156 {uvh} \hfill \\
157\end{array} }} \right]\mbox{ and }\GG=\left[ {{\begin{array}{*{20}c}
158 {vh} \hfill \\
159 {vuh} \hfill \\
160 {v^2h+gh^2/2} \hfill \\
161\end{array} }} \right]
162\]
163and the source term (which includes gravity and friction) is given
164by
165\[
166\SSS=\left[ {{\begin{array}{*{20}c}
167 0 \hfill \\
168 -{gh(z_{x} + S_{fx} )} \hfill \\
169 -{gh(z_{y} + S_{fy} )} \hfill \\
170\end{array} }} \right]
171\]
172where $S_f$ is the bed friction. The friction term is modelled using
173Manning's resistance law
174\[
175S_{fx} =\frac{u\eta ^2\sqrt {u^2+v^2} }{h^{4/3}}\mbox{ and }S_{fy}
176=\frac{v\eta ^2\sqrt {u^2+v^2} }{h^{4/3}}
177\]
178in which $\eta$ is the Manning resistance coefficient.
179
180As demonstrated in our papers, \cite{modsim2005,Rob99l} these
181equations provide an excellent model of flows associated with
182inundation such as dam breaks and tsunamis.
183
184\section{Finite Volume Method}
185\label{sec:fvm}
186
187We use a finite-volume method for solving the shallow water wave
188equations \cite{Rob99l}. The study area is represented by a mesh of
189triangular cells as in Figure~\ref{fig:mesh} in which the conserved
190quantities of  water depth $h$, and horizontal momentum $(uh, vh)$,
191in each volume are to be determined. The size of the triangles may
192be varied within the mesh to allow greater resolution in regions of
193particular interest.
194
195\begin{figure}
196\begin{center}
197\includegraphics[width=5.0cm,keepaspectratio=true]{step-five}
198\caption{Triangular mesh used in our finite volume method. Conserved
199quantities $h$, $uh$ and $vh$ are associated with the centroid of
200each triangular cell.} \label{fig:mesh}
201\end{center}
202\end{figure}
203
204The equations constituting the finite-volume method are obtained by
205integrating the differential conservation equations over each
206triangular cell of the mesh. Introducing some notation we use $i$ to
207refer to the $i$th triangular cell $T_i$, and ${\cal N}(i)$ to the
208set of indices referring to the cells neighbouring the $i$th cell.
209Then $A_i$ is the area of the $i$th triangular cell and $l_{ij}$ is
210the length of the edge between the $i$th and $j$th cells.
211
212By applying the divergence theorem we obtain for each volume an
213equation which describes the rate of change of the average of the
214conserved quantities within each cell, in terms of the fluxes across
215the edges of the cells and the effect of the source terms. In
216particular, rate equations associated with each cell have the form
217$$
218 \frac{d\UU_i }{dt}+ \frac1{A_i}\sum\limits_{j\in{\cal N}(i)} \HH_{ij} l_{ij} = \SSS_i
219$$
220where
221\begin{itemize}
222\item $\UU_i$ the vector of conserved quantities averaged over the $i$th cell,
223\item $\SSS_i$ is the source term associated with the $i$th cell,
224and
225\item $\HH_{ij}$ is the outward normal flux of
226material across the \textit{ij}th edge.
227\end{itemize}
228
229
230%\item $l_{ij}$ is the length of the edge between the $i$th and $j$th
231%cells
232%\item $m_{ij}$ is the midpoint of
233%the \textit{ij}th edge,
234%\item
235%$\mathbf{n}_{ij} = (n_{ij,1} , n_{ij,2})$is the outward pointing
236%normal along the \textit{ij}th edge, and The
237
238The flux $\HH_{ij}$ is evaluated using a numerical flux function
239$\HH(\cdot, \cdot ; \ \cdot)$ which is consistent with the shallow
240water flux in the sense that for all conservation vectors $\UU$ and normal vectors $\nn$
241$$
242H(\UU,\UU;\ \nn) = \EE(\UU) n_1 + \GG(\UU) n_2 .
243$$
244
245Then
246$$
247\HH_{ij}  = \HH(\UU_i(m_{ij}),
248\UU_j(m_{ij}); \mathbf{n}_{ij})
249$$
250where $m_{ij}$ is the midpoint of the \textit{ij}th edge and
251$\mathbf{n}_{ij}$ is the outward pointing normal, with respect to the $i$th cell, on the
252\textit{ij}th edge. The function $\UU_i(x)$ for $x \in
253T_i$ is obtained from the vector $\UU_k$ of conserved average values for the $i$th and
254neighbouring  cells.
255
256We use a second order reconstruction to produce a piece-wise linear
257function construction of the conserved quantities for  all $x \in
258T_i$ for each cell (see Figure~\ref{fig:mesh:reconstruct}. This
259function is allowed to be discontinuous across the edges of the
260cells, but the slope of this function is limited to avoid
261artificially introduced oscillations.
262
263Godunov's method (see \cite{Toro-92}) involves calculating the
264numerical flux function $\HH(\cdot, \cdot ; \ \cdot)$ by exactly
265solving the corresponding one dimensional Riemann problem normal to
266the edge. We use the central-upwind scheme of \cite{KurNP2001} to
267calculate an approximation of the flux across each edge.
268
269\begin{figure}
270\begin{center}
271\includegraphics[width=5.0cm,keepaspectratio=true]{step-reconstruct}
272\caption{From the values of the conserved quantities at the centroid
273of the cell and its neighbouring cells, a discontinuous piecewise
274linear reconstruction of the conserved quantities is obtained.}
275\label{fig:mesh:reconstruct}
276\end{center}
277\end{figure}
278
279In the computations presented in this paper we use an explicit Euler
280time stepping method with variable timestepping adapted to the
281observed CFL condition.
282
283
284\section{Software Implementation}
285\label{sec:software}
286
287\AnuGA{} is mostly written in the object-oriented programming
288language \Python{} with computationally intensive parts implemented
289as highly optimised shared objects written in C.
290
291\Python{} is known for its clarity, elegance, efficiency and
292reliability. Complex software can be built in \Python{} without undue
293distractions arising from idiosyncrasies of the underlying software
294language syntax. In addition, \Python{}'s automatic memory management,
295dynamic typing, object model and vast number of libraries means that
296software can be produced quickly and can be readily adapted to
297changing requirements throughout its lifetime.
298
299The fundamental object in \AnuGA{} is the \code{Domain} which
300inherits functionality from a hierarchy of increasingly specialised
301classes starting with a basic structural Mesh to classes implementing
302the finite-volume scheme described in section \ref{sec:fvm}. Other classes
303are \code{Quantity} which represents values of one variable across the mesh
304along with their associated operations, \code{Geospatial_data} which
305represents georeferenced elevation data and a collection of \code{Boundary}
306classes which allows for a 'pluggable' way of driving the model.
307The conserved quantities updated automatically by the numerical scheme
308are stage (water level) $w$, $x$-momentum $uh$ and $y$-momentum
309$vh$. The quanitites elevation $z$ and friction $\eta$ are
310quantities that are not updated automatically but can be changed explicitly
311during run-time if the user wishes to do so.
312
313To set up a scenario the user specifies the study area along with any internal
314regions where increased mesh resolution is required. External edges may
315be labelled using symbolic tags which are subsequently used to bind
316boundary condition objects to tagged segments of the mesh boundary.
317The mesh is then generated using \AnuGA{}'s built-in mesh generator and
318converted into the \code{Domain} object which provides all methods used to
319setup and run the flow simulation. Figure \ref{fig:anuga mesh} shows an example of a mesh generated by \AnuGA{}.
320\begin{figure}
321\begin{center}
322\includegraphics[width=4in,keepaspectratio=true]{tsunami-fig-1}
323\caption{Triangular mesh used in our finite volume method. Conserved
324quantities $h$, $uh$ and $vh$ are associated with each triangular cell.}
325\label{fig:anuga mesh}
326\end{center}
327\end{figure}
328
329
330
331Next step is to setup initial conditions for each \code{Quantity} object. For
332the elevation $z$ this is typically obtained from bathymetric and
333topographic data sets. Setting initial values for quantities is done
334through the method \code{domain.set_quantity(name, X, location,
335region)} where name is the name of the quantity (e.g.\ 'stage',
336'xmomentum', 'ymomentum', 'elevation' or 'friction').  The variable X
337represents the source data for populating the quantity and may take
338one of the following forms:
339
340\begin{itemize}
341\item A constant value as in \code{domain.set_quantity('stage', 1)} which
342will set the initial water level to 1 m everywhere.
343\item Another quantity or a linear combination of quantities.  If \code{q1}
344and \code{q2} are two arbitrary quantities defined within the same domain,
345the expression \code{domain.set_quantity('stage', q1*(3*q2 + 5))} will set the stage
346quantity accordingly.  One common application of this would be to
347assign the stage as a constant depth above the bed elevation.
348\item An arbitrary function (or a callable object), \code{f(x, y)}, where \code{x}
349and \code{y} are assumed to be vectors. The quantity will be assigned values by
350evaluating \code{f} at each location within the mesh.
351\item An arbitrary set of points and associated values (wrapped into a
352Geospatial_data object). The points need not coincide with triangle
353vertices or centroids and a penalised least squares technique is
354employed to populate the quantity in a smooth and stable way.
355Since the least squares technique can be time consuming for large
356problems, \code{set_quantity} employs a caching technique which automatically
357decides whether to perform the computations or retrieve them from a
358cache.  This will typically speed up the build by several orders of
359magnitude after each computation has been performed once.
360\item A filename containing points and attributes.
361\item A Numerical Python array (or a list of numbers) ordered
362according to the internal data structure.
363\end{itemize}
364The parameter \code{location} determines whether the values should be
365assigned to triangle edge, midpoints or vertices and \code{region} allows the
366operation to be restricted to a region specified by a symbolic tag or
367a set of indices.
368
369Boundary conditions are bound to symbolic tags through the method
370\code{domain.set_boundary} which takes as input a lookup table (implemented
371as a Python dictionary) of the form \code{\{tag:~boundary_object\}}.
372The boundary objects are all assumed to be callable functions of vectors x
373and y.  Several predefined standard boundary objects are available and
374it is relatively straightforward to define problem-specific custom
375boundaries if needed.  The predefined boundary conditions include
376Dirichlet, Reflective, Transmissive, Temporal, and Spatio-Temporal
377boundaries.
378
379Forcing terms can be written according to a fixed protocol and added
380to the model using the idiom \code{domain.forcing_terms.append(F)} where \code{F} is
381assumed to be a user-defined callable object.
382
383When the simulation is running, the length of each time step is
384determined from the maximal speeds encountered and the sizes of
385triangles in order not to violate the CFL condition which specifies
386that no information should skip any triangles in one time step.  With
387large speeds and small triangles, time steps can become very small.
388In order to access the state of the simulation at regular time
389intervals, \AnuGA{} uses the method evolve:
390\begin{verbatim}
391For t in domain.evolve(yieldstep, duration):
392    <model interrogation and modification>
393\end{verbatim}
394The parameter \code{duration} specifies the time period over which
395evolve operates, and control is passed to the body of the for-loop at
396each fixed time step called \code{yieldstep}.  The internal workings
397of the numerical scheme and its variable time stepping are thus
398decoupled from the fixed time stepping of the evolve loop.  This means
399that the user of the API may access the model at fixed timesteps to
400e.g.\ store model outputs, interrogate quantities or change the model
401itself at runtime. The evolve method has been implemented using a
402Python generator hence the reference to 'yield' in the parameter name.
403
404Figure \ref{fig:beach runup} shows a simulation of water flowing onto a
405hypothetical beach with obstacles.
406A number of complex patterns are captured in this example including a shock where water reflected off the wall far (at the right hand side) meets the main flow. Other physical features are the standing waves and interference patterns.
407See the \AnuGA{} User Manual at \url{http://sourceforge.net/projects/anuga} for more details and examples.
408\begin{figure}
409\begin{center}
410\includegraphics[width=4in,keepaspectratio=true]{tsunami-fig-2}
411\caption{A hypothetical runup scenario.}
412\label{fig:beach runup}
413\end{center}
414\end{figure}
415
416
417
418\section{Validation}
419\label{sec:validation} The process of validating the \AnuGA{}
420application is in its early stages, however initial indications are
421encouraging.
422
423As part of the Third International Workshop on Long-wave Runup
424Models in 2004 (\url{http://www.cee.cornell.edu/longwave}), four
425benchmark problems were specified to allow the comparison of
426numerical, analytical and physical models with laboratory and field
427data. One of these problems describes a wave tank simulation of the
4281993 Okushiri Island tsunami off Hokkaido, Japan \cite{MatH2001}. A
429significant feature of this tsunami was a maximum run-up of 32~m
430observed at the head of the Monai Valley. This run-up was not
431uniform along the coast and is thought to have resulted from a
432particular topographic effect. Among other features, simulations of
433the Hokkaido tsunami should capture this run-up phenomenon.
434
435\begin{figure}[htbp]
436\centerline{\includegraphics[width=4in]{tsunami-fig-3.eps}}
437\caption{Comparison of wave tank and \AnuGA{} water stages at gauge
4385.}\label{fig:val}
439\end{figure}
440
441
442\begin{figure}[htbp]
443\centerline{\includegraphics[width=4in]{tsunami-fig-4.eps}}
444\caption{Complex reflection patterns and run-up into Monai Valley
445simulated by \AnuGA{} and visualised using our netcdf OSG
446viewer.}\label{fig:run}
447\end{figure}
448
449
450The wave tank simulation of the Hokkaido tsunami was used as the
451first scenario for validating \AnuGA{}. The dataset provided
452bathymetry and topography along with initial water depth and the
453wave specifications. The dataset also contained water depth time
454series from three wave gauges situated offshore from the simulated
455inundation area.
456
457Figure~\ref{fig:val} compares the observed wave tank and modelled
458\AnuGA{} water depth (stage height) at one of the gauges. The plots
459show good agreement between the two time series, with \AnuGA{}
460closely modelling the initial draw down, the wave shoulder and the
461subsequent reflections. The discrepancy between modelled and
462simulated data in the first 10 seconds is due to the initial
463condition in the physical tank not being uniformly zero. Similarly
464good comparisons are evident with data from the other two gauges.
465Additionally, \AnuGA{} replicates exceptionally well the 32~m Monai
466Valley run-up, and demonstrates its occurrence to be due to the
467interaction of the tsunami wave with two juxtaposed valleys above
468the coastline. The run-up is depicted in Figure~\ref{fig:run}.
469
470This successful replication of the tsunami wave tank simulation on a
471complex 3D beach is a positive first step in validating the \AnuGA{}
472modelling capability. Subsequent validation will be conducted as
473additional datasets become available.
474
475
476\section{Conclusions}
477\label{sec:6}
478\AnuGA{} is a flexible and robust modelling system
479that simulates hydrodynamics by solving the shallow water wave
480equation in a triangular mesh. It can model the process of wetting
481and drying as water enters and leaves an area and is capable of
482capturing hydraulic shocks due to the ability of the finite-volume
483method to accommodate discontinuities in the solution.
484\AnuGA{} can take as input bathymetric and topographic datasets and
485simulate the behaviour of riverine flooding, storm surge,
486tsunami or even dam breaks.
487Initial validation using wave tank data supports \AnuGA{}'s
488ability to model complex scenarios. Further validation will be
489pursued as additional datasets become available.
490\AnuGA{} is already being used to model the behaviour of
491hydrodynamic natural hazards. This modelling capability is part of
492Geoscience Australia's ongoing research effort to model and
493understand the potential impact from natural hazards in order to
494reduce their impact on Australian communities (see \cite{Nielsen2006}).
495The \AnuGA{} source code is available
496at \url{http://sourceforge.net/projects/anuga}.
497
498\bibliographystyle{plain}
499\bibliography{database1}
500
501
502
503
504\end{document}
Note: See TracBrowser for help on using the repository browser.