1 | % Complete documentation on the extended LaTeX markup used for Python |
---|
2 | % documentation is available in ``Documenting Python'', which is part |
---|
3 | % of the standard documentation for Python. It may be found online |
---|
4 | % at: |
---|
5 | % |
---|
6 | % http://www.python.org/doc/current/doc/doc.html |
---|
7 | |
---|
8 | |
---|
9 | %labels |
---|
10 | %Sections and subsections \label{sec: } |
---|
11 | %Chapters \label{ch: } |
---|
12 | %Equations \label{eq: } |
---|
13 | %Figures \label{fig: } |
---|
14 | |
---|
15 | % Is latex failing with; |
---|
16 | % `modanuga_user_manual.ind' not found? |
---|
17 | % try this command-line |
---|
18 | % makeindex modanuga_user_manual.idx |
---|
19 | % To produce the modanuga_user_manual.ind file. |
---|
20 | |
---|
21 | |
---|
22 | \documentclass{manual} |
---|
23 | |
---|
24 | \usepackage{graphicx} |
---|
25 | \usepackage{datetime} |
---|
26 | |
---|
27 | \input{definitions} |
---|
28 | |
---|
29 | \title{\anuga User Manual} |
---|
30 | \author{Geoscience Australia and the Australian National University} |
---|
31 | |
---|
32 | % Please at least include a long-lived email address; |
---|
33 | % the rest is at your discretion. |
---|
34 | \authoraddress{Geoscience Australia \\ |
---|
35 | Email: \email{ole.nielsen@ga.gov.au} |
---|
36 | } |
---|
37 | |
---|
38 | %Draft date |
---|
39 | |
---|
40 | % update before release! |
---|
41 | % Use an explicit date so that reformatting |
---|
42 | % doesn't cause a new date to be used. Setting |
---|
43 | % the date to \today can be used during draft |
---|
44 | % stages to make it easier to handle versions. |
---|
45 | |
---|
46 | |
---|
47 | \longdate % Make date format long using datetime.sty |
---|
48 | %\settimeformat{xxivtime} % 24 hour Format |
---|
49 | \settimeformat{oclock} % Verbose |
---|
50 | \date{\today, \ \currenttime} |
---|
51 | %\hyphenation{set\_datadir} |
---|
52 | |
---|
53 | \ifhtml |
---|
54 | \date{\today} % latex2html does not know about datetime |
---|
55 | \fi |
---|
56 | |
---|
57 | |
---|
58 | |
---|
59 | |
---|
60 | \input{version} % Get version info - this file may be modified by |
---|
61 | % update_anuga_user_manual.py - if not a dummy |
---|
62 | % will be used. |
---|
63 | |
---|
64 | %\release{1.0} % release version; this is used to define the |
---|
65 | % % \version macro |
---|
66 | |
---|
67 | \makeindex % tell \index to actually write the .idx file |
---|
68 | \makemodindex % If this contains a lot of module sections. |
---|
69 | |
---|
70 | \setcounter{tocdepth}{3} |
---|
71 | \setcounter{secnumdepth}{3} |
---|
72 | |
---|
73 | |
---|
74 | \begin{document} |
---|
75 | \maketitle |
---|
76 | |
---|
77 | |
---|
78 | % This makes the contents more accessible from the front page of the HTML. |
---|
79 | \ifhtml |
---|
80 | \chapter*{Front Matter\label{front}} |
---|
81 | \fi |
---|
82 | |
---|
83 | %Subversion keywords: |
---|
84 | % |
---|
85 | %$LastChangedDate: 2008-07-16 02:28:52 +0000 (Wed, 16 Jul 2008) $ |
---|
86 | %$LastChangedRevision: 5507 $ |
---|
87 | %$LastChangedBy: ole $ |
---|
88 | |
---|
89 | \input{copyright} |
---|
90 | |
---|
91 | |
---|
92 | \begin{abstract} |
---|
93 | \label{def:anuga} |
---|
94 | |
---|
95 | \noindent \anuga\index{\anuga} is a hydrodynamic modelling tool that |
---|
96 | allows users to model realistic flow problems in complex geometries. |
---|
97 | Examples include dam breaks or the effects of natural hazards such |
---|
98 | as riverine flooding, storm surges and tsunami. |
---|
99 | |
---|
100 | The user must specify a study area represented by a mesh of triangular |
---|
101 | cells, the topography and bathymetry, frictional resistance, initial |
---|
102 | values for water level (called \emph{stage}\index{stage} within \anuga), |
---|
103 | boundary |
---|
104 | conditions and forces such as windstress or pressure gradients if |
---|
105 | applicable. |
---|
106 | |
---|
107 | \anuga tracks the evolution of water depth and horizontal momentum |
---|
108 | within each cell over time by solving the shallow water wave equation |
---|
109 | governing equation using a finite-volume method. |
---|
110 | |
---|
111 | \anuga also incorporates a mesh generator %, called \code{graphical |
---|
112 | %mesh generator}, |
---|
113 | that |
---|
114 | allows the user to set up the geometry of the problem interactively as |
---|
115 | well as tools for interpolation and surface fitting, and a number of |
---|
116 | auxiliary tools for visualising and interrogating the model output. |
---|
117 | |
---|
118 | Most \anuga components are written in the object-oriented programming |
---|
119 | language Python and most users will interact with \anuga by writing |
---|
120 | small Python programs based on the \anuga library |
---|
121 | functions. Computationally intensive components are written for |
---|
122 | efficiency in C routines working directly with the Numerical Python |
---|
123 | structures. |
---|
124 | |
---|
125 | |
---|
126 | \end{abstract} |
---|
127 | |
---|
128 | \tableofcontents |
---|
129 | |
---|
130 | |
---|
131 | \chapter{Introduction} |
---|
132 | |
---|
133 | |
---|
134 | \section{Purpose} |
---|
135 | |
---|
136 | The purpose of this user manual is to introduce the new user to the |
---|
137 | inundation software, describe what it can do and give step-by-step |
---|
138 | instructions for setting up and running hydrodynamic simulations. |
---|
139 | |
---|
140 | \section{Scope} |
---|
141 | |
---|
142 | This manual covers only what is needed to operate the software after |
---|
143 | installation and configuration. It does not includes instructions |
---|
144 | for installing the software or detailed API documentation, both of |
---|
145 | which will be covered in separate publications and by documentation |
---|
146 | in the source code. |
---|
147 | |
---|
148 | \section{Audience} |
---|
149 | |
---|
150 | Readers are assumed to be familiar with the Python Programming language and |
---|
151 | its object oriented approach. |
---|
152 | Python tutorials include |
---|
153 | \url{http://docs.python.org/tut}, |
---|
154 | \url{http://www.sthurlow.com/python}, and |
---|
155 | %\url{http://datamining.anu.edu.au/\%7e ole/work/teaching/ctac2006/exercise1.pdf}. |
---|
156 | \url{http://datamining.anu.edu.au/\~{}ole/work/teaching/ctac2006/exercise1.pdf}. |
---|
157 | |
---|
158 | |
---|
159 | Readers also need to have a general understanding of scientific modelling, |
---|
160 | as well as |
---|
161 | enough programming experience to adapt the code to different |
---|
162 | requirements. |
---|
163 | |
---|
164 | |
---|
165 | |
---|
166 | \pagebreak |
---|
167 | \chapter{Background} |
---|
168 | |
---|
169 | |
---|
170 | Modelling the effects on the built environment of natural hazards such |
---|
171 | as riverine flooding, storm surges and tsunami is critical for |
---|
172 | understanding their economic and social impact on our urban |
---|
173 | communities. Geoscience Australia and the Australian National |
---|
174 | University are developing a hydrodynamic inundation modelling tool |
---|
175 | called \anuga to help simulate the impact of these hazards. |
---|
176 | |
---|
177 | The core of \anuga is the fluid dynamics module, called \code{shallow\_water}, |
---|
178 | which is based on a finite-volume method for solving the Shallow Water |
---|
179 | Wave Equation. The study area is represented by a mesh of triangular |
---|
180 | cells. By solving the governing equation within each cell, water |
---|
181 | depth and horizontal momentum are tracked over time. |
---|
182 | |
---|
183 | A major capability of \anuga is that it can model the process of |
---|
184 | wetting and drying as water enters and leaves an area. This means |
---|
185 | that it is suitable for simulating water flow onto a beach or dry land |
---|
186 | and around structures such as buildings. \anuga is also capable |
---|
187 | of modelling hydraulic jumps due to the ability of the finite-volume |
---|
188 | method to accommodate discontinuities in the solution. |
---|
189 | |
---|
190 | To set up a particular scenario the user specifies the geometry |
---|
191 | (bathymetry and topography), the initial water level (stage), |
---|
192 | boundary conditions such as tide, and any forcing terms that may |
---|
193 | drive the system such as rain_fall, abstraction of water, wind stress or atmospheric pressure |
---|
194 | gradients. Gravity and frictional resistance from the different |
---|
195 | terrains in the model are represented by predefined forcing terms. |
---|
196 | See section \ref{sec:forcing terms} for details on forcing terms available in ANUGA. |
---|
197 | |
---|
198 | The built-in mesh generator, called \code{graphical\_mesh\_generator}, |
---|
199 | allows the user to set up the geometry |
---|
200 | of the problem interactively and to identify boundary segments and |
---|
201 | regions using symbolic tags. These tags may then be used to set the |
---|
202 | actual boundary conditions and attributes for different regions |
---|
203 | (e.g.\ the Manning friction coefficient) for each simulation. |
---|
204 | |
---|
205 | Most \anuga components are written in the object-oriented programming |
---|
206 | language Python. Software written in Python can be produced quickly |
---|
207 | and can be readily adapted to changing requirements throughout its |
---|
208 | lifetime. Computationally intensive components are written for |
---|
209 | efficiency in C routines working directly with the Numerical Python |
---|
210 | structures. The animation tool developed for \anuga is based on |
---|
211 | OpenSceneGraph, an Open Source Software (OSS) component allowing high |
---|
212 | level interaction with sophisticated graphics primitives. |
---|
213 | See \cite{nielsen2005} for more background on \anuga. |
---|
214 | |
---|
215 | \chapter{Restrictions and limitations on \anuga} |
---|
216 | \label{ch:limitations} |
---|
217 | |
---|
218 | Although a powerful and flexible tool for hydrodynamic modelling, \anuga has a |
---|
219 | number of limitations that any potential user need to be aware of. They are |
---|
220 | |
---|
221 | \begin{itemize} |
---|
222 | \item The mathematical model is the 2D shallow water wave equation. |
---|
223 | As such it cannot resolve vertical convection and consequently not breaking |
---|
224 | waves or 3D turbulence (e.g.\ vorticity). |
---|
225 | \item The surface is assumed to be open, e.g. \anuga cannot model |
---|
226 | flow under ceilings or in pipes |
---|
227 | \item All spatial coordinates are assumed to be UTM (meters). As such, |
---|
228 | ANUGA is unsuitable for modelling flows in areas larger than one UTM zone |
---|
229 | (6 degrees wide). |
---|
230 | \item Fluid is assumed to be inviscid |
---|
231 | \item The finite volume is a very robust and flexible numerical technique, |
---|
232 | but it is not the fastest method around. If the geometry is sufficiently |
---|
233 | simple and if there is no need for wetting or drying, a finite-difference |
---|
234 | method may be able to solve the problem faster than \anuga. |
---|
235 | %\item Mesh resolutions near coastlines with steep gradients need to be... |
---|
236 | \item Frictional resistance is implemented using Manning's formula, but |
---|
237 | \anuga has not yet been fully validated in regard to bottom roughness |
---|
238 | \item ANUGA contains no tsunami-genic functionality relating to |
---|
239 | earthquakes. |
---|
240 | \end{itemize} |
---|
241 | |
---|
242 | |
---|
243 | |
---|
244 | \chapter{Getting Started} |
---|
245 | \label{ch:getstarted} |
---|
246 | |
---|
247 | This section is designed to assist the reader to get started with |
---|
248 | \anuga by working through some examples. Two examples are discussed; |
---|
249 | the first is a simple example to illustrate many of the ideas, and |
---|
250 | the second is a more realistic example. |
---|
251 | |
---|
252 | \section{A Simple Example} |
---|
253 | \label{sec:simpleexample} |
---|
254 | |
---|
255 | \subsection{Overview} |
---|
256 | |
---|
257 | What follows is a discussion of the structure and operation of a |
---|
258 | script called \file{runup.py}. |
---|
259 | |
---|
260 | This example carries out the solution of the shallow-water wave |
---|
261 | equation in the simple case of a configuration comprising a flat |
---|
262 | bed, sloping at a fixed angle in one direction and having a |
---|
263 | constant depth across each line in the perpendicular direction. |
---|
264 | |
---|
265 | The example demonstrates the basic ideas involved in setting up a |
---|
266 | complex scenario. In general the user specifies the geometry |
---|
267 | (bathymetry and topography), the initial water level, boundary |
---|
268 | conditions such as tide, and any forcing terms that may drive the |
---|
269 | system such as rain_fall, abstraction of water, wind stress or atmospheric pressure gradients. |
---|
270 | Frictional resistance from the different terrains in the model is |
---|
271 | represented by predefined forcing terms. In this example, the |
---|
272 | boundary is reflective on three sides and a time dependent wave on |
---|
273 | one side. |
---|
274 | |
---|
275 | The present example represents a simple scenario and does not |
---|
276 | include any forcing terms, nor is the data taken from a file as it |
---|
277 | would typically be. |
---|
278 | |
---|
279 | The conserved quantities involved in the |
---|
280 | problem are stage (absolute height of water surface), |
---|
281 | $x$-momentum and $y$-momentum. Other quantities |
---|
282 | involved in the computation are the friction and elevation. |
---|
283 | |
---|
284 | Water depth can be obtained through the equation |
---|
285 | |
---|
286 | \begin{tabular}{rcrcl} |
---|
287 | \code{depth} &=& \code{stage} &$-$& \code{elevation} |
---|
288 | \end{tabular} |
---|
289 | |
---|
290 | |
---|
291 | \subsection{Outline of the Program} |
---|
292 | |
---|
293 | In outline, \file{runup.py} performs the following steps: |
---|
294 | |
---|
295 | \begin{enumerate} |
---|
296 | |
---|
297 | \item Sets up a triangular mesh. |
---|
298 | |
---|
299 | \item Sets certain parameters governing the mode of |
---|
300 | operation of the model-specifying, for instance, where to store the model output. |
---|
301 | |
---|
302 | \item Inputs various quantities describing physical measurements, such |
---|
303 | as the elevation, to be specified at each mesh point (vertex). |
---|
304 | |
---|
305 | \item Sets up the boundary conditions. |
---|
306 | |
---|
307 | \item Carries out the evolution of the model through a series of time |
---|
308 | steps and outputs the results, providing a results file that can |
---|
309 | be visualised. |
---|
310 | |
---|
311 | \end{enumerate} |
---|
312 | |
---|
313 | \subsection{The Code} |
---|
314 | |
---|
315 | %FIXME: we are using the \code function here. |
---|
316 | %This should be used wherever possible |
---|
317 | For reference we include below the complete code listing for |
---|
318 | \file{runup.py}. Subsequent paragraphs provide a |
---|
319 | `commentary' that describes each step of the program and explains it |
---|
320 | significance. |
---|
321 | |
---|
322 | \verbatiminput{demos/runup.py} |
---|
323 | |
---|
324 | \subsection{Establishing the Mesh}\index{mesh, establishing} |
---|
325 | |
---|
326 | The first task is to set up the triangular mesh to be used for the |
---|
327 | scenario. This is carried out through the statement: |
---|
328 | |
---|
329 | {\small \begin{verbatim} |
---|
330 | points, vertices, boundary = rectangular_cross(10, 10) |
---|
331 | \end{verbatim}} |
---|
332 | |
---|
333 | The function \function{rectangular_cross} is imported from a module |
---|
334 | \module{mesh\_factory} defined elsewhere. (\anuga also contains |
---|
335 | several other schemes that can be used for setting up meshes, but we |
---|
336 | shall not discuss these.) The above assignment sets up a $10 \times |
---|
337 | 10$ rectangular mesh, triangulated in a regular way. The assignment |
---|
338 | |
---|
339 | {\small \begin{verbatim} |
---|
340 | points, vertices, boundary = rectangular_cross(m, n) |
---|
341 | \end{verbatim}} |
---|
342 | |
---|
343 | returns: |
---|
344 | |
---|
345 | \begin{itemize} |
---|
346 | |
---|
347 | \item a list \code{points} giving the coordinates of each mesh point, |
---|
348 | |
---|
349 | \item a list \code{vertices} specifying the three vertices of each triangle, and |
---|
350 | |
---|
351 | \item a dictionary \code{boundary} that stores the edges on |
---|
352 | the boundary and associates each with one of the symbolic tags \code{`left'}, \code{`right'}, |
---|
353 | \code{`top'} or \code{`bottom'}. |
---|
354 | |
---|
355 | \end{itemize} |
---|
356 | |
---|
357 | (For more details on symbolic tags, see page |
---|
358 | \pageref{ref:tagdescription}.) |
---|
359 | |
---|
360 | An example of a general unstructured mesh and the associated data |
---|
361 | structures \code{points}, \code{vertices} and \code{boundary} is |
---|
362 | given in Section \ref{sec:meshexample}. |
---|
363 | |
---|
364 | |
---|
365 | |
---|
366 | |
---|
367 | \subsection{Initialising the Domain} |
---|
368 | |
---|
369 | These variables are then used to set up a data structure |
---|
370 | \code{domain}, through the assignment: |
---|
371 | |
---|
372 | {\small \begin{verbatim} |
---|
373 | domain = Domain(points, vertices, boundary) |
---|
374 | \end{verbatim}} |
---|
375 | |
---|
376 | This creates an instance of the \class{Domain} class, which |
---|
377 | represents the domain of the simulation. Specific options are set at |
---|
378 | this point, including the basename for the output file and the |
---|
379 | directory to be used for data: |
---|
380 | |
---|
381 | {\small \begin{verbatim} |
---|
382 | domain.set_name('runup') |
---|
383 | \end{verbatim}} |
---|
384 | |
---|
385 | {\small \begin{verbatim} |
---|
386 | domain.set_datadir('.') |
---|
387 | \end{verbatim}} |
---|
388 | |
---|
389 | In addition, the following statement now specifies that the |
---|
390 | quantities \code{stage}, \code{xmomentum} and \code{ymomentum} are |
---|
391 | to be stored: |
---|
392 | |
---|
393 | {\small \begin{verbatim} |
---|
394 | domain.set_quantities_to_be_stored(['stage', 'xmomentum', |
---|
395 | 'ymomentum']) |
---|
396 | \end{verbatim}} |
---|
397 | |
---|
398 | |
---|
399 | \subsection{Initial Conditions} |
---|
400 | |
---|
401 | The next task is to specify a number of quantities that we wish to |
---|
402 | set for each mesh point. The class \class{Domain} has a method |
---|
403 | \method{set\_quantity}, used to specify these quantities. It is a |
---|
404 | flexible method that allows the user to set quantities in a variety |
---|
405 | of ways---using constants, functions, numeric arrays, expressions |
---|
406 | involving other quantities, or arbitrary data points with associated |
---|
407 | values, all of which can be passed as arguments. All quantities can |
---|
408 | be initialised using \method{set\_quantity}. For a conserved |
---|
409 | quantity (such as \code{stage, xmomentum, ymomentum}) this is called |
---|
410 | an \emph{initial condition}. However, other quantities that aren't |
---|
411 | updated by the equation are also assigned values using the same |
---|
412 | interface. The code in the present example demonstrates a number of |
---|
413 | forms in which we can invoke \method{set\_quantity}. |
---|
414 | |
---|
415 | |
---|
416 | \subsubsection{Elevation} |
---|
417 | |
---|
418 | The elevation, or height of the bed, is set using a function, |
---|
419 | defined through the statements below, which is specific to this |
---|
420 | example and specifies a particularly simple initial configuration |
---|
421 | for demonstration purposes: |
---|
422 | |
---|
423 | {\small \begin{verbatim} |
---|
424 | def f(x,y): |
---|
425 | return -x/2 |
---|
426 | \end{verbatim}} |
---|
427 | |
---|
428 | This simply associates an elevation with each point \code{(x, y)} of |
---|
429 | the plane. It specifies that the bed slopes linearly in the |
---|
430 | \code{x} direction, with slope $-\frac{1}{2}$, and is constant in |
---|
431 | the \code{y} direction. |
---|
432 | |
---|
433 | Once the function \function{f} is specified, the quantity |
---|
434 | \code{elevation} is assigned through the simple statement: |
---|
435 | |
---|
436 | {\small \begin{verbatim} |
---|
437 | domain.set_quantity('elevation', f) |
---|
438 | \end{verbatim}} |
---|
439 | |
---|
440 | NOTE: If using function to set \code{elevation} it must be vector |
---|
441 | compatible. For example square root will not work. |
---|
442 | |
---|
443 | \subsubsection{Friction} |
---|
444 | |
---|
445 | The assignment of the friction quantity (a forcing term) |
---|
446 | demonstrates another way we can use \method{set\_quantity} to set |
---|
447 | quantities---namely, assign them to a constant numerical value: |
---|
448 | |
---|
449 | {\small \begin{verbatim} |
---|
450 | domain.set_quantity('friction', 0.1) |
---|
451 | \end{verbatim}} |
---|
452 | |
---|
453 | This specifies that the Manning friction coefficient is set to 0.1 |
---|
454 | at every mesh point. |
---|
455 | |
---|
456 | \subsubsection{Stage} |
---|
457 | |
---|
458 | The stage (the height of the water surface) is related to the |
---|
459 | elevation and the depth at any time by the equation |
---|
460 | |
---|
461 | {\small \begin{verbatim} |
---|
462 | stage = elevation + depth |
---|
463 | \end{verbatim}} |
---|
464 | |
---|
465 | |
---|
466 | For this example, we simply assign a constant value to \code{stage}, |
---|
467 | using the statement |
---|
468 | |
---|
469 | {\small \begin{verbatim} |
---|
470 | domain.set_quantity('stage', -.4) |
---|
471 | \end{verbatim}} |
---|
472 | |
---|
473 | which specifies that the surface level is set to a height of $-0.4$, |
---|
474 | i.e. 0.4 units (m) below the zero level. |
---|
475 | |
---|
476 | Although it is not necessary for this example, it may be useful to |
---|
477 | digress here and mention a variant to this requirement, which allows |
---|
478 | us to illustrate another way to use \method{set\_quantity}---namely, |
---|
479 | incorporating an expression involving other quantities. Suppose, |
---|
480 | instead of setting a constant value for the stage, we wished to |
---|
481 | specify a constant value for the \emph{depth}. For such a case we |
---|
482 | need to specify that \code{stage} is everywhere obtained by adding |
---|
483 | that value to the value already specified for \code{elevation}. We |
---|
484 | would do this by means of the statements: |
---|
485 | |
---|
486 | {\small \begin{verbatim} |
---|
487 | h = 0.05 # Constant depth |
---|
488 | domain.set_quantity('stage', expression = 'elevation + %f' %h) |
---|
489 | \end{verbatim}} |
---|
490 | |
---|
491 | That is, the value of \code{stage} is set to $\code{h} = 0.05$ plus |
---|
492 | the value of \code{elevation} already defined. |
---|
493 | |
---|
494 | The reader will probably appreciate that this capability to |
---|
495 | incorporate expressions into statements using \method{set\_quantity} |
---|
496 | greatly expands its power.) See Section \ref{sec:Initial Conditions} for more |
---|
497 | details. |
---|
498 | |
---|
499 | \subsection{Boundary Conditions}\index{boundary conditions} |
---|
500 | |
---|
501 | The boundary conditions are specified as follows: |
---|
502 | |
---|
503 | {\small \begin{verbatim} |
---|
504 | Br = Reflective_boundary(domain) |
---|
505 | |
---|
506 | Bt = Transmissive_boundary(domain) |
---|
507 | |
---|
508 | Bd = Dirichlet_boundary([0.2,0.,0.]) |
---|
509 | |
---|
510 | Bw = Time_boundary(domain=domain, |
---|
511 | f=lambda t: [(0.1*sin(t*2*pi)-0.3), 0.0, 0.0]) |
---|
512 | \end{verbatim}} |
---|
513 | |
---|
514 | The effect of these statements is to set up a selection of different |
---|
515 | alternative boundary conditions and store them in variables that can be |
---|
516 | assigned as needed. Each boundary condition specifies the |
---|
517 | behaviour at a boundary in terms of the behaviour in neighbouring |
---|
518 | elements. The boundary conditions introduced here may be briefly described as |
---|
519 | follows: |
---|
520 | |
---|
521 | \begin{itemize} |
---|
522 | \item \textbf{Reflective boundary}\label{def:reflective boundary} Returns same \code{stage} as |
---|
523 | as present in its neighbour volume but momentum vector |
---|
524 | reversed 180 degrees (reflected). |
---|
525 | Specific to the shallow water equation as it works with the |
---|
526 | momentum quantities assumed to be the second and third conserved |
---|
527 | quantities. A reflective boundary condition models a solid wall. |
---|
528 | \item \textbf{Transmissive boundary}\label{def:transmissive boundary} Returns same conserved quantities as |
---|
529 | those present in its neighbour volume. This is one way of modelling |
---|
530 | outflow from a domain, but it should be used with caution if flow is |
---|
531 | not steady state as replication of momentum at the boundary |
---|
532 | may cause occasional spurious effects. If this occurs, |
---|
533 | consider using e.g. a Dirichlet boundary condition. |
---|
534 | \item \textbf{Dirichlet boundary}\label{def:dirichlet boundary} Specifies |
---|
535 | constant values for stage, $x$-momentum and $y$-momentum at the boundary. |
---|
536 | \item \textbf{Time boundary}\label{def:time boundary} Like a Dirichlet |
---|
537 | boundary but with behaviour varying with time. |
---|
538 | \end{itemize} |
---|
539 | |
---|
540 | \label{ref:tagdescription}Before describing how these boundary |
---|
541 | conditions are assigned, we recall that a mesh is specified using |
---|
542 | three variables \code{points}, \code{vertices} and \code{boundary}. |
---|
543 | In the code we are discussing, these three variables are returned by |
---|
544 | the function \code{rectangular}; however, the example given in |
---|
545 | Section \ref{sec:realdataexample} illustrates another way of |
---|
546 | assigning the values, by means of the function |
---|
547 | \code{create\_mesh\_from\_regions}. |
---|
548 | |
---|
549 | These variables store the data determining the mesh as follows. (You |
---|
550 | may find that the example given in Section \ref{sec:meshexample} |
---|
551 | helps to clarify the following discussion, even though that example |
---|
552 | is a \emph{non-rectangular} mesh.) |
---|
553 | |
---|
554 | \begin{itemize} |
---|
555 | \item The variable \code{points} stores a list of 2-tuples giving the |
---|
556 | coordinates of the mesh points. |
---|
557 | |
---|
558 | \item The variable \code{vertices} stores a list of 3-tuples of |
---|
559 | numbers, representing vertices of triangles in the mesh. In this |
---|
560 | list, the triangle whose vertices are \code{points[i]}, |
---|
561 | \code{points[j]}, \code{points[k]} is represented by the 3-tuple |
---|
562 | \code{(i, j, k)}. |
---|
563 | |
---|
564 | \item The variable \code{boundary} is a Python dictionary that |
---|
565 | not only stores the edges that make up the boundary but also assigns |
---|
566 | symbolic tags to these edges to distinguish different parts of the |
---|
567 | boundary. An edge with endpoints \code{points[i]} and |
---|
568 | \code{points[j]} is represented by the 2-tuple \code{(i, j)}. The |
---|
569 | keys for the dictionary are the 2-tuples \code{(i, j)} corresponding |
---|
570 | to boundary edges in the mesh, and the values are the tags are used |
---|
571 | to label them. In the present example, the value \code{boundary[(i, |
---|
572 | j)]} assigned to \code{(i, j)]} is one of the four tags |
---|
573 | \code{`left'}, \code{`right'}, \code{`top'} or \code{`bottom'}, |
---|
574 | depending on whether the boundary edge represented by \code{(i, j)} |
---|
575 | occurs at the left, right, top or bottom of the rectangle bounding |
---|
576 | the mesh. The function \code{rectangular} automatically assigns |
---|
577 | these tags to the boundary edges when it generates the mesh. |
---|
578 | \end{itemize} |
---|
579 | |
---|
580 | The tags provide the means to assign different boundary conditions |
---|
581 | to an edge depending on which part of the boundary it belongs to. |
---|
582 | (In Section \ref{sec:realdataexample} we describe an example that |
---|
583 | uses different boundary tags --- in general, the possible tags are entirely selectable by the user when generating the mesh and not |
---|
584 | limited to `left', `right', `top' and `bottom' as in this example.) |
---|
585 | All segments in bounding polygon must be tagged. If a tag is not supplied, the default tag name 'exterior' will be assigned by ANUGA. |
---|
586 | |
---|
587 | |
---|
588 | Using the boundary objects described above, we assign a boundary |
---|
589 | condition to each part of the boundary by means of a statement like |
---|
590 | |
---|
591 | {\small \begin{verbatim} |
---|
592 | domain.set_boundary({'left': Br, 'right': Bw, 'top': Br, 'bottom': Br}) |
---|
593 | \end{verbatim}} |
---|
594 | |
---|
595 | It is critical that all tags are assoctiated with a boundary conditing in this statement. If not the program will halt with a statement like |
---|
596 | |
---|
597 | \begin{verbatim} |
---|
598 | |
---|
599 | Traceback (most recent call last): |
---|
600 | File "mesh_test.py", line 114, in ? |
---|
601 | domain.set_boundary({'west': Bi, 'east': Bo, 'north': Br, 'south': Br}) |
---|
602 | File "X:\inundation\sandpits\onielsen\anuga_core\source\anuga\abstract_2d_finite_volumes\domain.py", line 505, in set_boundary |
---|
603 | raise msg |
---|
604 | ERROR (domain.py): Tag "exterior" has not been bound to a boundary object. |
---|
605 | All boundary tags defined in domain must appear in the supplied dictionary. |
---|
606 | The tags are: ['ocean', 'east', 'north', 'exterior', 'south'] |
---|
607 | \end{verbatim} |
---|
608 | |
---|
609 | |
---|
610 | The command \code{set\_boundary} stipulates that, in the current example, the right |
---|
611 | boundary varies with time, as defined by the lambda function, while the other |
---|
612 | boundaries are all reflective. |
---|
613 | |
---|
614 | The reader may wish to experiment by varying the choice of boundary |
---|
615 | types for one or more of the boundaries. (In the case of \code{Bd} |
---|
616 | and \code{Bw}, the three arguments in each case represent the |
---|
617 | \code{stage}, $x$-momentum and $y$-momentum, respectively.) |
---|
618 | |
---|
619 | {\small \begin{verbatim} |
---|
620 | Bw = Time_boundary(domain=domain, |
---|
621 | f=lambda t: [(0.1*sin(t*2*pi)-0.3), 0.0, 0.0]) |
---|
622 | \end{verbatim}} |
---|
623 | |
---|
624 | |
---|
625 | |
---|
626 | \subsection{Evolution}\index{evolution} |
---|
627 | |
---|
628 | The final statement \nopagebreak[3] |
---|
629 | {\small \begin{verbatim} |
---|
630 | for t in domain.evolve(yieldstep = 0.1, duration = 4.0): |
---|
631 | print domain.timestepping_statistics() |
---|
632 | \end{verbatim}} |
---|
633 | |
---|
634 | causes the configuration of the domain to `evolve', over a series of |
---|
635 | steps indicated by the values of \code{yieldstep} and |
---|
636 | \code{duration}, which can be altered as required. The value of |
---|
637 | \code{yieldstep} controls the time interval between successive model |
---|
638 | outputs. Behind the scenes more time steps are generally taken. |
---|
639 | |
---|
640 | |
---|
641 | \subsection{Output} |
---|
642 | |
---|
643 | The output is a NetCDF file with the extension \code{.sww}. It |
---|
644 | contains stage and momentum information and can be used with the |
---|
645 | ANUGA viewer \code{animate} (see Section \ref{sec:animate}) |
---|
646 | visualisation package |
---|
647 | to generate a visual display. See Section \ref{sec:file formats} |
---|
648 | (page \pageref{sec:file formats}) for more on NetCDF and other file |
---|
649 | formats. |
---|
650 | |
---|
651 | The following is a listing of the screen output seen by the user |
---|
652 | when this example is run: |
---|
653 | |
---|
654 | \verbatiminput{examples/runupoutput.txt} |
---|
655 | |
---|
656 | |
---|
657 | \section{How to Run the Code} |
---|
658 | |
---|
659 | The code can be run in various ways: |
---|
660 | |
---|
661 | \begin{itemize} |
---|
662 | \item{from a Windows or Unix command line} as in\ \code{python runup.py} |
---|
663 | \item{within the Python IDLE environment} |
---|
664 | \item{within emacs} |
---|
665 | \item{within Windows, by double-clicking the \code{runup.py} |
---|
666 | file.} |
---|
667 | \end{itemize} |
---|
668 | |
---|
669 | |
---|
670 | \section{Exploring the Model Output} |
---|
671 | |
---|
672 | The following figures are screenshots from the \anuga visualisation |
---|
673 | tool \code{animate}. Figure \ref{fig:runupstart} shows the domain |
---|
674 | with water surface as specified by the initial condition, $t=0$. |
---|
675 | Figure \ref{fig:runup2} shows later snapshots for $t=2.3$ and |
---|
676 | $t=4$ where the system has been evolved and the wave is encroaching |
---|
677 | on the previously dry bed. All figures are screenshots from an |
---|
678 | interactive animation tool called animate which is part of \anuga and |
---|
679 | distributed as in the package anuga\_viewer. |
---|
680 | Animate is described in more detail is Section \ref{sec:animate}. |
---|
681 | |
---|
682 | \begin{figure}[hbt] |
---|
683 | |
---|
684 | \centerline{\includegraphics[width=75mm, height=75mm] |
---|
685 | {graphics/bedslopestart.jpg}} |
---|
686 | |
---|
687 | \caption{Runup example viewed with the ANUGA viewer} |
---|
688 | \label{fig:runupstart} |
---|
689 | \end{figure} |
---|
690 | |
---|
691 | |
---|
692 | \begin{figure}[hbt] |
---|
693 | |
---|
694 | \centerline{ |
---|
695 | \includegraphics[width=75mm, height=75mm]{graphics/bedslopeduring.jpg} |
---|
696 | \includegraphics[width=75mm, height=75mm]{graphics/bedslopeend.jpg} |
---|
697 | } |
---|
698 | |
---|
699 | \caption{Runup example viewed with ANGUA viewer} |
---|
700 | \label{fig:runup2} |
---|
701 | \end{figure} |
---|
702 | |
---|
703 | |
---|
704 | |
---|
705 | \clearpage |
---|
706 | |
---|
707 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
708 | |
---|
709 | \section{A slightly more complex example} |
---|
710 | \label{sec:channelexample} |
---|
711 | |
---|
712 | \subsection{Overview} |
---|
713 | |
---|
714 | The next example is about waterflow in a channel with varying boundary conditions and |
---|
715 | more complex topograhies. These examples build on the |
---|
716 | concepts introduced through the \file{runup.py} in Section \ref{sec:simpleexample}. |
---|
717 | The example will be built up through three progressively more complex scripts. |
---|
718 | |
---|
719 | \subsection{Overview} |
---|
720 | As in the case of \file{runup.py}, the actions carried |
---|
721 | out by the program can be organised according to this outline: |
---|
722 | |
---|
723 | \begin{enumerate} |
---|
724 | |
---|
725 | \item Set up a triangular mesh. |
---|
726 | |
---|
727 | \item Set certain parameters governing the mode of |
---|
728 | operation of the model---specifying, for instance, where to store the |
---|
729 | model output. |
---|
730 | |
---|
731 | \item Set up initial conditions for various quantities such as the elevation, to be specified at each mesh point (vertex). |
---|
732 | |
---|
733 | \item Set up the boundary conditions. |
---|
734 | |
---|
735 | \item Carry out the evolution of the model through a series of time |
---|
736 | steps and output the results, providing a results file that can be |
---|
737 | visualised. |
---|
738 | |
---|
739 | \end{enumerate} |
---|
740 | |
---|
741 | |
---|
742 | \subsection{The Code} |
---|
743 | |
---|
744 | Here is the code for the first version of the channel flow \file{channel1.py}: |
---|
745 | |
---|
746 | \verbatiminput{demos/channel1.py} |
---|
747 | |
---|
748 | In discussing the details of this example, we follow the outline |
---|
749 | given above, discussing each major step of the code in turn. |
---|
750 | |
---|
751 | \subsection{Establishing the Mesh}\index{mesh, establishing} |
---|
752 | |
---|
753 | In this example we use a similar simple structured triangular mesh as in \code{runup.py} |
---|
754 | for simplicity, but this time we will use a symmetric one and also |
---|
755 | change the physical extent of the domain. The assignment |
---|
756 | |
---|
757 | {\small \begin{verbatim} |
---|
758 | points, vertices, boundary = rectangular_cross(m, n, |
---|
759 | len1=length, len2=width) |
---|
760 | \end{verbatim}} |
---|
761 | returns a m x n mesh similar to the one used in the previous example, except that now the |
---|
762 | extent in the x and y directions are given by the value of \code{length} and \code{width} |
---|
763 | respectively. |
---|
764 | |
---|
765 | Defining m and n in terms of the extent as in this example provides a convenient way of |
---|
766 | controlling the resolution: By defining dx and dy to be the desired size of each hypothenuse in the mesh we can write the mesh generation as follows: |
---|
767 | |
---|
768 | {\small \begin{verbatim} |
---|
769 | length = 10. |
---|
770 | width = 5. |
---|
771 | dx = dy = 1 # Resolution: Length of subdivisions on both axes |
---|
772 | |
---|
773 | points, vertices, boundary = rectangular_cross(int(length/dx), int(width/dy), |
---|
774 | len1=length, len2=width) |
---|
775 | \end{verbatim}} |
---|
776 | which yields a mesh of length=10m, width=5m with 1m spacings. To increase the resolution, as we will later in this example, one merely decrease the values of dx and dy. |
---|
777 | |
---|
778 | The rest of this script is as in the previous example. |
---|
779 | % except for an application of the 'expression' form of \code{set\_quantity} where we use the value of \code{elevation} to define the (dry) initial condition for \code{stage}: |
---|
780 | %{\small \begin{verbatim} |
---|
781 | % domain.set_quantity('stage', expression='elevation') |
---|
782 | %\end{verbatim}} |
---|
783 | |
---|
784 | \section{Model Output} |
---|
785 | |
---|
786 | The following figure is a screenshot from the \anuga visualisation |
---|
787 | tool \code{animate} of output from this example. |
---|
788 | \begin{figure}[hbt] |
---|
789 | \centerline{\includegraphics[height=75mm] |
---|
790 | {graphics/channel1.png}}% |
---|
791 | |
---|
792 | \caption{Simple channel example viewed with the ANUGA viewer.} |
---|
793 | \label{fig:channel1} |
---|
794 | \end{figure} |
---|
795 | |
---|
796 | |
---|
797 | \subsection{Changing boundary conditions on the fly} |
---|
798 | \label{sec:change boundary} |
---|
799 | |
---|
800 | Here is the code for the second version of the channel flow \file{channel2.py}: |
---|
801 | \verbatiminput{demos/channel2.py} |
---|
802 | This example differs from the first version in that a constant outflow boundary condition has |
---|
803 | been defined |
---|
804 | {\small \begin{verbatim} |
---|
805 | Bo = Dirichlet_boundary([-5, 0, 0]) # Outflow |
---|
806 | \end{verbatim}} |
---|
807 | and that it is applied to the right hand side boundary when the water level there exceeds 0m. |
---|
808 | {\small \begin{verbatim} |
---|
809 | for t in domain.evolve(yieldstep = 0.2, finaltime = 40.0): |
---|
810 | domain.write_time() |
---|
811 | |
---|
812 | if domain.get_quantity('stage').get_values(interpolation_points=[[10, 2.5]]) > 0: |
---|
813 | print 'Stage > 0: Changing to outflow boundary' |
---|
814 | domain.set_boundary({'right': Bo}) |
---|
815 | \end{verbatim}} |
---|
816 | \label{sec:change boundary code} |
---|
817 | |
---|
818 | The if statement in the timestepping loop (evolve) gets the quantity |
---|
819 | \code{stage} and obtain the interpolated value at the point (10m, |
---|
820 | 2.5m) which is on the right boundary. If the stage exceeds 0m a |
---|
821 | message is printed and the old boundary condition at tag 'right' is |
---|
822 | replaced by the outflow boundary using the method |
---|
823 | {\small \begin{verbatim} |
---|
824 | domain.set_boundary({'right': Bo}) |
---|
825 | \end{verbatim}} |
---|
826 | This type of dynamically varying boundary could for example be |
---|
827 | used to model the |
---|
828 | breakdown of a sluice door when water exceeds a certain level. |
---|
829 | |
---|
830 | \subsection{Output} |
---|
831 | |
---|
832 | The text output from this example looks like this |
---|
833 | {\small \begin{verbatim} |
---|
834 | ... |
---|
835 | Time = 15.4000, delta t in [0.03789902, 0.03789916], steps=6 (6) |
---|
836 | Time = 15.6000, delta t in [0.03789896, 0.03789908], steps=6 (6) |
---|
837 | Time = 15.8000, delta t in [0.03789891, 0.03789903], steps=6 (6) |
---|
838 | Stage > 0: Changing to outflow boundary |
---|
839 | Time = 16.0000, delta t in [0.02709050, 0.03789898], steps=6 (6) |
---|
840 | Time = 16.2000, delta t in [0.03789892, 0.03789904], steps=6 (6) |
---|
841 | ... |
---|
842 | \end{verbatim}} |
---|
843 | |
---|
844 | |
---|
845 | \subsection{Flow through more complex topograhies} |
---|
846 | |
---|
847 | Here is the code for the third version of the channel flow \file{channel3.py}: |
---|
848 | \verbatiminput{demos/channel3.py} |
---|
849 | |
---|
850 | This example differs from the first two versions in that the topography |
---|
851 | contains obstacles. |
---|
852 | |
---|
853 | This is accomplished here by defining the function \code{topography} as follows |
---|
854 | {\small \begin{verbatim} |
---|
855 | def topography(x,y): |
---|
856 | """Complex topography defined by a function of vectors x and y |
---|
857 | """ |
---|
858 | |
---|
859 | z = -x/10 |
---|
860 | |
---|
861 | N = len(x) |
---|
862 | for i in range(N): |
---|
863 | |
---|
864 | # Step |
---|
865 | if 10 < x[i] < 12: |
---|
866 | z[i] += 0.4 - 0.05*y[i] |
---|
867 | |
---|
868 | # Constriction |
---|
869 | if 27 < x[i] < 29 and y[i] > 3: |
---|
870 | z[i] += 2 |
---|
871 | |
---|
872 | # Pole |
---|
873 | if (x[i] - 34)**2 + (y[i] - 2)**2 < 0.4**2: |
---|
874 | z[i] += 2 |
---|
875 | |
---|
876 | return z |
---|
877 | \end{verbatim}} |
---|
878 | |
---|
879 | In addition, changing the resolution to dx=dy=0.1 creates a finer mesh resolving the new featurse better. |
---|
880 | |
---|
881 | A screenshot of this model at time == 15s is |
---|
882 | \begin{figure}[hbt] |
---|
883 | |
---|
884 | \centerline{\includegraphics[height=75mm] |
---|
885 | {graphics/channel3.png}} |
---|
886 | |
---|
887 | \caption{More complex flow in a channel} |
---|
888 | \label{fig:channel3} |
---|
889 | \end{figure} |
---|
890 | |
---|
891 | |
---|
892 | |
---|
893 | |
---|
894 | \clearpage |
---|
895 | |
---|
896 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
897 | |
---|
898 | \section{An Example with Real Data} |
---|
899 | \label{sec:realdataexample} The following discussion builds on the |
---|
900 | concepts introduced through the \file{runup.py} example and |
---|
901 | introduces a second example, \file{runcairns.py}. This refers to |
---|
902 | a {\bf hypothetical} scenario using real-life data, |
---|
903 | in which the domain of interest surrounds the |
---|
904 | Cairns region. Two scenarios are given; firstly, a |
---|
905 | hypothetical tsunami wave is generated by a submarine mass failure |
---|
906 | situated on the edge of the continental shelf, and secondly, a fixed wave |
---|
907 | of given amplitude and period is introduced through the boundary. |
---|
908 | |
---|
909 | {\bf |
---|
910 | Each scenario has been designed to generate a tsunami which will |
---|
911 | inundate the Cairns region. To achieve this, suitably large |
---|
912 | parameters were chosen and were not based on any known tsunami sources |
---|
913 | or realistic amplitudes. |
---|
914 | } |
---|
915 | |
---|
916 | \subsection{Overview} |
---|
917 | As in the case of \file{runup.py}, the actions carried |
---|
918 | out by the program can be organised according to this outline: |
---|
919 | |
---|
920 | \begin{enumerate} |
---|
921 | |
---|
922 | \item Set up a triangular mesh. |
---|
923 | |
---|
924 | \item Set certain parameters governing the mode of |
---|
925 | operation of the model---specifying, for instance, where to store the |
---|
926 | model output. |
---|
927 | |
---|
928 | \item Input various quantities describing physical measurements, such |
---|
929 | as the elevation, to be specified at each mesh point (vertex). |
---|
930 | |
---|
931 | \item Set up the boundary conditions. |
---|
932 | |
---|
933 | \item Carry out the evolution of the model through a series of time |
---|
934 | steps and output the results, providing a results file that can be |
---|
935 | visualised. |
---|
936 | |
---|
937 | \end{enumerate} |
---|
938 | |
---|
939 | |
---|
940 | |
---|
941 | \subsection{The Code} |
---|
942 | |
---|
943 | Here is the code for \file{runcairns.py}: |
---|
944 | |
---|
945 | \verbatiminput{demos/cairns/runcairns.py} |
---|
946 | |
---|
947 | In discussing the details of this example, we follow the outline |
---|
948 | given above, discussing each major step of the code in turn. |
---|
949 | |
---|
950 | \subsection{Establishing the Mesh}\index{mesh, establishing} |
---|
951 | |
---|
952 | One obvious way that the present example differs from |
---|
953 | \file{runup.py} is in the use of a more complex method to |
---|
954 | create the mesh. Instead of imposing a mesh structure on a |
---|
955 | rectangular grid, the technique used for this example involves |
---|
956 | building mesh structures inside polygons specified by the user, |
---|
957 | using a mesh-generator. |
---|
958 | |
---|
959 | In its simplest form, the mesh-generator creates the mesh within a single |
---|
960 | polygon whose vertices are at geographical locations specified by |
---|
961 | the user. The user specifies the \emph{resolution}---that is, the |
---|
962 | maximal area of a triangle used for triangulation---and a triangular |
---|
963 | mesh is created inside the polygon using a mesh generation engine. |
---|
964 | On any given platform, the same mesh will be returned. |
---|
965 | %Figure |
---|
966 | %\ref{fig:pentagon} shows a simple example of this, in which the |
---|
967 | %triangulation is carried out within a pentagon. |
---|
968 | |
---|
969 | |
---|
970 | %\begin{figure}[hbt] |
---|
971 | |
---|
972 | % \caption{Mesh points are created inside the polygon} |
---|
973 | %\label{fig:pentagon} |
---|
974 | %\end{figure} |
---|
975 | |
---|
976 | Boundary tags are not restricted to \code{`left'}, \code{`bottom'}, |
---|
977 | \code{`right'} and \code{`top'}, as in the case of |
---|
978 | \file{runup.py}. Instead the user specifies a list of |
---|
979 | tags appropriate to the configuration being modelled. |
---|
980 | |
---|
981 | In addition, the mesh-generator provides a way to adapt to geographic or |
---|
982 | other features in the landscape, whose presence may require an |
---|
983 | increase in resolution. This is done by allowing the user to specify |
---|
984 | a number of \emph{interior polygons}, each with a specified |
---|
985 | resolution. It is also |
---|
986 | possible to specify one or more `holes'---that is, areas bounded by |
---|
987 | polygons in which no triangulation is required. |
---|
988 | |
---|
989 | %\begin{figure}[hbt] |
---|
990 | % \caption{Interior meshes with individual resolution} |
---|
991 | % \label{fig:interior meshes} |
---|
992 | %\end{figure} |
---|
993 | |
---|
994 | In its general form, the mesh-generator takes for its input a bounding |
---|
995 | polygon and (optionally) a list of interior polygons. The user |
---|
996 | specifies resolutions, both for the bounding polygon and for each of |
---|
997 | the interior polygons. Given this data, the mesh-generator first creates a |
---|
998 | triangular mesh with varying resolution. |
---|
999 | |
---|
1000 | The function used to implement this process is |
---|
1001 | \function{create\_mesh\_from\_regions}. Its arguments include the |
---|
1002 | bounding polygon and its resolution, a list of boundary tags, and a |
---|
1003 | list of pairs \code{[polygon, resolution]}, specifying the interior |
---|
1004 | polygons and their resolutions. |
---|
1005 | |
---|
1006 | The resulting mesh is output to a \emph{mesh file}\index{mesh |
---|
1007 | file}\label{def:mesh file}. This term is used to describe a file of |
---|
1008 | a specific format used to store the data specifying a mesh. (There |
---|
1009 | are in fact two possible formats for such a file: it can either be a |
---|
1010 | binary file, with extension \code{.msh}, or an ASCII file, with |
---|
1011 | extension \code{.tsh}. In the present case, the binary file format |
---|
1012 | \code{.msh} is used. See Section \ref{sec:file formats} (page |
---|
1013 | \pageref{sec:file formats}) for more on file formats.) |
---|
1014 | |
---|
1015 | In practice, the details of the polygons used are read from a |
---|
1016 | separate file \file{project.py}. Here is a complete listing of |
---|
1017 | \file{project.py}: |
---|
1018 | |
---|
1019 | \verbatiminput{demos/cairns/project.py} |
---|
1020 | |
---|
1021 | Figure \ref{fig:cairns3d} illustrates the landscape of the region |
---|
1022 | for the Cairns example. Understanding the landscape is important in |
---|
1023 | determining the location and resolution of interior polygons. The |
---|
1024 | supporting data is found in the ASCII grid, \code{cairns.asc}, which |
---|
1025 | has been sourced from the publically available Australian Bathymetry |
---|
1026 | and Topography Grid 2005, \cite{grid250}. The required resolution |
---|
1027 | for inundation modelling will depend on the underlying topography and |
---|
1028 | bathymetry; as the terrain becomes more complex, the desired resolution |
---|
1029 | would decrease to the order of tens of metres. |
---|
1030 | |
---|
1031 | \begin{figure}[hbt] |
---|
1032 | \centerline{\includegraphics[scale=0.5]{graphics/cairns3.jpg}} |
---|
1033 | \caption{Landscape of the Cairns scenario.} |
---|
1034 | \label{fig:cairns3d} |
---|
1035 | |
---|
1036 | \end{figure} |
---|
1037 | The following statements are used to read in the specific polygons |
---|
1038 | from \code{project.cairns} and assign a defined resolution to |
---|
1039 | each polygon. |
---|
1040 | |
---|
1041 | {\small \begin{verbatim} |
---|
1042 | islands_res = 100000 |
---|
1043 | cairns_res = 100000 |
---|
1044 | shallow_res = 500000 |
---|
1045 | interior_regions = [[project.poly_cairns, cairns_res], |
---|
1046 | [project.poly_island0, islands_res], |
---|
1047 | [project.poly_island1, islands_res], |
---|
1048 | [project.poly_island2, islands_res], |
---|
1049 | [project.poly_island3, islands_res], |
---|
1050 | [project.poly_shallow, shallow_res]] |
---|
1051 | \end{verbatim}} |
---|
1052 | |
---|
1053 | Figure \ref{fig:cairnspolys} |
---|
1054 | illustrates the polygons used for the Cairns scenario. |
---|
1055 | |
---|
1056 | \begin{figure}[hbt] |
---|
1057 | |
---|
1058 | \centerline{\includegraphics[scale=0.5] |
---|
1059 | {graphics/cairnsmodel.jpg}} |
---|
1060 | \caption{Interior and bounding polygons for the Cairns example.} |
---|
1061 | \label{fig:cairnspolys} |
---|
1062 | \end{figure} |
---|
1063 | |
---|
1064 | The statement |
---|
1065 | |
---|
1066 | |
---|
1067 | {\small \begin{verbatim} |
---|
1068 | remainder_res = 10000000 |
---|
1069 | create_mesh_from_regions(project.bounding_polygon, |
---|
1070 | boundary_tags={'top': [0], |
---|
1071 | 'ocean_east': [1], |
---|
1072 | 'bottom': [2], |
---|
1073 | 'onshore': [3]}, |
---|
1074 | maximum_triangle_area=remainder_res, |
---|
1075 | filename=meshname, |
---|
1076 | interior_regions=interior_regions, |
---|
1077 | use_cache=True, |
---|
1078 | verbose=True) |
---|
1079 | \end{verbatim}} |
---|
1080 | is then used to create the mesh, taking the bounding polygon to be |
---|
1081 | the polygon \code{bounding\_polygon} specified in \file{project.py}. |
---|
1082 | The argument \code{boundary\_tags} assigns a dictionary, whose keys |
---|
1083 | are the names of the boundary tags used for the bounding |
---|
1084 | polygon---\code{`top'}, \code{`ocean\_east'}, \code{`bottom'}, and |
---|
1085 | \code{`onshore'}--- and whose values identify the indices of the |
---|
1086 | segments associated with each of these tags. |
---|
1087 | The polygon may be arranged either clock-wise or counter clock-wise and the |
---|
1088 | indices refer to edges in the order they appear: Edge 0 connects vertex 0 and vertex 1, edge 1 connects vertex 1 and 2; and so forth. |
---|
1089 | (Here, the values associated with each boundary tag are one-element lists, but they can have as many indices as there are edges) |
---|
1090 | If polygons intersect, or edges coincide the resolution may be undefined in some regions. |
---|
1091 | Use the underlying mesh interface for such cases. See Section |
---|
1092 | \ref{sec:mesh interface}. |
---|
1093 | |
---|
1094 | Note that every point on each polygon defining the mesh will be used as vertices in triangles. |
---|
1095 | Consequently, polygons with points very close together will cause triangles with very small |
---|
1096 | areas to be generated irrespective of the requested resolution. |
---|
1097 | Make sure points on polygons are spaced to be no closer than the smallest resolution requested. |
---|
1098 | |
---|
1099 | |
---|
1100 | \subsection{Initialising the Domain} |
---|
1101 | |
---|
1102 | As with \file{runup.py}, once we have created the mesh, the next |
---|
1103 | step is to create the data structure \code{domain}. We did this for |
---|
1104 | \file{runup.py} by inputting lists of points and triangles and |
---|
1105 | specifying the boundary tags directly. However, in the present case, |
---|
1106 | we use a method that works directly with the mesh file |
---|
1107 | \code{meshname}, as follows: |
---|
1108 | |
---|
1109 | |
---|
1110 | {\small \begin{verbatim} |
---|
1111 | domain = Domain(meshname, use_cache=True, verbose=True) |
---|
1112 | \end{verbatim}} |
---|
1113 | |
---|
1114 | Providing a filename instead of the lists used in \file{runup.py} |
---|
1115 | above causes \code{Domain} to convert a mesh file \code{meshname} |
---|
1116 | into an instance of \code{Domain}, allowing us to use methods like |
---|
1117 | \method{set\_quantity} to set quantities and to apply other |
---|
1118 | operations. |
---|
1119 | |
---|
1120 | %(In principle, the |
---|
1121 | %second argument of \function{pmesh\_to\_domain\_instance} can be any |
---|
1122 | %subclass of \class{Domain}, but for applications involving the |
---|
1123 | %shallow-water wave equation, the second argument of |
---|
1124 | %\function{pmesh\_to\_domain\_instance} can always be set simply to |
---|
1125 | %\class{Domain}.) |
---|
1126 | |
---|
1127 | The following statements specify a basename and data directory, and |
---|
1128 | identify quantities to be stored. For the first two, values are |
---|
1129 | taken from \file{project.py}. |
---|
1130 | |
---|
1131 | {\small \begin{verbatim} |
---|
1132 | domain.set_name(project.basename) |
---|
1133 | domain.set_datadir(project.outputdir) |
---|
1134 | domain.set_quantities_to_be_stored(['stage', 'xmomentum', |
---|
1135 | 'ymomentum']) |
---|
1136 | \end{verbatim}} |
---|
1137 | |
---|
1138 | |
---|
1139 | \subsection{Initial Conditions} |
---|
1140 | Quantities for \file{runcairns.py} are set |
---|
1141 | using similar methods to those in \file{runup.py}. However, |
---|
1142 | in this case, many of the values are read from the auxiliary file |
---|
1143 | \file{project.py} or, in the case of \code{elevation}, from an |
---|
1144 | ancillary points file. |
---|
1145 | |
---|
1146 | |
---|
1147 | |
---|
1148 | \subsubsection{Stage} |
---|
1149 | |
---|
1150 | For the scenario we are modelling in this case, we use a callable |
---|
1151 | object \code{tsunami\_source}, assigned by means of a function |
---|
1152 | \function{slide\_tsunami}. This is similar to how we set elevation in |
---|
1153 | \file{runup.py} using a function---however, in this case the |
---|
1154 | function is both more complex and more interesting. |
---|
1155 | |
---|
1156 | The function returns the water displacement for all \code{x} and |
---|
1157 | \code{y} in the domain. The water displacement is a double Gaussian |
---|
1158 | function that depends on the characteristics of the slide (length, |
---|
1159 | width, thickness, slope, etc), its location (origin) and the depth at that |
---|
1160 | location. For this example, we choose to apply the slide function |
---|
1161 | at a specified time into the simulation. {\bf Note, the parameters used |
---|
1162 | in this example have been deliberately chosen to generate a suitably |
---|
1163 | large amplitude tsunami which would inundate the Cairns region.} |
---|
1164 | |
---|
1165 | \subsubsection{Friction} |
---|
1166 | |
---|
1167 | We assign the friction exactly as we did for \file{runup.py}: |
---|
1168 | |
---|
1169 | {\small \begin{verbatim} |
---|
1170 | domain.set_quantity('friction', 0.0) |
---|
1171 | \end{verbatim}} |
---|
1172 | |
---|
1173 | |
---|
1174 | \subsubsection{Elevation} |
---|
1175 | |
---|
1176 | The elevation is specified by reading data from a file: |
---|
1177 | |
---|
1178 | {\small \begin{verbatim} |
---|
1179 | domain.set_quantity('elevation', |
---|
1180 | filename = project.dem_name + '.pts', |
---|
1181 | use_cache = True, |
---|
1182 | verbose = True) |
---|
1183 | \end{verbatim}} |
---|
1184 | |
---|
1185 | %However, before this step can be executed, some preliminary steps |
---|
1186 | %are needed to prepare the file from which the data is taken. Two |
---|
1187 | %source files are used for this data---their names are specified in |
---|
1188 | %the file \file{project.py}, in the variables \code{coarsedemname} |
---|
1189 | %and \code{finedemname}. They contain `coarse' and `fine' data, |
---|
1190 | %respectively---that is, data sampled at widely spaced points over a |
---|
1191 | %large region and data sampled at closely spaced points over a |
---|
1192 | %smaller subregion. The data in these files is combined through the |
---|
1193 | %statement |
---|
1194 | |
---|
1195 | %{\small \begin{verbatim} |
---|
1196 | %combine_rectangular_points_files(project.finedemname + '.pts', |
---|
1197 | % project.coarsedemname + '.pts', |
---|
1198 | % project.combineddemname + '.pts') |
---|
1199 | %\end{verbatim}} |
---|
1200 | %The effect of this is simply to combine the datasets by eliminating |
---|
1201 | %any coarse data associated with points inside the smaller region |
---|
1202 | %common to both datasets. The name to be assigned to the resulting |
---|
1203 | %dataset is also derived from the name stored in the variable |
---|
1204 | %\code{combinedname} in the file \file{project.py}. |
---|
1205 | |
---|
1206 | \subsection{Boundary Conditions}\index{boundary conditions} |
---|
1207 | |
---|
1208 | Setting boundaries follows a similar pattern to the one used for |
---|
1209 | \file{runup.py}, except that in this case we need to associate a |
---|
1210 | boundary type with each of the |
---|
1211 | boundary tag names introduced when we established the mesh. In place of the four |
---|
1212 | boundary types introduced for \file{runup.py}, we use the reflective |
---|
1213 | boundary for each of the |
---|
1214 | eight tagged segments defined by \code{create_mesh_from_regions}: |
---|
1215 | |
---|
1216 | {\small \begin{verbatim} |
---|
1217 | Bd = Dirichlet_boundary([0.0,0.0,0.0]) |
---|
1218 | domain.set_boundary( {'ocean_east': Bd, 'bottom': Bd, 'onshore': Bd, |
---|
1219 | 'top': Bd} ) |
---|
1220 | \end{verbatim}} |
---|
1221 | |
---|
1222 | \subsection{Evolution} |
---|
1223 | |
---|
1224 | With the basics established, the running of the `evolve' step is |
---|
1225 | very similar to the corresponding step in \file{runup.py}. For the slide |
---|
1226 | scenario, |
---|
1227 | the simulation is run for 5000 seconds with the output stored every ten seconds. |
---|
1228 | For this example, we choose to apply the slide at 60 seconds into the simulation. |
---|
1229 | |
---|
1230 | {\small \begin{verbatim} |
---|
1231 | import time t0 = time.time() |
---|
1232 | |
---|
1233 | |
---|
1234 | for t in domain.evolve(yieldstep = 10, finaltime = 60): |
---|
1235 | domain.write_time() |
---|
1236 | domain.write_boundary_statistics(tags = 'ocean_east') |
---|
1237 | |
---|
1238 | # add slide |
---|
1239 | thisstagestep = domain.get_quantity('stage') |
---|
1240 | if allclose(t, 60): |
---|
1241 | slide = Quantity(domain) |
---|
1242 | slide.set_values(tsunami_source) |
---|
1243 | domain.set_quantity('stage', slide + thisstagestep) |
---|
1244 | |
---|
1245 | for t in domain.evolve(yieldstep = 10, finaltime = 5000, |
---|
1246 | skip_initial_step = True): |
---|
1247 | domain.write_time() |
---|
1248 | domain.write_boundary_statistics(tags = 'ocean_east') |
---|
1249 | \end{verbatim}} |
---|
1250 | |
---|
1251 | For the fixed wave scenario, the simulation is run to 10000 seconds, |
---|
1252 | with the first half of the simulation stored at two minute intervals, |
---|
1253 | and the second half of the simulation stored at ten second intervals. |
---|
1254 | This functionality is especially convenient as it allows the detailed |
---|
1255 | parts of the simulation to be viewed at higher time resolution. |
---|
1256 | |
---|
1257 | |
---|
1258 | {\small \begin{verbatim} |
---|
1259 | |
---|
1260 | # save every two mins leading up to wave approaching land |
---|
1261 | for t in domain.evolve(yieldstep = 120, finaltime = 5000): |
---|
1262 | domain.write_time() |
---|
1263 | domain.write_boundary_statistics(tags = 'ocean_east') |
---|
1264 | |
---|
1265 | # save every 30 secs as wave starts inundating ashore |
---|
1266 | for t in domain.evolve(yieldstep = 10, finaltime = 10000, |
---|
1267 | skip_initial_step = True): |
---|
1268 | domain.write_time() |
---|
1269 | domain.write_boundary_statistics(tags = 'ocean_east') |
---|
1270 | |
---|
1271 | \end{verbatim}} |
---|
1272 | |
---|
1273 | \section{Exploring the Model Output} |
---|
1274 | |
---|
1275 | Now that the scenario has been run, the user can view the output in a number of ways. |
---|
1276 | As described earlier, the user may run animate to view a three-dimensional representation |
---|
1277 | of the simulation. |
---|
1278 | |
---|
1279 | The user may also be interested in a maximum inundation map. This simply shows the |
---|
1280 | maximum water depth over the domain and is achieved with the function sww2dem (described in |
---|
1281 | Section \ref{sec:basicfileconversions}). |
---|
1282 | \file{ExportResults.py} demonstrates how this function can be used: |
---|
1283 | |
---|
1284 | \verbatiminput{demos/cairns/ExportResults.py} |
---|
1285 | |
---|
1286 | The script generates an maximum water depth ASCII grid at a defined |
---|
1287 | resolution (here 100 m$^2$) which can then be viewed in a GIS environment, for |
---|
1288 | example. The parameters used in the function are defined in \file{project.py}. |
---|
1289 | Figures \ref{fig:maxdepthcairnsslide} and \ref{fig:maxdepthcairnsfixedwave} show |
---|
1290 | the maximum water depth within the defined region for the slide and fixed wave scenario |
---|
1291 | respectively. {\bf Note, these inundation maps have been based on purely hypothetical |
---|
1292 | scenarios and were designed explicitly for demonstration purposes only.} |
---|
1293 | The user could develop a maximum absolute momentum or other expressions which can be |
---|
1294 | derived from the quantities. |
---|
1295 | It must be noted here that depth is more meaningful when the elevation is positive |
---|
1296 | (\code{depth} = \code{stage} $-$ \code{elevation}) as it describes the water height |
---|
1297 | above the available elevation. When the elevation is negative, depth is meauring the |
---|
1298 | water height from the sea floor. With this in mind, maximum inundation maps are |
---|
1299 | typically "clipped" to the coastline. However, the data input here did not contain a |
---|
1300 | coastline. |
---|
1301 | |
---|
1302 | \begin{figure}[hbt] |
---|
1303 | \centerline{\includegraphics[scale=0.5]{graphics/slidedepth.jpg}} |
---|
1304 | \caption{Maximum inundation map for the Cairns slide scenario. \bf Note, this |
---|
1305 | inundaiton map has been based on a purely hypothetical scenario which was |
---|
1306 | designed explictiy for demonstration purposes only.} |
---|
1307 | \label{fig:maxdepthcairnsslide} |
---|
1308 | \end{figure} |
---|
1309 | |
---|
1310 | \begin{figure}[hbt] |
---|
1311 | \centerline{\includegraphics[scale=0.5]{graphics/fixedwavedepth.jpg}} |
---|
1312 | \caption{Maximum inundation map for the Cairns fixed wave scenario. |
---|
1313 | \bf Note, this |
---|
1314 | inundaiton map has been based on a purely hypothetical scenario which was |
---|
1315 | designed explictiy for demonstration purposes only.} |
---|
1316 | \label{fig:maxdepthcairnsfixedwave} |
---|
1317 | \end{figure} |
---|
1318 | |
---|
1319 | The user may also be interested in interrogating the solution at a particular spatial |
---|
1320 | location to understand the behaviour of the system through time. To do this, the user |
---|
1321 | must first define the locations of interest. A number of locations have been |
---|
1322 | identified for the Cairns scenario, as shown in Figure \ref{fig:cairnsgauges}. |
---|
1323 | |
---|
1324 | \begin{figure}[hbt] |
---|
1325 | \centerline{\includegraphics[scale=0.5]{graphics/cairnsgauges.jpg}} |
---|
1326 | \caption{Point locations to show time series information for the Cairns scenario.} |
---|
1327 | \label{fig:cairnsgauges} |
---|
1328 | \end{figure} |
---|
1329 | |
---|
1330 | These locations |
---|
1331 | must be stored in either a .csv or .txt file. The corresponding .csv file for |
---|
1332 | the gauges shown in Figure \ref{fig:cairnsgauges} is \file{gauges.csv} |
---|
1333 | |
---|
1334 | \verbatiminput{demos/cairns/gauges.csv} |
---|
1335 | |
---|
1336 | Header information has been included to identify the location in terms of eastings and |
---|
1337 | northings, and each gauge is given a name. The elevation column can be zero here. |
---|
1338 | This information is then passed to the function \code{sww2csv_gauges} (shown in |
---|
1339 | \file{GetTimeseries.py} which generates the csv files for each point location. The csv files |
---|
1340 | can then be used in \code{csv2timeseries_graphs} to create the timeseries plot for each desired |
---|
1341 | quantity. \code{csv2timeseries_graphs} relies on \code{pylab} to be installed which is not part |
---|
1342 | of the standard \code{anuga} release, however it can be downloaded and installed from \code{http://matplotlib.sourceforge.net/} |
---|
1343 | |
---|
1344 | \verbatiminput{demos/cairns/GetTimeseries.py} |
---|
1345 | |
---|
1346 | Here, the time series for the quantities stage, depth and speed will be generated for |
---|
1347 | each gauge defined in the gauge file. As described earlier, depth is more meaningful |
---|
1348 | for onshore gauges, and stage is more appropriate for offshore gauges. |
---|
1349 | |
---|
1350 | As an example output, |
---|
1351 | Figure \ref{fig:reef} shows the time series for the quantity stage for the |
---|
1352 | Elford Reef location for each scenario (the elevation at this location is negative, |
---|
1353 | therefore stage is the more appropriate quantity to plot). Note the large negative stage value when the slide was |
---|
1354 | introduced. This is due to the double gaussian form of the initial surface |
---|
1355 | displacement of the slide. By contrast, the time series for depth is shown for the onshore location of the Cairns |
---|
1356 | Airport in Figure \ref{fig:airportboth}. |
---|
1357 | |
---|
1358 | \begin{figure}[hbt] |
---|
1359 | \centerline{\includegraphics[scale=0.5]{graphics/gaugeElfordReefstage.png}} |
---|
1360 | \caption{Time series information of the quantity stage for the Elford Reef location for the |
---|
1361 | fixed wave and slide scenario.} |
---|
1362 | \label{fig:reef} |
---|
1363 | \end{figure} |
---|
1364 | |
---|
1365 | \begin{figure}[hbt] |
---|
1366 | \centerline{\includegraphics[scale=0.5]{graphics/gaugeCairnsAirportdepth.png}} |
---|
1367 | \caption{Time series information of the quantity depth for the Cairns Airport |
---|
1368 | location for the slide and fixed wave scenario.} |
---|
1369 | \label{fig:airportboth} |
---|
1370 | \end{figure} |
---|
1371 | |
---|
1372 | |
---|
1373 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1374 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
1375 | |
---|
1376 | \chapter{\anuga Public Interface} |
---|
1377 | \label{ch:interface} |
---|
1378 | |
---|
1379 | This chapter gives an overview of the features of \anuga available |
---|
1380 | to the user at the public interface. These are grouped under the |
---|
1381 | following headings, which correspond to the outline of the examples |
---|
1382 | described in Chapter \ref{ch:getstarted}: |
---|
1383 | |
---|
1384 | \begin{itemize} |
---|
1385 | \item Establishing the Mesh |
---|
1386 | \item Initialising the Domain |
---|
1387 | \item Specifying the Quantities |
---|
1388 | \item Initial Conditions |
---|
1389 | \item Boundary Conditions |
---|
1390 | \item Forcing Functions |
---|
1391 | \item Evolution |
---|
1392 | \end{itemize} |
---|
1393 | |
---|
1394 | The listings are intended merely to give the reader an idea of what |
---|
1395 | each feature is, where to find it and how it can be used---they do |
---|
1396 | not give full specifications; for these the reader |
---|
1397 | may consult the code. The code for every function or class contains |
---|
1398 | a documentation string, or `docstring', that specifies the precise |
---|
1399 | syntax for its use. This appears immediately after the line |
---|
1400 | introducing the code, between two sets of triple quotes. |
---|
1401 | |
---|
1402 | Each listing also describes the location of the module in which |
---|
1403 | the code for the feature being described can be found. All modules |
---|
1404 | are in the folder \file{inundation} or one of its subfolders, and the |
---|
1405 | location of each module is described relative to \file{inundation}. Rather |
---|
1406 | than using pathnames, whose syntax depends on the operating system, |
---|
1407 | we use the format adopted for importing the function or class for |
---|
1408 | use in Python code. For example, suppose we wish to specify that the |
---|
1409 | function \function{create\_mesh\_from\_regions} is in a module called |
---|
1410 | \module{mesh\_interface} in a subfolder of \module{inundation} called |
---|
1411 | \code{pmesh}. In Linux or Unix syntax, the pathname of the file |
---|
1412 | containing the function, relative to \file{inundation}, would be |
---|
1413 | |
---|
1414 | \begin{center} |
---|
1415 | % \code{pmesh/mesh\_interface.py} |
---|
1416 | \code{pmesh}$\slash$\code{mesh\_interface.py} |
---|
1417 | \end{center} |
---|
1418 | \label{sec:mesh interface} |
---|
1419 | |
---|
1420 | while in Windows syntax it would be |
---|
1421 | |
---|
1422 | \begin{center} |
---|
1423 | \code{pmesh}$\backslash$\code{mesh\_interface.py} |
---|
1424 | \end{center} |
---|
1425 | |
---|
1426 | Rather than using either of these forms, in this chapter we specify |
---|
1427 | the location simply as \code{pmesh.mesh\_interface}, in keeping with |
---|
1428 | the usage in the Python statement for importing the function, |
---|
1429 | namely: |
---|
1430 | \begin{center} |
---|
1431 | \code{from pmesh.mesh\_interface import create\_mesh\_from\_regions} |
---|
1432 | \end{center} |
---|
1433 | |
---|
1434 | Each listing details the full set of parameters for the class or |
---|
1435 | function; however, the description is generally limited to the most |
---|
1436 | important parameters and the reader is again referred to the code |
---|
1437 | for more details. |
---|
1438 | |
---|
1439 | The following parameters are common to many functions and classes |
---|
1440 | and are omitted from the descriptions given below: |
---|
1441 | |
---|
1442 | %\begin{center} |
---|
1443 | \begin{tabular}{ll} %\hline |
---|
1444 | %\textbf{Name } & \textbf{Description}\\ |
---|
1445 | %\hline |
---|
1446 | \emph{use\_cache} & Specifies whether caching is to be used for improved performance. See Section \ref{sec:caching} for details on the underlying caching functionality\\ |
---|
1447 | \emph{verbose} & If \code{True}, provides detailed terminal output |
---|
1448 | to the user\\ % \hline |
---|
1449 | \end{tabular} |
---|
1450 | %\end{center} |
---|
1451 | |
---|
1452 | \section{Mesh Generation} |
---|
1453 | |
---|
1454 | Before discussing the part of the interface relating to mesh |
---|
1455 | generation, we begin with a description of a simple example of a |
---|
1456 | mesh and use it to describe how mesh data is stored. |
---|
1457 | |
---|
1458 | \label{sec:meshexample} Figure \ref{fig:simplemesh} represents a |
---|
1459 | very simple mesh comprising just 11 points and 10 triangles. |
---|
1460 | |
---|
1461 | |
---|
1462 | \begin{figure}[h] |
---|
1463 | \begin{center} |
---|
1464 | \includegraphics[width=90mm, height=90mm]{triangularmesh.jpg} |
---|
1465 | \end{center} |
---|
1466 | |
---|
1467 | \caption{A simple mesh} |
---|
1468 | \label{fig:simplemesh} |
---|
1469 | \end{figure} |
---|
1470 | |
---|
1471 | |
---|
1472 | The variables \code{points}, \code{vertices} and \code{boundary} |
---|
1473 | represent the data displayed in Figure \ref{fig:simplemesh} as |
---|
1474 | follows. The list \code{points} stores the coordinates of the |
---|
1475 | points, and may be displayed schematically as in Table |
---|
1476 | \ref{tab:points}. |
---|
1477 | |
---|
1478 | |
---|
1479 | \begin{table} |
---|
1480 | \begin{center} |
---|
1481 | \begin{tabular}[t]{|c|cc|} \hline |
---|
1482 | index & \code{x} & \code{y}\\ \hline |
---|
1483 | 0 & 1 & 1\\ |
---|
1484 | 1 & 4 & 2\\ |
---|
1485 | 2 & 8 & 1\\ |
---|
1486 | 3 & 1 & 3\\ |
---|
1487 | 4 & 5 & 5\\ |
---|
1488 | 5 & 8 & 6\\ |
---|
1489 | 6 & 11 & 5\\ |
---|
1490 | 7 & 3 & 6\\ |
---|
1491 | 8 & 1 & 8\\ |
---|
1492 | 9 & 4 & 9\\ |
---|
1493 | 10 & 10 & 7\\ \hline |
---|
1494 | \end{tabular} |
---|
1495 | \end{center} |
---|
1496 | |
---|
1497 | \caption{Point coordinates for mesh in |
---|
1498 | Figure \protect \ref{fig:simplemesh}} |
---|
1499 | \label{tab:points} |
---|
1500 | \end{table} |
---|
1501 | |
---|
1502 | The list \code{vertices} specifies the triangles that make up the |
---|
1503 | mesh. It does this by specifying, for each triangle, the indices |
---|
1504 | (the numbers shown in the first column above) that correspond to the |
---|
1505 | three points at its vertices, taken in an anti-clockwise order |
---|
1506 | around the triangle. Thus, in the example shown in Figure |
---|
1507 | \ref{fig:simplemesh}, the variable \code{vertices} contains the |
---|
1508 | entries shown in Table \ref{tab:vertices}. The starting point is |
---|
1509 | arbitrary so triangle $(0,1,3)$ is considered the same as $(1,3,0)$ |
---|
1510 | and $(3,0,1)$. |
---|
1511 | |
---|
1512 | |
---|
1513 | \begin{table} |
---|
1514 | \begin{center} |
---|
1515 | \begin{tabular}{|c|ccc|} \hline |
---|
1516 | index & \multicolumn{3}{c|}{\code{vertices}}\\ \hline |
---|
1517 | 0 & 0 & 1 & 3\\ |
---|
1518 | 1 & 1 & 2 & 4\\ |
---|
1519 | 2 & 2 & 5 & 4\\ |
---|
1520 | 3 & 2 & 6 & 5\\ |
---|
1521 | 4 & 4 & 5 & 9\\ |
---|
1522 | 5 & 4 & 9 & 7\\ |
---|
1523 | 6 & 3 & 4 & 7\\ |
---|
1524 | 7 & 7 & 9 & 8\\ |
---|
1525 | 8 & 1 & 4 & 3\\ |
---|
1526 | 9 & 5 & 10 & 9\\ \hline |
---|
1527 | \end{tabular} |
---|
1528 | \end{center} |
---|
1529 | |
---|
1530 | \caption{Vertices for mesh in Figure \protect \ref{fig:simplemesh}} |
---|
1531 | \label{tab:vertices} |
---|
1532 | \end{table} |
---|
1533 | |
---|
1534 | Finally, the variable \code{boundary} identifies the boundary |
---|
1535 | triangles and associates a tag with each. |
---|
1536 | |
---|
1537 | \refmodindex[pmesh.meshinterface]{pmesh.mesh\_interface}\label{sec:meshgeneration} |
---|
1538 | |
---|
1539 | \begin{funcdesc} {create\_mesh\_from\_regions}{bounding_polygon, |
---|
1540 | boundary_tags, |
---|
1541 | maximum_triangle_area, |
---|
1542 | filename=None, |
---|
1543 | interior_regions=None, |
---|
1544 | poly_geo_reference=None, |
---|
1545 | mesh_geo_reference=None, |
---|
1546 | minimum_triangle_angle=28.0} |
---|
1547 | Module: \module{pmesh.mesh\_interface} |
---|
1548 | |
---|
1549 | This function allows a user to initiate the automatic creation of a |
---|
1550 | mesh inside a specified polygon (input \code{bounding_polygon}). |
---|
1551 | Among the parameters that can be set are the \emph{resolution} |
---|
1552 | (maximal area for any triangle in the mesh) and the minimal angle |
---|
1553 | allowable in any triangle. The user can specify a number of internal |
---|
1554 | polygons within each of which the resolution of the mesh can be |
---|
1555 | specified. \code{interior_regions} is a paired list containing the |
---|
1556 | interior polygon and its resolution. Additionally, the user specifies |
---|
1557 | a list of boundary tags, one for each edge of the bounding polygon. |
---|
1558 | |
---|
1559 | \textbf{WARNING}. Note that the dictionary structure used for the |
---|
1560 | parameter \code{boundary\_tags} is different from that used for the |
---|
1561 | variable \code{boundary} that occurs in the specification of a mesh. |
---|
1562 | In the case of \code{boundary}, the tags are the \emph{values} of |
---|
1563 | the dictionary, whereas in the case of \code{boundary_tags}, the |
---|
1564 | tags are the \emph{keys} and the \emph{value} corresponding to a |
---|
1565 | particular tag is a list of numbers identifying boundary edges |
---|
1566 | labelled with that tag. Because of this, it is theoretically |
---|
1567 | possible to assign the same edge to more than one tag. However, an |
---|
1568 | attempt to do this will cause an error. |
---|
1569 | |
---|
1570 | \textbf{WARNING}. Do not have polygon lines cross or be on-top of each |
---|
1571 | other. This can result in regions of unspecified resolutions. Do |
---|
1572 | not have polygon close to each other. This can result in the area |
---|
1573 | between the polygons having small triangles. For more control |
---|
1574 | over the mesh outline use the methods described below. |
---|
1575 | |
---|
1576 | \end{funcdesc} |
---|
1577 | |
---|
1578 | |
---|
1579 | |
---|
1580 | \subsection{Advanced mesh generation} |
---|
1581 | |
---|
1582 | For more control over the creation of the mesh outline, use the |
---|
1583 | methods of the class \class{Mesh}. |
---|
1584 | |
---|
1585 | |
---|
1586 | \begin{classdesc} {Mesh}{userSegments=None, |
---|
1587 | userVertices=None, |
---|
1588 | holes=None, |
---|
1589 | regions=None} |
---|
1590 | Module: \module{pmesh.mesh} |
---|
1591 | |
---|
1592 | A class used to build a mesh outline and generate a two-dimensional |
---|
1593 | triangular mesh. The mesh outline is used to describe features on the |
---|
1594 | mesh, such as the mesh boundary. Many of this classes methods are used |
---|
1595 | to build a mesh outline, such as \code{add\_vertices} and |
---|
1596 | \code{add\_region\_from\_polygon}. |
---|
1597 | |
---|
1598 | \end{classdesc} |
---|
1599 | |
---|
1600 | |
---|
1601 | \subsubsection{Key Methods of Class Mesh} |
---|
1602 | |
---|
1603 | |
---|
1604 | \begin{methoddesc} {add\_hole}{x,y} |
---|
1605 | Module: \module{pmesh.mesh}, Class: \class{Mesh} |
---|
1606 | |
---|
1607 | This method is used to build the mesh outline. It defines a hole, |
---|
1608 | when the boundary of the hole has already been defined, by selecting a |
---|
1609 | point within the boundary. |
---|
1610 | |
---|
1611 | \end{methoddesc} |
---|
1612 | |
---|
1613 | |
---|
1614 | \begin{methoddesc} {add\_hole\_from\_polygon}{self, polygon, tags=None} |
---|
1615 | Module: \module{pmesh.mesh}, Class: \class{Mesh} |
---|
1616 | |
---|
1617 | This method is used to add a `hole' within a region ---that is, to |
---|
1618 | define a interior region where the triangular mesh will not be |
---|
1619 | generated---to a \class{Mesh} instance. The region boundary is described by |
---|
1620 | the polygon passed in. Additionally, the user specifies a list of |
---|
1621 | boundary tags, one for each edge of the bounding polygon. |
---|
1622 | \end{methoddesc} |
---|
1623 | |
---|
1624 | |
---|
1625 | \begin{methoddesc} {add\_points_and_segments}{self, points, segments, |
---|
1626 | segment\_tags=None} |
---|
1627 | Module: \module{pmesh.mesh}, Class: \class{Mesh} |
---|
1628 | |
---|
1629 | This method is used to build the mesh outline. It adds points and |
---|
1630 | segments connecting the points. A tag for each segment can optionally |
---|
1631 | be added. |
---|
1632 | |
---|
1633 | \end{methoddesc} |
---|
1634 | |
---|
1635 | \begin{methoddesc} {add\_region}{x,y} |
---|
1636 | Module: \module{pmesh.mesh}, Class: \class{Mesh} |
---|
1637 | |
---|
1638 | This method is used to build the mesh outline. It defines a region, |
---|
1639 | when the boundary of the region has already been defined, by selecting |
---|
1640 | a point within the boundary. A region instance is returned. This can |
---|
1641 | be used to set the resolution. |
---|
1642 | |
---|
1643 | \end{methoddesc} |
---|
1644 | |
---|
1645 | \begin{methoddesc} {add\_region\_from\_polygon}{self, polygon, |
---|
1646 | segment_tags=None, region_tag=None |
---|
1647 | max_triangle_area=None} |
---|
1648 | Module: \module{pmesh.mesh}, Class: \class{Mesh} |
---|
1649 | |
---|
1650 | This method is used to build the mesh outline. It adds a region to a |
---|
1651 | \class{Mesh} instance. Regions are commonly used to describe an area |
---|
1652 | with an increased density of triangles, by setting |
---|
1653 | \code{max_triangle_area}. The |
---|
1654 | region boundary is described by the input \code{polygon}. Additionally, the |
---|
1655 | user specifies a list of segment tags, one for each edge of the |
---|
1656 | bounding polygon. The regional tag is set using \code{region}. |
---|
1657 | |
---|
1658 | \end{methoddesc} |
---|
1659 | |
---|
1660 | |
---|
1661 | |
---|
1662 | |
---|
1663 | |
---|
1664 | \begin{methoddesc} {add\_vertices}{point_data} |
---|
1665 | Module: \module{pmesh.mesh}, Class: \class{Mesh} |
---|
1666 | |
---|
1667 | Add user vertices. The point_data can be a list of (x,y) values, a numeric |
---|
1668 | array or a geospatial_data instance. |
---|
1669 | \end{methoddesc} |
---|
1670 | |
---|
1671 | \begin{methoddesc} {auto\_segment}{raw_boundary=raw_boundary, |
---|
1672 | remove_holes=remove_holes, |
---|
1673 | smooth_indents=smooth_indents, |
---|
1674 | expand_pinch=expand_pinch} |
---|
1675 | Module: \module{pmesh.mesh}, Class: \class{Mesh} |
---|
1676 | |
---|
1677 | Add segments between some of the user vertices to give the vertices an |
---|
1678 | outline. The outline is an alpha shape. This method is |
---|
1679 | useful since a set of user vertices need to be outlined by segments |
---|
1680 | before generate_mesh is called. |
---|
1681 | |
---|
1682 | \end{methoddesc} |
---|
1683 | |
---|
1684 | \begin{methoddesc} {export\_mesh_file}{self,ofile} |
---|
1685 | Module: \module{pmesh.mesh}, Class: \class{Mesh} |
---|
1686 | |
---|
1687 | This method is used to save the mesh to a file. \code{ofile} is the |
---|
1688 | name of the mesh file to be written, including the extension. Use |
---|
1689 | the extension \code{.msh} for the file to be in NetCDF format and |
---|
1690 | \code{.tsh} for the file to be ASCII format. |
---|
1691 | \end{methoddesc} |
---|
1692 | |
---|
1693 | \begin{methoddesc} {generate\_mesh}{self, |
---|
1694 | maximum_triangle_area=None, |
---|
1695 | minimum_triangle_angle=28.0, |
---|
1696 | verbose=False} |
---|
1697 | Module: \module{pmesh.mesh}, Class: \class{Mesh} |
---|
1698 | |
---|
1699 | This method is used to generate the triangular mesh. The maximal |
---|
1700 | area of any triangle in the mesh can be specified, which is used to |
---|
1701 | control the triangle density, along with the |
---|
1702 | minimum angle in any triangle. |
---|
1703 | \end{methoddesc} |
---|
1704 | |
---|
1705 | |
---|
1706 | |
---|
1707 | \begin{methoddesc} {import_ungenerate_file}{self,ofile, tag=None, |
---|
1708 | region_tag=None} |
---|
1709 | Module: \module{pmesh.mesh}, Class: \class{Mesh} |
---|
1710 | |
---|
1711 | This method is used to import a polygon file in the ungenerate format, |
---|
1712 | which is used by arcGIS. The polygons from the file are converted to |
---|
1713 | vertices and segments. \code{ofile} is the name of the polygon file. |
---|
1714 | \code{tag} is the tag given to all the polygon's segments. |
---|
1715 | \code{region_tag} is the tag given to all the polygon's segments. If |
---|
1716 | it is a string the one value will be assigned to all regions. If it |
---|
1717 | is a list the first value in the list will be applied to the first |
---|
1718 | polygon etc. |
---|
1719 | |
---|
1720 | This function can be used to import building footprints. |
---|
1721 | \end{methoddesc} |
---|
1722 | |
---|
1723 | %%%%%% |
---|
1724 | \section{Initialising the Domain} |
---|
1725 | |
---|
1726 | %Include description of the class Domain and the module domain. |
---|
1727 | |
---|
1728 | %FIXME (Ole): This is also defined in a later chapter |
---|
1729 | %\declaremodule{standard}{...domain} |
---|
1730 | |
---|
1731 | \begin{classdesc} {Domain} {source=None, |
---|
1732 | triangles=None, |
---|
1733 | boundary=None, |
---|
1734 | conserved_quantities=None, |
---|
1735 | other_quantities=None, |
---|
1736 | tagged_elements=None, |
---|
1737 | use_inscribed_circle=False, |
---|
1738 | mesh_filename=None, |
---|
1739 | use_cache=False, |
---|
1740 | verbose=False, |
---|
1741 | full_send_dict=None, |
---|
1742 | ghost_recv_dict=None, |
---|
1743 | processor=0, |
---|
1744 | numproc=1} |
---|
1745 | Module: \refmodule{abstract_2d_finite_volumes.domain} |
---|
1746 | |
---|
1747 | This class is used to create an instance of a data structure used to |
---|
1748 | store and manipulate data associated with a mesh. The mesh is |
---|
1749 | specified either by assigning the name of a mesh file to |
---|
1750 | \code{source} or by specifying the points, triangle and boundary of the |
---|
1751 | mesh. |
---|
1752 | \end{classdesc} |
---|
1753 | |
---|
1754 | \subsection{Key Methods of Domain} |
---|
1755 | |
---|
1756 | \begin{methoddesc} {set\_name}{name} |
---|
1757 | Module: \refmodule{abstract\_2d\_finite\_volumes.domain}, |
---|
1758 | page \pageref{mod:domain} |
---|
1759 | |
---|
1760 | Assigns the name \code{name} to the domain. |
---|
1761 | \end{methoddesc} |
---|
1762 | |
---|
1763 | \begin{methoddesc} {get\_name}{} |
---|
1764 | Module: \module{abstract\_2d\_finite\_volumes.domain} |
---|
1765 | |
---|
1766 | Returns the name assigned to the domain by \code{set\_name}. If no name has been |
---|
1767 | assigned, returns \code{`domain'}. |
---|
1768 | \end{methoddesc} |
---|
1769 | |
---|
1770 | \begin{methoddesc} {set\_datadir}{name} |
---|
1771 | Module: \module{abstract\_2d\_finite\_volumes.domain} |
---|
1772 | |
---|
1773 | Specifies the directory used for SWW files, assigning it to the |
---|
1774 | pathname \code{name}. The default value, before |
---|
1775 | \code{set\_datadir} has been run, is the value \code{default\_datadir} |
---|
1776 | specified in \code{config.py}. |
---|
1777 | |
---|
1778 | Since different operating systems use different formats for specifying pathnames, |
---|
1779 | it is necessary to specify path separators using the Python code \code{os.sep}, rather than |
---|
1780 | the operating-specific ones such as `$\slash$' or `$\backslash$'. |
---|
1781 | For this to work you will need to include the statement \code{import os} |
---|
1782 | in your code, before the first appearance of \code{set\_datadir}. |
---|
1783 | |
---|
1784 | For example, to set the data directory to a subdirectory |
---|
1785 | \code{data} of the directory \code{project}, you could use |
---|
1786 | the statements: |
---|
1787 | |
---|
1788 | {\small \begin{verbatim} |
---|
1789 | import os |
---|
1790 | domain.set_datadir{'project' + os.sep + 'data'} |
---|
1791 | \end{verbatim}} |
---|
1792 | \end{methoddesc} |
---|
1793 | |
---|
1794 | \begin{methoddesc} {get\_datadir}{} |
---|
1795 | Module: \module{abstract\_2d\_finite\_volumes.domain} |
---|
1796 | |
---|
1797 | Returns the data directory set by \code{set\_datadir} or, |
---|
1798 | if \code{set\_datadir} has not |
---|
1799 | been run, returns the value \code{default\_datadir} specified in |
---|
1800 | \code{config.py}. |
---|
1801 | \end{methoddesc} |
---|
1802 | |
---|
1803 | |
---|
1804 | \begin{methoddesc} {set\_minimum_allowed_height}{} |
---|
1805 | Module: \module{shallow\_water.shallow\_water\_domain} |
---|
1806 | |
---|
1807 | Set the minimum depth (in meters) that will be recognised in |
---|
1808 | the numerical scheme (including limiters and flux computations) |
---|
1809 | |
---|
1810 | Default value is $10^{-3}$ m, but by setting this to a greater value, |
---|
1811 | e.g.\ for large scale simulations, the computation time can be |
---|
1812 | significantly reduced. |
---|
1813 | \end{methoddesc} |
---|
1814 | |
---|
1815 | |
---|
1816 | \begin{methoddesc} {set\_minimum_storable_height}{} |
---|
1817 | Module: \module{shallow\_water.shallow\_water\_domain} |
---|
1818 | |
---|
1819 | Sets the minimum depth that will be recognised when writing |
---|
1820 | to an sww file. This is useful for removing thin water layers |
---|
1821 | that seems to be caused by friction creep. |
---|
1822 | \end{methoddesc} |
---|
1823 | |
---|
1824 | |
---|
1825 | \begin{methoddesc} {set\_maximum_allowed_speed}{} |
---|
1826 | Module: \module{shallow\_water.shallow\_water\_domain} |
---|
1827 | |
---|
1828 | Set the maximum particle speed that is allowed in water |
---|
1829 | shallower than minimum_allowed_height. This is useful for |
---|
1830 | controlling speeds in very thin layers of water and at the same time |
---|
1831 | allow some movement avoiding pooling of water. |
---|
1832 | \end{methoddesc} |
---|
1833 | |
---|
1834 | |
---|
1835 | \begin{methoddesc} {set\_time}{time=0.0} |
---|
1836 | Module: \module{abstract\_2d\_finite\_volumes.domain} |
---|
1837 | |
---|
1838 | Sets the initial time, in seconds, for the simulation. The |
---|
1839 | default is 0.0. |
---|
1840 | \end{methoddesc} |
---|
1841 | |
---|
1842 | \begin{methoddesc} {set\_default\_order}{n} |
---|
1843 | Sets the default (spatial) order to the value specified by |
---|
1844 | \code{n}, which must be either 1 or 2. (Assigning any other value |
---|
1845 | to \code{n} will cause an error.) |
---|
1846 | \end{methoddesc} |
---|
1847 | |
---|
1848 | |
---|
1849 | \begin{methoddesc} {set\_store\_vertices\_uniquely}{flag} |
---|
1850 | Decide whether vertex values should be stored uniquely as |
---|
1851 | computed in the model or whether they should be reduced to one |
---|
1852 | value per vertex using averaging. |
---|
1853 | |
---|
1854 | Triangles stored in the sww file can be discontinuous reflecting |
---|
1855 | the internal representation of the finite-volume scheme |
---|
1856 | (this is a feature allowing for arbitrary steepness). |
---|
1857 | However, for visual purposes and also for use with \code{Field\_boundary} |
---|
1858 | (and \code{File\_boundary}) it is often desirable to store triangles |
---|
1859 | with values at each vertex point as the average of the potentially |
---|
1860 | discontinuous numbers found at vertices of different triangles sharing the |
---|
1861 | same vertex location. |
---|
1862 | |
---|
1863 | Storing one way or the other is controlled in ANUGA through the method |
---|
1864 | \code{domain.store\_vertices\_uniquely}. Options are |
---|
1865 | \begin{itemize} |
---|
1866 | \item \code{domain.store\_vertices\_uniquely(True)}: Allow discontinuities in the sww file |
---|
1867 | \item \code{domain.store\_vertices\_uniquely(False)}: (Default). |
---|
1868 | Average values |
---|
1869 | to ensure continuity in sww file. The latter also makes for smaller |
---|
1870 | sww files. |
---|
1871 | \end{itemize} |
---|
1872 | |
---|
1873 | \end{methoddesc} |
---|
1874 | |
---|
1875 | |
---|
1876 | % Structural methods |
---|
1877 | \begin{methoddesc}{get\_nodes}{absolute=False} |
---|
1878 | Return x,y coordinates of all nodes in mesh. |
---|
1879 | |
---|
1880 | The nodes are ordered in an Nx2 array where N is the number of nodes. |
---|
1881 | This is the same format they were provided in the constructor |
---|
1882 | i.e. without any duplication. |
---|
1883 | |
---|
1884 | Boolean keyword argument absolute determines whether coordinates |
---|
1885 | are to be made absolute by taking georeference into account |
---|
1886 | Default is False as many parts of ANUGA expects relative coordinates. |
---|
1887 | \end{methoddesc} |
---|
1888 | |
---|
1889 | |
---|
1890 | \begin{methoddesc}{get\_vertex_coordinates}{absolute=False} |
---|
1891 | |
---|
1892 | Return vertex coordinates for all triangles. |
---|
1893 | |
---|
1894 | Return all vertex coordinates for all triangles as a 3*M x 2 array |
---|
1895 | where the jth vertex of the ith triangle is located in row 3*i+j and |
---|
1896 | M the number of triangles in the mesh. |
---|
1897 | |
---|
1898 | Boolean keyword argument absolute determines whether coordinates |
---|
1899 | are to be made absolute by taking georeference into account |
---|
1900 | Default is False as many parts of ANUGA expects relative coordinates. |
---|
1901 | \end{methoddesc} |
---|
1902 | |
---|
1903 | |
---|
1904 | \begin{methoddesc}{get\_triangles}{indices=None} |
---|
1905 | |
---|
1906 | Return Mx3 integer array where M is the number of triangles. |
---|
1907 | Each row corresponds to one triangle and the three entries are |
---|
1908 | indices into the mesh nodes which can be obtained using the method |
---|
1909 | get\_nodes() |
---|
1910 | |
---|
1911 | Optional argument, indices is the set of triangle ids of interest. |
---|
1912 | \end{methoddesc} |
---|
1913 | |
---|
1914 | \begin{methoddesc}{get\_disconnected\_triangles}{} |
---|
1915 | |
---|
1916 | Get mesh based on nodes obtained from get_vertex_coordinates. |
---|
1917 | |
---|
1918 | Return array Mx3 array of integers where each row corresponds to |
---|
1919 | a triangle. A triangle is a triplet of indices into |
---|
1920 | point coordinates obtained from get_vertex_coordinates and each |
---|
1921 | index appears only once.\\ |
---|
1922 | |
---|
1923 | This provides a mesh where no triangles share nodes |
---|
1924 | (hence the name disconnected triangles) and different |
---|
1925 | nodes may have the same coordinates.\\ |
---|
1926 | |
---|
1927 | This version of the mesh is useful for storing meshes with |
---|
1928 | discontinuities at each node and is e.g. used for storing |
---|
1929 | data in sww files.\\ |
---|
1930 | |
---|
1931 | The triangles created will have the format |
---|
1932 | |
---|
1933 | {\small \begin{verbatim} |
---|
1934 | [[0,1,2], |
---|
1935 | [3,4,5], |
---|
1936 | [6,7,8], |
---|
1937 | ... |
---|
1938 | [3*M-3 3*M-2 3*M-1]] |
---|
1939 | \end{verbatim}} |
---|
1940 | \end{methoddesc} |
---|
1941 | |
---|
1942 | |
---|
1943 | |
---|
1944 | %%%%%% |
---|
1945 | \section{Initial Conditions} |
---|
1946 | \label{sec:Initial Conditions} |
---|
1947 | In standard usage of partial differential equations, initial conditions |
---|
1948 | refers to the values associated to the system variables (the conserved |
---|
1949 | quantities here) for \code{time = 0}. In setting up a scenario script |
---|
1950 | as described in Sections \ref{sec:simpleexample} and \ref{sec:realdataexample}, |
---|
1951 | \code{set_quantity} is used to define the initial conditions of variables |
---|
1952 | other than the conserved quantities, such as friction. Here, we use the terminology |
---|
1953 | of initial conditions to refer to initial values for variables which need |
---|
1954 | prescription to solve the shallow water wave equation. Further, it must be noted |
---|
1955 | that \code{set_quantity} does not necessarily have to be used in the initial |
---|
1956 | condition setting; it can be used at any time throughout the simulation. |
---|
1957 | |
---|
1958 | \begin{methoddesc}{set\_quantity}{name, |
---|
1959 | numeric = None, |
---|
1960 | quantity = None, |
---|
1961 | function = None, |
---|
1962 | geospatial_data = None, |
---|
1963 | filename = None, |
---|
1964 | attribute_name = None, |
---|
1965 | alpha = None, |
---|
1966 | location = 'vertices', |
---|
1967 | indices = None, |
---|
1968 | verbose = False, |
---|
1969 | use_cache = False} |
---|
1970 | Module: \module{abstract\_2d\_finite\_volumes.domain} |
---|
1971 | (see also \module{abstract\_2d\_finite\_volumes.quantity.set\_values}) |
---|
1972 | |
---|
1973 | This function is used to assign values to individual quantities for a |
---|
1974 | domain. It is very flexible and can be used with many data types: a |
---|
1975 | statement of the form \code{domain.set\_quantity(name, x)} can be used |
---|
1976 | to define a quantity having the name \code{name}, where the other |
---|
1977 | argument \code{x} can be any of the following: |
---|
1978 | |
---|
1979 | \begin{itemize} |
---|
1980 | \item a number, in which case all vertices in the mesh gets that for |
---|
1981 | the quantity in question. |
---|
1982 | \item a list of numbers or a Numeric array ordered the same way as the mesh vertices. |
---|
1983 | \item a function (e.g.\ see the samples introduced in Chapter 2) |
---|
1984 | \item an expression composed of other quantities and numbers, arrays, lists (for |
---|
1985 | example, a linear combination of quantities, such as |
---|
1986 | \code{domain.set\_quantity('stage','elevation'+x))} |
---|
1987 | \item the name of a file from which the data can be read. In this case, the optional argument attribute\_name will select which attribute to use from the file. If left out, set\_quantity will pick one. This is useful in cases where there is only one attribute. |
---|
1988 | \item a geospatial dataset (See Section \ref{sec:geospatial}). |
---|
1989 | Optional argument attribute\_name applies here as with files. |
---|
1990 | \end{itemize} |
---|
1991 | |
---|
1992 | |
---|
1993 | Exactly one of the arguments |
---|
1994 | numeric, quantity, function, points, filename |
---|
1995 | must be present. |
---|
1996 | |
---|
1997 | |
---|
1998 | Set quantity will look at the type of the second argument (\code{numeric}) and |
---|
1999 | determine what action to take. |
---|
2000 | |
---|
2001 | Values can also be set using the appropriate keyword arguments. |
---|
2002 | If x is a function, for example, \code{domain.set\_quantity(name, x)}, \code{domain.set\_quantity(name, numeric=x)}, and \code{domain.set\_quantity(name, function=x)} |
---|
2003 | are all equivalent. |
---|
2004 | |
---|
2005 | |
---|
2006 | Other optional arguments are |
---|
2007 | \begin{itemize} |
---|
2008 | \item \code{indices} which is a list of ids of triangles to which set\_quantity should apply its assignment of values. |
---|
2009 | \item \code{location} determines which part of the triangles to assign |
---|
2010 | to. Options are 'vertices' (default), 'edges', 'unique vertices', and 'centroids'. |
---|
2011 | \end{itemize} |
---|
2012 | |
---|
2013 | %%% |
---|
2014 | \anuga provides a number of predefined initial conditions to be used |
---|
2015 | with \code{set\_quantity}. See for example callable object |
---|
2016 | \code{slump\_tsunami} below. |
---|
2017 | |
---|
2018 | \end{methoddesc} |
---|
2019 | |
---|
2020 | |
---|
2021 | |
---|
2022 | |
---|
2023 | \begin{funcdesc}{set_region}{tag, quantity, X, location='vertices'} |
---|
2024 | Module: \module{abstract\_2d\_finite\_volumes.domain} |
---|
2025 | |
---|
2026 | (see also \module{abstract\_2d\_finite\_volumes.quantity.set\_values}) |
---|
2027 | |
---|
2028 | This function is used to assign values to individual quantities given |
---|
2029 | a regional tag. It is similar to \code{set\_quantity}. |
---|
2030 | For example, if in the mesh-generator a regional tag of 'ditch' was |
---|
2031 | used, set\_region can be used to set elevation of this region to |
---|
2032 | -10m. X is the constant or function to be applied to the quantity, |
---|
2033 | over the tagged region. Location describes how the values will be |
---|
2034 | applied. Options are 'vertices' (default), 'edges', 'unique |
---|
2035 | vertices', and 'centroids'. |
---|
2036 | |
---|
2037 | This method can also be called with a list of region objects. This is |
---|
2038 | useful for adding quantities in regions, and having one quantity |
---|
2039 | value based on another quantity. See \module{abstract\_2d\_finite\_volumes.region} for |
---|
2040 | more details. |
---|
2041 | \end{funcdesc} |
---|
2042 | |
---|
2043 | |
---|
2044 | |
---|
2045 | |
---|
2046 | \begin{funcdesc}{slump_tsunami}{length, depth, slope, width=None, thickness=None, |
---|
2047 | x0=0.0, y0=0.0, alpha=0.0, |
---|
2048 | gravity=9.8, gamma=1.85, |
---|
2049 | massco=1, dragco=1, frictionco=0, psi=0, |
---|
2050 | dx=None, kappa=3.0, kappad=0.8, zsmall=0.01, |
---|
2051 | domain=None, |
---|
2052 | verbose=False} |
---|
2053 | Module: \module{shallow\_water.smf} |
---|
2054 | |
---|
2055 | This function returns a callable object representing an initial water |
---|
2056 | displacement generated by a submarine sediment failure. These failures can take the form of |
---|
2057 | a submarine slump or slide. In the case of a slide, use \code{slide_tsunami} instead. |
---|
2058 | |
---|
2059 | The arguments include as a minimum, the slump or slide length, the water depth to the centre of sediment |
---|
2060 | mass, and the bathymetric slope. Other slump or slide parameters can be included if they are known. |
---|
2061 | \end{funcdesc} |
---|
2062 | |
---|
2063 | |
---|
2064 | %%% |
---|
2065 | \begin{funcdesc}{file\_function}{filename, |
---|
2066 | domain = None, |
---|
2067 | quantities = None, |
---|
2068 | interpolation_points = None, |
---|
2069 | verbose = False, |
---|
2070 | use_cache = False} |
---|
2071 | Module: \module{abstract\_2d\_finite\_volumes.util} |
---|
2072 | |
---|
2073 | Reads the time history of spatial data for |
---|
2074 | specified interpolation points from a NetCDF file (\code{filename}) |
---|
2075 | and returns |
---|
2076 | a callable object. \code{filename} could be a \code{sww} file. |
---|
2077 | Returns interpolated values based on the input |
---|
2078 | file using the underlying \code{interpolation\_function}. |
---|
2079 | |
---|
2080 | \code{quantities} is either the name of a single quantity to be |
---|
2081 | interpolated or a list of such quantity names. In the second case, the resulting |
---|
2082 | function will return a tuple of values---one for each quantity. |
---|
2083 | |
---|
2084 | \code{interpolation\_points} is a list of absolute coordinates or a |
---|
2085 | geospatial object |
---|
2086 | for points at which values are sought. |
---|
2087 | |
---|
2088 | The model time stored within the file function can be accessed using |
---|
2089 | the method \code{f.get\_time()} |
---|
2090 | |
---|
2091 | |
---|
2092 | The underlying algorithm used is as follows:\\ |
---|
2093 | Given a time series (i.e.\ a series of values associated with |
---|
2094 | different times), whose values are either just numbers or a set of |
---|
2095 | numbers defined at the vertices of a triangular mesh (such as those |
---|
2096 | stored in SWW files), \code{Interpolation\_function} is used to |
---|
2097 | create a callable object that interpolates a value for an arbitrary |
---|
2098 | time \code{t} within the model limits and possibly a point \code{(x, |
---|
2099 | y)} within a mesh region. |
---|
2100 | |
---|
2101 | The actual time series at which data is available is specified by |
---|
2102 | means of an array \code{time} of monotonically increasing times. The |
---|
2103 | quantities containing the values to be interpolated are specified in |
---|
2104 | an array---or dictionary of arrays (used in conjunction with the |
---|
2105 | optional argument \code{quantity\_names}) --- called |
---|
2106 | \code{quantities}. The optional arguments \code{vertex\_coordinates} |
---|
2107 | and \code{triangles} represent the spatial mesh associated with the |
---|
2108 | quantity arrays. If omitted the function created by |
---|
2109 | \code{Interpolation\_function} will be a function of \code{t} only. |
---|
2110 | |
---|
2111 | Since, in practice, values need to be computed at specified points, |
---|
2112 | the syntax allows the user to specify, once and for all, a list |
---|
2113 | \code{interpolation\_points} of points at which values are required. |
---|
2114 | In this case, the function may be called using the form \code{f(t, |
---|
2115 | id)}, where \code{id} is an index for the list |
---|
2116 | \code{interpolation\_points}. |
---|
2117 | |
---|
2118 | |
---|
2119 | \end{funcdesc} |
---|
2120 | |
---|
2121 | %%% |
---|
2122 | %% \begin{classdesc}{Interpolation\_function}{self, |
---|
2123 | %% time, |
---|
2124 | %% quantities, |
---|
2125 | %% quantity_names = None, |
---|
2126 | %% vertex_coordinates = None, |
---|
2127 | %% triangles = None, |
---|
2128 | %% interpolation_points = None, |
---|
2129 | %% verbose = False} |
---|
2130 | %% Module: \module{abstract\_2d\_finite\_volumes.least\_squares} |
---|
2131 | |
---|
2132 | %% Given a time series (i.e.\ a series of values associated with |
---|
2133 | %% different times), whose values are either just numbers or a set of |
---|
2134 | %% numbers defined at the vertices of a triangular mesh (such as those |
---|
2135 | %% stored in SWW files), \code{Interpolation\_function} is used to |
---|
2136 | %% create a callable object that interpolates a value for an arbitrary |
---|
2137 | %% time \code{t} within the model limits and possibly a point \code{(x, |
---|
2138 | %% y)} within a mesh region. |
---|
2139 | |
---|
2140 | %% The actual time series at which data is available is specified by |
---|
2141 | %% means of an array \code{time} of monotonically increasing times. The |
---|
2142 | %% quantities containing the values to be interpolated are specified in |
---|
2143 | %% an array---or dictionary of arrays (used in conjunction with the |
---|
2144 | %% optional argument \code{quantity\_names}) --- called |
---|
2145 | %% \code{quantities}. The optional arguments \code{vertex\_coordinates} |
---|
2146 | %% and \code{triangles} represent the spatial mesh associated with the |
---|
2147 | %% quantity arrays. If omitted the function created by |
---|
2148 | %% \code{Interpolation\_function} will be a function of \code{t} only. |
---|
2149 | |
---|
2150 | %% Since, in practice, values need to be computed at specified points, |
---|
2151 | %% the syntax allows the user to specify, once and for all, a list |
---|
2152 | %% \code{interpolation\_points} of points at which values are required. |
---|
2153 | %% In this case, the function may be called using the form \code{f(t, |
---|
2154 | %% id)}, where \code{id} is an index for the list |
---|
2155 | %% \code{interpolation\_points}. |
---|
2156 | |
---|
2157 | %% \end{classdesc} |
---|
2158 | |
---|
2159 | %%% |
---|
2160 | %\begin{funcdesc}{set\_region}{functions} |
---|
2161 | %[Low priority. Will be merged into set\_quantity] |
---|
2162 | |
---|
2163 | %Module:\module{abstract\_2d\_finite\_volumes.domain} |
---|
2164 | %\end{funcdesc} |
---|
2165 | |
---|
2166 | |
---|
2167 | |
---|
2168 | %%%%%% |
---|
2169 | \section{Boundary Conditions}\index{boundary conditions} |
---|
2170 | |
---|
2171 | \anuga provides a large number of predefined boundary conditions, |
---|
2172 | represented by objects such as \code{Reflective\_boundary(domain)} and |
---|
2173 | \code{Dirichlet\_boundary([0.2, 0.0, 0.0])}, described in the examples |
---|
2174 | in Chapter 2. Alternatively, you may prefer to ``roll your own'', |
---|
2175 | following the method explained in Section \ref{sec:roll your own}. |
---|
2176 | |
---|
2177 | These boundary objects may be used with the function \code{set\_boundary} described below |
---|
2178 | to assign boundary conditions according to the tags used to label boundary segments. |
---|
2179 | |
---|
2180 | \begin{methoddesc}{set\_boundary}{boundary_map} |
---|
2181 | Module: \module{abstract\_2d\_finite\_volumes.domain} |
---|
2182 | |
---|
2183 | This function allows you to assign a boundary object (corresponding to a |
---|
2184 | pre-defined or user-specified boundary condition) to every boundary segment that |
---|
2185 | has been assigned a particular tag. |
---|
2186 | |
---|
2187 | This is done by specifying a dictionary \code{boundary\_map}, whose values are the boundary objects |
---|
2188 | and whose keys are the symbolic tags. |
---|
2189 | |
---|
2190 | \end{methoddesc} |
---|
2191 | |
---|
2192 | \begin{methoddesc} {get\_boundary\_tags}{} |
---|
2193 | Module: \module{abstract\_2d\_finite\_volumes.domain} |
---|
2194 | |
---|
2195 | Returns a list of the available boundary tags. |
---|
2196 | \end{methoddesc} |
---|
2197 | |
---|
2198 | %%% |
---|
2199 | \subsection{Predefined boundary conditions} |
---|
2200 | |
---|
2201 | \begin{classdesc}{Reflective\_boundary}{Boundary} |
---|
2202 | Module: \module{shallow\_water} |
---|
2203 | |
---|
2204 | Reflective boundary returns same conserved quantities as those present in |
---|
2205 | the neighbouring volume but reflected. |
---|
2206 | |
---|
2207 | This class is specific to the shallow water equation as it works with the |
---|
2208 | momentum quantities assumed to be the second and third conserved quantities. |
---|
2209 | \end{classdesc} |
---|
2210 | |
---|
2211 | %%% |
---|
2212 | \begin{classdesc}{Transmissive\_boundary}{domain = None} |
---|
2213 | Module: \module{abstract\_2d\_finite\_volumes.generic\_boundary\_conditions} |
---|
2214 | |
---|
2215 | A transmissive boundary returns the same conserved quantities as |
---|
2216 | those present in the neighbouring volume. |
---|
2217 | |
---|
2218 | The underlying domain must be specified when the boundary is instantiated. |
---|
2219 | \end{classdesc} |
---|
2220 | |
---|
2221 | %%% |
---|
2222 | \begin{classdesc}{Dirichlet\_boundary}{conserved_quantities=None} |
---|
2223 | Module: \module{abstract\_2d\_finite\_volumes.generic\_boundary\_conditions} |
---|
2224 | |
---|
2225 | A Dirichlet boundary returns constant values for each of conserved |
---|
2226 | quantities. In the example of \code{Dirichlet\_boundary([0.2, 0.0, 0.0])}, |
---|
2227 | the \code{stage} value at the boundary is 0.2 and the \code{xmomentum} and |
---|
2228 | \code{ymomentum} at the boundary are set to 0.0. The list must contain |
---|
2229 | a value for each conserved quantity. |
---|
2230 | \end{classdesc} |
---|
2231 | |
---|
2232 | %%% |
---|
2233 | \begin{classdesc}{Time\_boundary}{domain = None, f = None} |
---|
2234 | Module: \module{abstract\_2d\_finite\_volumes.generic\_boundary\_conditions} |
---|
2235 | |
---|
2236 | A time-dependent boundary returns values for the conserved |
---|
2237 | quantities as a function \code{f(t)} of time. The user must specify |
---|
2238 | the domain to get access to the model time. |
---|
2239 | \end{classdesc} |
---|
2240 | |
---|
2241 | %%% |
---|
2242 | \begin{classdesc}{File\_boundary}{Boundary} |
---|
2243 | Module: \module{abstract\_2d\_finite\_volumes.generic\_boundary\_conditions} |
---|
2244 | |
---|
2245 | This method may be used if the user wishes to apply a SWW file or |
---|
2246 | a time series file to a boundary segment or segments. |
---|
2247 | The boundary values are obtained from a file and interpolated to the |
---|
2248 | appropriate segments for each conserved quantity. |
---|
2249 | \end{classdesc} |
---|
2250 | |
---|
2251 | |
---|
2252 | |
---|
2253 | %%% |
---|
2254 | \begin{classdesc}{Transmissive\_Momentum\_Set\_Stage\_boundary}{Boundary} |
---|
2255 | Module: \module{shallow\_water} |
---|
2256 | |
---|
2257 | This boundary returns same momentum conserved quantities as |
---|
2258 | those present in its neighbour volume but sets stage as in a Time\_boundary. |
---|
2259 | The underlying domain must be specified when boundary is instantiated |
---|
2260 | |
---|
2261 | This type of boundary is useful when stage is known at the boundary as a |
---|
2262 | function of time, but momenta (or speeds) aren't. |
---|
2263 | |
---|
2264 | This class is specific to the shallow water equation as it works with the |
---|
2265 | momentum quantities assumed to be the second and third conserved quantities. |
---|
2266 | \end{classdesc} |
---|
2267 | |
---|
2268 | |
---|
2269 | \begin{classdesc}{Dirichlet\_Discharge\_boundary}{Boundary} |
---|
2270 | Module: \module{shallow\_water} |
---|
2271 | |
---|
2272 | Sets stage (stage0) |
---|
2273 | Sets momentum (wh0) in the inward normal direction. |
---|
2274 | \end{classdesc} |
---|
2275 | |
---|
2276 | |
---|
2277 | |
---|
2278 | \subsection{User-defined boundary conditions} |
---|
2279 | \label{sec:roll your own} |
---|
2280 | |
---|
2281 | All boundary classes must inherit from the generic boundary class |
---|
2282 | \code{Boundary} and have a method called \code{evaluate} which must |
---|
2283 | take as inputs \code{self, vol\_id, edge\_id} where self refers to the |
---|
2284 | object itself and vol\_id and edge\_id are integers referring to |
---|
2285 | particular edges. The method must return a list of three floating point |
---|
2286 | numbers representing values for \code{stage}, |
---|
2287 | \code{xmomentum} and \code{ymomentum}, respectively. |
---|
2288 | |
---|
2289 | The constructor of a particular boundary class may be used to specify |
---|
2290 | particular values or flags to be used by the \code{evaluate} method. |
---|
2291 | Please refer to the source code for the existing boundary conditions |
---|
2292 | for examples of how to implement boundary conditions. |
---|
2293 | |
---|
2294 | |
---|
2295 | |
---|
2296 | \section{Forcing Terms} |
---|
2297 | \label{forcing terms} |
---|
2298 | |
---|
2299 | \anuga provides a number of predefined forcing functions to be used with simulations. |
---|
2300 | Gravity and friction are always calculated using the elevation and friction quantities, but the user may additionally add forcing terms to the list |
---|
2301 | \code{domain.forcing\_terms} and have them affect the model. |
---|
2302 | |
---|
2303 | Currently, predifiend forcing terms are |
---|
2304 | |
---|
2305 | \begin{funcdesc}{General\_forcing}{} |
---|
2306 | Module: \module{shallow\_water.shallow\_water\_domain} |
---|
2307 | |
---|
2308 | This is a general class to modify any quantity according to a given rate of change. |
---|
2309 | Other specific forcing terms are based on this class but it can be used by itself as well (e.g.\ to modify momentum). |
---|
2310 | |
---|
2311 | The General\_forcing class takes as input: |
---|
2312 | \begin{itemize} |
---|
2313 | \item \code{domain}: a reference to the domain being evolved |
---|
2314 | \item \code{quantity\_name}: The name of the quantity that will be affected by this forcing term |
---|
2315 | \item \code{rate}: The rate at which the quantity should change. The parameter \code{rate} can be eithe a constant or a |
---|
2316 | function of time. Positive values indicate increases, |
---|
2317 | negative values indicate decreases. |
---|
2318 | The parametr \code{rate} can be \code{None} at initialisation but must be specified |
---|
2319 | before forcing term is applied (i.e. simulation has started). |
---|
2320 | The default value is 0.0 - i.e.\ no forcing. |
---|
2321 | \item \code{center, radius}: Optionally restrict forcing to a circle with given center and radius. |
---|
2322 | \item \code{polygon}: Optionally restrict forcing to an area enclosed by given polygon. |
---|
2323 | \end{itemize} |
---|
2324 | Note specifying both center, radius and polygon will cause an exception to be thrown. |
---|
2325 | |
---|
2326 | |
---|
2327 | Example: |
---|
2328 | {\scriptsize \begin{verbatim} |
---|
2329 | xmom = General_forcing(domain, 'xmomentum', polygon=P) |
---|
2330 | ymom = General_forcing(domain, 'ymomentum', polygon=P) |
---|
2331 | |
---|
2332 | xmom.rate = f |
---|
2333 | ymom.rate = g |
---|
2334 | |
---|
2335 | domain.forcing_terms.append(xmom) |
---|
2336 | domain.forcing_terms.append(ymom) |
---|
2337 | \end{verbatim}} |
---|
2338 | Here, \code{f}, \code{g} are assumed to be defined as functions of time providing a time dependent rate of change for xmomentum and ymomentum respectively. |
---|
2339 | P is assumed to be polygon, specified as a list of points, e.g. a square \code{P = [[x0, y0], [x1, y0], [x1, y1], [x0, y1]]}. |
---|
2340 | |
---|
2341 | \end{funcdesc} |
---|
2342 | |
---|
2343 | |
---|
2344 | \begin{funcdesc}{Inflow}{} |
---|
2345 | Module: \module{shallow\_water.shallow\_water\_domain} |
---|
2346 | |
---|
2347 | This is a general class for infiltration and abstraction of water according to a given rate of change. |
---|
2348 | This class will always modify the \code{stage} quantity. |
---|
2349 | |
---|
2350 | Inflow is based on the General_forcing class so the functionality is similar. |
---|
2351 | |
---|
2352 | The Inflow class takes as input: |
---|
2353 | \begin{itemize} |
---|
2354 | \item \code{domain}: a reference to the domain being evolved |
---|
2355 | \item \code{rate}: The flow rate in $m^3/s$ at which the stage should change. The parameter \code{rate} can be eithe a constant or a |
---|
2356 | function of time. Positive values indicate inflow, |
---|
2357 | negative values indicate outflow. |
---|
2358 | |
---|
2359 | Note: The specified flow will be divided by the area of |
---|
2360 | the inflow region and then applied to update the |
---|
2361 | stage quantity. |
---|
2362 | \item \code{center, radius}: Optionally restrict forcing to a circle with given center and radius. |
---|
2363 | \item \code{polygon}: Optionally restrict forcing to an area enclosed by given polygon. |
---|
2364 | \end{itemize} |
---|
2365 | |
---|
2366 | |
---|
2367 | Example: |
---|
2368 | {\scriptsize \begin{verbatim} |
---|
2369 | hydrograph = Inflow(center=(320, 300), radius=10, |
---|
2370 | rate=file_function('QPMF_Rot_Sub13.tms')) |
---|
2371 | |
---|
2372 | domain.forcing_terms.append(hydrograph) |
---|
2373 | \end{verbatim}} |
---|
2374 | Here, \code{'QPMF_Rot_Sub13.tms'} is assumed to be a NetCDF file in the format \code{tms} defining a timeseries for a hydrograph. |
---|
2375 | \end{funcdesc} |
---|
2376 | |
---|
2377 | |
---|
2378 | \begin{funcdesc}{Rainfall}{} |
---|
2379 | Module: \module{shallow\_water.shallow\_water\_domain} |
---|
2380 | |
---|
2381 | This is a general class for implementing rainfall over the domain, possibly restricted to a given circle or polygon. |
---|
2382 | This class will always modify the \code{stage} quantity. |
---|
2383 | |
---|
2384 | Rainfall is based on the General_forcing class so the functionality is similar. |
---|
2385 | |
---|
2386 | The Rainfall class takes as input: |
---|
2387 | \begin{itemize} |
---|
2388 | \item \code{domain}: a reference to the domain being evolved |
---|
2389 | \item \code{rate}: Total rain rate over the specified domain. |
---|
2390 | Note: Raingauge Data needs to reflect the time step. |
---|
2391 | For example: if rain gauge is mm read every \code{dt} seconds, then the input |
---|
2392 | here is as \code{mm/dt} so 10 mm in 5 minutes becomes |
---|
2393 | 10/(5x60) = 0.0333mm/s. |
---|
2394 | |
---|
2395 | This parameter can be either a constant or a |
---|
2396 | function of time. Positive values indicate rain being added (or be used for general infiltration), |
---|
2397 | negative values indicate outflow at the specified rate (presumably this could model evaporation or abstraction). |
---|
2398 | \item \code{center, radius}: Optionally restrict forcing to a circle with given center and radius. |
---|
2399 | \item \code{polygon}: Optionally restrict forcing to an area enclosed by given polygon. |
---|
2400 | \end{itemize} |
---|
2401 | |
---|
2402 | Example: |
---|
2403 | {\scriptsize \begin{verbatim} |
---|
2404 | |
---|
2405 | catchmentrainfall = Rainfall(rain=file_function('Q100_2hr_Rain.tms')) |
---|
2406 | domain.forcing_terms.append(catchmentrainfall) |
---|
2407 | |
---|
2408 | \end{verbatim}} |
---|
2409 | Here, \code{'Q100_2hr_Rain.tms'} is assumed to be a NetCDF file in the format \code{tms} defining a timeseries for the rainfall. |
---|
2410 | \end{funcdesc} |
---|
2411 | |
---|
2412 | |
---|
2413 | |
---|
2414 | \begin{funcdesc}{Culvert\_flow}{} |
---|
2415 | Module: \module{culver\_flows.culvert\_class} |
---|
2416 | |
---|
2417 | This is a general class for implementing flow through a culvert. |
---|
2418 | This class modifies the quantities \code{stage, xmomentum, ymomentum} in areas at both ends of the culvert. |
---|
2419 | |
---|
2420 | The Culvert\_flow forcing term uses \code{Inflow} and {General\_forcing} to update the quantities. The flow drection is determined on-the-fly so |
---|
2421 | openings are referenced simple as opening0 and opening1 with either being able to take the role as Inflow and Outflow. |
---|
2422 | |
---|
2423 | The Culvert\_flow class takes as input: |
---|
2424 | \begin{itemize} |
---|
2425 | \item \code{domain}: a reference to the domain being evolved |
---|
2426 | \item \code{label}: Short text naming the culvert |
---|
2427 | \item \code{description}: Text describing it |
---|
2428 | \item \code{end_point0}: Coordinates of one opening |
---|
2429 | \item \code{end_point1}: Coordinates of other opening |
---|
2430 | \item \code{width}: |
---|
2431 | \item \code{height}: |
---|
2432 | \item \code{diameter}: |
---|
2433 | \item \code{manning}: Mannings Roughness for Culvert |
---|
2434 | \item \code{invert_level0}: Invert level if not the same as the Elevation on the Domain |
---|
2435 | \item \code{invert_level1}: Invert level if not the same as the Elevation on the Domain |
---|
2436 | \item \code{culvert_routine}: Function specifying the calculation of flow based on energy difference between the two openings (see below) |
---|
2437 | \end{itemize} |
---|
2438 | |
---|
2439 | The user can specify different culvert routines. Hower ANUGA currently specifies one, namely the \code{boyd\_generalised\_culvert\_model} as used in the example below. |
---|
2440 | |
---|
2441 | Example: |
---|
2442 | {\scriptsize \begin{verbatim} |
---|
2443 | from anuga.culvert_flows.culvert_class import Culvert_flow |
---|
2444 | from anuga.culvert_flows.culvert_routines import boyd_generalised_culvert_model |
---|
2445 | |
---|
2446 | culvert1 = Culvert_flow(domain, |
---|
2447 | label='Culvert No. 1', |
---|
2448 | description='This culvert is a test unit 1.2m Wide by 0.75m High', |
---|
2449 | end_point0=[9.0, 2.5], |
---|
2450 | end_point1=[13.0, 2.5], |
---|
2451 | width=1.20,height=0.75, |
---|
2452 | culvert_routine=boyd_generalised_culvert_model, |
---|
2453 | verbose=True) |
---|
2454 | |
---|
2455 | culvert2 = Culvert_flow(domain, |
---|
2456 | label='Culvert No. 2', |
---|
2457 | description='This culvert is a circular test with d=1.2m', |
---|
2458 | end_point0=[9.0, 1.5], |
---|
2459 | end_point1=[30.0, 3.5], |
---|
2460 | diameter=1.20, |
---|
2461 | invert_level0=7, |
---|
2462 | culvert_routine=boyd_generalised_culvert_model, |
---|
2463 | verbose=True) |
---|
2464 | |
---|
2465 | domain.forcing_terms.append(culvert1) |
---|
2466 | domain.forcing_terms.append(culvert2) |
---|
2467 | |
---|
2468 | |
---|
2469 | \end{verbatim}} |
---|
2470 | \end{funcdesc} |
---|
2471 | |
---|
2472 | |
---|
2473 | |
---|
2474 | |
---|
2475 | |
---|
2476 | |
---|
2477 | \section{Evolution}\index{evolution} |
---|
2478 | |
---|
2479 | \begin{methoddesc}{evolve}{yieldstep = None, finaltime = None, duration = None, skip_initial_step = False} |
---|
2480 | |
---|
2481 | Module: \module{abstract\_2d\_finite\_volumes.domain} |
---|
2482 | |
---|
2483 | This function (a method of \class{domain}) is invoked once all the |
---|
2484 | preliminaries have been completed, and causes the model to progress |
---|
2485 | through successive steps in its evolution, storing results and |
---|
2486 | outputting statistics whenever a user-specified period |
---|
2487 | \code{yieldstep} is completed (generally during this period the |
---|
2488 | model will evolve through several steps internally |
---|
2489 | as the method forces the water speed to be calculated |
---|
2490 | on successive new cells). The user |
---|
2491 | specifies the total time period over which the evolution is to take |
---|
2492 | place, by specifying values (in seconds) for either \code{duration} |
---|
2493 | or \code{finaltime}, as well as the interval in seconds after which |
---|
2494 | results are to be stored and statistics output. |
---|
2495 | |
---|
2496 | You can include \method{evolve} in a statement of the type: |
---|
2497 | |
---|
2498 | {\small \begin{verbatim} |
---|
2499 | for t in domain.evolve(yieldstep, finaltime): |
---|
2500 | <Do something with domain and t> |
---|
2501 | \end{verbatim}} |
---|
2502 | |
---|
2503 | \end{methoddesc} |
---|
2504 | |
---|
2505 | |
---|
2506 | |
---|
2507 | \subsection{Diagnostics} |
---|
2508 | \label{sec:diagnostics} |
---|
2509 | |
---|
2510 | |
---|
2511 | \begin{funcdesc}{statistics}{} |
---|
2512 | Module: \module{abstract\_2d\_finite\_volumes.domain} |
---|
2513 | |
---|
2514 | \end{funcdesc} |
---|
2515 | |
---|
2516 | \begin{funcdesc}{timestepping\_statistics}{} |
---|
2517 | Module: \module{abstract\_2d\_finite\_volumes.domain} |
---|
2518 | |
---|
2519 | Returns a string of the following type for each |
---|
2520 | timestep: |
---|
2521 | |
---|
2522 | \code{Time = 0.9000, delta t in [0.00598964, 0.01177388], steps=12 |
---|
2523 | (12)} |
---|
2524 | |
---|
2525 | Here the numbers in \code{steps=12 (12)} indicate the number of steps taken and |
---|
2526 | the number of first-order steps, respectively.\\ |
---|
2527 | |
---|
2528 | The optional keyword argument \code{track_speeds=True} will |
---|
2529 | generate a histogram of speeds generated by each triangle. The |
---|
2530 | speeds relate to the size of the timesteps used by ANUGA and |
---|
2531 | this diagnostics may help pinpoint problem areas where excessive speeds |
---|
2532 | are generated. |
---|
2533 | |
---|
2534 | \end{funcdesc} |
---|
2535 | |
---|
2536 | |
---|
2537 | \begin{funcdesc}{boundary\_statistics}{quantities = None, tags = None} |
---|
2538 | Module: \module{abstract\_2d\_finite\_volumes.domain} |
---|
2539 | |
---|
2540 | Returns a string of the following type when \code{quantities = 'stage'} and \code{tags = ['top', 'bottom']}: |
---|
2541 | |
---|
2542 | {\small \begin{verbatim} |
---|
2543 | Boundary values at time 0.5000: |
---|
2544 | top: |
---|
2545 | stage in [ -0.25821218, -0.02499998] |
---|
2546 | bottom: |
---|
2547 | stage in [ -0.27098821, -0.02499974] |
---|
2548 | \end{verbatim}} |
---|
2549 | |
---|
2550 | \end{funcdesc} |
---|
2551 | |
---|
2552 | |
---|
2553 | \begin{funcdesc}{get\_quantity}{name, location='vertices', indices = None} |
---|
2554 | Module: \module{abstract\_2d\_finite\_volumes.domain} |
---|
2555 | |
---|
2556 | Allow access to individual quantities and their methods |
---|
2557 | |
---|
2558 | \end{funcdesc} |
---|
2559 | |
---|
2560 | |
---|
2561 | \begin{funcdesc}{set\_quantities\_to\_be\_monitored}{} |
---|
2562 | Module: \module{abstract\_2d\_finite\_volumes.domain} |
---|
2563 | |
---|
2564 | Selects quantities and derived quantities for which extrema attained at internal timesteps |
---|
2565 | will be collected. |
---|
2566 | |
---|
2567 | Information can be tracked in the evolve loop by printing \code{quantity\_statistics} and |
---|
2568 | collected data will be stored in the sww file. |
---|
2569 | |
---|
2570 | Optional parameters \code{polygon} and \code{time\_interval} may be specified to restrict the |
---|
2571 | extremum computation. |
---|
2572 | \end{funcdesc} |
---|
2573 | |
---|
2574 | \begin{funcdesc}{quantity\_statistics}{} |
---|
2575 | Module: \module{abstract\_2d\_finite\_volumes.domain} |
---|
2576 | |
---|
2577 | Reports on extrema attained by selected quantities. |
---|
2578 | |
---|
2579 | Returns a string of the following type for each |
---|
2580 | timestep: |
---|
2581 | |
---|
2582 | \begin{verbatim} |
---|
2583 | Monitored quantities at time 1.0000: |
---|
2584 | stage-elevation: |
---|
2585 | values since time = 0.00 in [0.00000000, 0.30000000] |
---|
2586 | minimum attained at time = 0.00000000, location = (0.16666667, 0.33333333) |
---|
2587 | maximum attained at time = 0.00000000, location = (0.83333333, 0.16666667) |
---|
2588 | ymomentum: |
---|
2589 | values since time = 0.00 in [0.00000000, 0.06241221] |
---|
2590 | minimum attained at time = 0.00000000, location = (0.33333333, 0.16666667) |
---|
2591 | maximum attained at time = 0.22472667, location = (0.83333333, 0.66666667) |
---|
2592 | xmomentum: |
---|
2593 | values since time = 0.00 in [-0.06062178, 0.47886313] |
---|
2594 | minimum attained at time = 0.00000000, location = (0.16666667, 0.33333333) |
---|
2595 | maximum attained at time = 0.35103646, location = (0.83333333, 0.16666667) |
---|
2596 | \end{verbatim} |
---|
2597 | |
---|
2598 | The quantities (and derived quantities) listed here must be selected at model |
---|
2599 | initialisation using the method \code{domain.set_quantities_to_be_monitored}.\\ |
---|
2600 | |
---|
2601 | The optional keyword argument \code{precision='\%.4f'} will |
---|
2602 | determine the precision used for floating point values in the output. |
---|
2603 | This diagnostics helps track extrema attained by the selected quantities |
---|
2604 | at every internal timestep. |
---|
2605 | |
---|
2606 | These values are also stored in the sww file for post processing. |
---|
2607 | |
---|
2608 | \end{funcdesc} |
---|
2609 | |
---|
2610 | |
---|
2611 | |
---|
2612 | \begin{funcdesc}{get\_values}{location='vertices', indices = None} |
---|
2613 | Module: \module{abstract\_2d\_finite\_volumes.quantity} |
---|
2614 | |
---|
2615 | Extract values for quantity as an array |
---|
2616 | |
---|
2617 | \end{funcdesc} |
---|
2618 | |
---|
2619 | |
---|
2620 | \begin{funcdesc}{get\_integral}{} |
---|
2621 | Module: \module{abstract\_2d\_finite\_volumes.quantity} |
---|
2622 | |
---|
2623 | Return computed integral over entire domain for this quantity |
---|
2624 | |
---|
2625 | \end{funcdesc} |
---|
2626 | |
---|
2627 | |
---|
2628 | |
---|
2629 | |
---|
2630 | \begin{funcdesc}{get\_maximum\_value}{indices = None} |
---|
2631 | Module: \module{abstract\_2d\_finite\_volumes.quantity} |
---|
2632 | |
---|
2633 | Return maximum value of quantity (on centroids) |
---|
2634 | |
---|
2635 | Optional argument indices is the set of element ids that |
---|
2636 | the operation applies to. If omitted all elements are considered. |
---|
2637 | |
---|
2638 | We do not seek the maximum at vertices as each vertex can |
---|
2639 | have multiple values - one for each triangle sharing it. |
---|
2640 | \end{funcdesc} |
---|
2641 | |
---|
2642 | |
---|
2643 | |
---|
2644 | \begin{funcdesc}{get\_maximum\_location}{indices = None} |
---|
2645 | Module: \module{abstract\_2d\_finite\_volumes.quantity} |
---|
2646 | |
---|
2647 | Return location of maximum value of quantity (on centroids) |
---|
2648 | |
---|
2649 | Optional argument indices is the set of element ids that |
---|
2650 | the operation applies to. |
---|
2651 | |
---|
2652 | We do not seek the maximum at vertices as each vertex can |
---|
2653 | have multiple values - one for each triangle sharing it. |
---|
2654 | |
---|
2655 | If there are multiple cells with same maximum value, the |
---|
2656 | first cell encountered in the triangle array is returned. |
---|
2657 | \end{funcdesc} |
---|
2658 | |
---|
2659 | |
---|
2660 | |
---|
2661 | \begin{funcdesc}{get\_wet\_elements}{indices=None} |
---|
2662 | Module: \module{shallow\_water.shallow\_water\_domain} |
---|
2663 | |
---|
2664 | Return indices for elements where h $>$ minimum_allowed_height |
---|
2665 | Optional argument indices is the set of element ids that the operation applies to. |
---|
2666 | \end{funcdesc} |
---|
2667 | |
---|
2668 | |
---|
2669 | \begin{funcdesc}{get\_maximum\_inundation\_elevation}{indices=None} |
---|
2670 | Module: \module{shallow\_water.shallow\_water\_domain} |
---|
2671 | |
---|
2672 | Return highest elevation where h $>$ 0.\\ |
---|
2673 | Optional argument indices is the set of element ids that the operation applies to.\\ |
---|
2674 | |
---|
2675 | Example to find maximum runup elevation:\\ |
---|
2676 | z = domain.get_maximum_inundation_elevation() |
---|
2677 | \end{funcdesc} |
---|
2678 | |
---|
2679 | |
---|
2680 | \begin{funcdesc}{get\_maximum\_inundation\_location}{indices=None} |
---|
2681 | Module: \module{shallow\_water.shallow\_water\_domain} |
---|
2682 | |
---|
2683 | Return location (x,y) of highest elevation where h $>$ 0.\\ |
---|
2684 | Optional argument indices is the set of element ids that the operation applies to.\\ |
---|
2685 | |
---|
2686 | Example to find maximum runup location:\\ |
---|
2687 | x, y = domain.get_maximum_inundation_location() |
---|
2688 | \end{funcdesc} |
---|
2689 | |
---|
2690 | |
---|
2691 | \section{Queries of SWW model output files} |
---|
2692 | After a model has been run, it is often useful to extract various information from the sww |
---|
2693 | output file (see Section \ref{sec:sww format}). This is typically more convenient than using the |
---|
2694 | diagnostics described in Section \ref{sec:diagnostics} which rely on the model running - something |
---|
2695 | that can be very time consuming. The sww files are easy and quick to read and offer much information |
---|
2696 | about the model results such as runup heights, time histories of selected quantities, |
---|
2697 | flow through cross sections and much more. |
---|
2698 | |
---|
2699 | \begin{funcdesc}{get\_maximum\_inundation\_elevation}{filename, polygon=None, |
---|
2700 | time_interval=None, verbose=False} |
---|
2701 | Module: \module{shallow\_water.data\_manager} |
---|
2702 | |
---|
2703 | Return highest elevation where depth is positive ($h > 0$) |
---|
2704 | |
---|
2705 | Example to find maximum runup elevation:\\ |
---|
2706 | max_runup = get_maximum_inundation_elevation(filename, |
---|
2707 | polygon=None, |
---|
2708 | time_interval=None, |
---|
2709 | verbose=False) |
---|
2710 | |
---|
2711 | |
---|
2712 | filename is a NetCDF sww file containing ANUGA model output. |
---|
2713 | Optional arguments polygon and time_interval restricts the maximum runup calculation |
---|
2714 | to a points that lie within the specified polygon and time interval. |
---|
2715 | |
---|
2716 | If no inundation is found within polygon and time_interval the return value |
---|
2717 | is None signifying "No Runup" or "Everything is dry". |
---|
2718 | |
---|
2719 | See doc string for general function get_maximum_inundation_data for details. |
---|
2720 | \end{funcdesc} |
---|
2721 | |
---|
2722 | |
---|
2723 | \begin{funcdesc}{get\_maximum\_inundation\_location}{filename, polygon=None, |
---|
2724 | time_interval=None, verbose=False} |
---|
2725 | Module: \module{shallow\_water.data\_manager} |
---|
2726 | |
---|
2727 | Return location (x,y) of highest elevation where depth is positive ($h > 0$) |
---|
2728 | |
---|
2729 | Example to find maximum runup location:\\ |
---|
2730 | max_runup_location = get_maximum_inundation_location(filename, |
---|
2731 | polygon=None, |
---|
2732 | time_interval=None, |
---|
2733 | verbose=False) |
---|
2734 | |
---|
2735 | |
---|
2736 | filename is a NetCDF sww file containing ANUGA model output. |
---|
2737 | Optional arguments polygon and time_interval restricts the maximum runup calculation |
---|
2738 | to a points that lie within the specified polygon and time interval. |
---|
2739 | |
---|
2740 | If no inundation is found within polygon and time_interval the return value |
---|
2741 | is None signifying "No Runup" or "Everything is dry". |
---|
2742 | |
---|
2743 | See doc string for general function get_maximum_inundation_data for details. |
---|
2744 | \end{funcdesc} |
---|
2745 | |
---|
2746 | |
---|
2747 | \begin{funcdesc}{sww2timeseries}{swwfiles, gauge_filename, production_dirs, report = None, reportname = None, |
---|
2748 | plot_quantity = None, generate_fig = False, surface = None, time_min = None, time_max = None, time_thinning = 1, |
---|
2749 | time_unit = None, title_on = None, use_cache = False, verbose = False} |
---|
2750 | |
---|
2751 | Module: \module{anuga.abstract\_2d\_finite\_volumes.util} |
---|
2752 | |
---|
2753 | Return csv files for the location in the \code{gauge_filename} and can also return plots of them |
---|
2754 | |
---|
2755 | See doc string for general function sww2timeseries for details. |
---|
2756 | |
---|
2757 | \end{funcdesc} |
---|
2758 | |
---|
2759 | |
---|
2760 | \begin{funcdesc}{get\_flow\_through\_cross\_section}{filename, cross\_section, verbose=False} |
---|
2761 | Module: \module{shallow\_water.data\_manager} |
---|
2762 | |
---|
2763 | Obtain flow $[m^2]$ perpendicular to specified cross section. |
---|
2764 | |
---|
2765 | Inputs: |
---|
2766 | \begin{itemize} |
---|
2767 | \item filename: Name of sww file containing ANUGA model output. |
---|
2768 | \item polyline: Representation of desired cross section - it may contain multiple |
---|
2769 | sections allowing for complex shapes. Assume absolute UTM coordinates. |
---|
2770 | \end{itemize} |
---|
2771 | |
---|
2772 | Output: |
---|
2773 | \begin{itemize} |
---|
2774 | \item time: All stored times in sww file |
---|
2775 | \item Q: Hydrograph of total flow across given segments for all stored times. |
---|
2776 | \end{itemize} |
---|
2777 | |
---|
2778 | The normal flow is computed for each triangle intersected by the polyline and |
---|
2779 | added up. Multiple segments at different angles are specified the normal flows |
---|
2780 | may partially cancel each other. |
---|
2781 | |
---|
2782 | Example to find flow through cross section: |
---|
2783 | |
---|
2784 | \begin{verbatim} |
---|
2785 | cross_section = [[x, 0], [x, width]] |
---|
2786 | time, Q = get_flow_through_cross_section(filename, |
---|
2787 | cross_section, |
---|
2788 | verbose=False) |
---|
2789 | \end{verbatim} |
---|
2790 | |
---|
2791 | |
---|
2792 | See doc string for general function get_maximum_inundation_data for details. |
---|
2793 | |
---|
2794 | \end{funcdesc} |
---|
2795 | |
---|
2796 | |
---|
2797 | |
---|
2798 | \section{Other} |
---|
2799 | |
---|
2800 | \begin{funcdesc}{domain.create\_quantity\_from\_expression}{string} |
---|
2801 | |
---|
2802 | Handy for creating derived quantities on-the-fly as for example |
---|
2803 | \begin{verbatim} |
---|
2804 | Depth = domain.create_quantity_from_expression('stage-elevation') |
---|
2805 | |
---|
2806 | exp = '(xmomentum*xmomentum + ymomentum*ymomentum)**0.5') |
---|
2807 | Absolute_momentum = domain.create_quantity_from_expression(exp) |
---|
2808 | \end{verbatim} |
---|
2809 | |
---|
2810 | %See also \file{Analytical\_solution\_circular\_hydraulic\_jump.py} for an example of use. |
---|
2811 | \end{funcdesc} |
---|
2812 | |
---|
2813 | |
---|
2814 | |
---|
2815 | |
---|
2816 | |
---|
2817 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
2818 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
2819 | |
---|
2820 | \chapter{\anuga System Architecture} |
---|
2821 | |
---|
2822 | |
---|
2823 | \section{File Formats} |
---|
2824 | \label{sec:file formats} |
---|
2825 | |
---|
2826 | \anuga makes use of a number of different file formats. The |
---|
2827 | following table lists all these formats, which are described in more |
---|
2828 | detail in the paragraphs below. |
---|
2829 | |
---|
2830 | \bigskip |
---|
2831 | |
---|
2832 | \begin{center} |
---|
2833 | |
---|
2834 | \begin{tabular}{|ll|} \hline |
---|
2835 | |
---|
2836 | \textbf{Extension} & \textbf{Description} \\ |
---|
2837 | \hline\hline |
---|
2838 | |
---|
2839 | \code{.sww} & NetCDF format for storing model output |
---|
2840 | \code{f(t,x,y)}\\ |
---|
2841 | |
---|
2842 | \code{.tms} & NetCDF format for storing time series \code{f(t)}\\ |
---|
2843 | |
---|
2844 | \code{.csv/.txt} & ASCII format called points csv for storing |
---|
2845 | arbitrary points and associated attributes\\ |
---|
2846 | |
---|
2847 | \code{.pts} & NetCDF format for storing arbitrary points and |
---|
2848 | associated attributes\\ |
---|
2849 | |
---|
2850 | \code{.asc} & ASCII format of regular DEMs as output from ArcView\\ |
---|
2851 | |
---|
2852 | \code{.prj} & Associated ArcView file giving more metadata for |
---|
2853 | \code{.asc} format\\ |
---|
2854 | |
---|
2855 | \code{.ers} & ERMapper header format of regular DEMs for ArcView\\ |
---|
2856 | |
---|
2857 | \code{.dem} & NetCDF representation of regular DEM data\\ |
---|
2858 | |
---|
2859 | \code{.tsh} & ASCII format for storing meshes and associated |
---|
2860 | boundary and region info\\ |
---|
2861 | |
---|
2862 | \code{.msh} & NetCDF format for storing meshes and associated |
---|
2863 | boundary and region info\\ |
---|
2864 | |
---|
2865 | \code{.nc} & Native ferret NetCDF format\\ |
---|
2866 | |
---|
2867 | \code{.geo} & Houdinis ASCII geometry format (?) \\ \par \hline |
---|
2868 | %\caption{File formats used by \anuga} |
---|
2869 | \end{tabular} |
---|
2870 | |
---|
2871 | |
---|
2872 | \end{center} |
---|
2873 | |
---|
2874 | The above table shows the file extensions used to identify the |
---|
2875 | formats of files. However, typically, in referring to a format we |
---|
2876 | capitalise the extension and omit the initial full stop---thus, we |
---|
2877 | refer, for example, to `SWW files' or `PRJ files'. |
---|
2878 | |
---|
2879 | \bigskip |
---|
2880 | |
---|
2881 | A typical dataflow can be described as follows: |
---|
2882 | |
---|
2883 | \subsection{Manually Created Files} |
---|
2884 | |
---|
2885 | \begin{tabular}{ll} |
---|
2886 | ASC, PRJ & Digital elevation models (gridded)\\ |
---|
2887 | NC & Model outputs for use as boundary conditions (e.g. from MOST) |
---|
2888 | \end{tabular} |
---|
2889 | |
---|
2890 | \subsection{Automatically Created Files} |
---|
2891 | |
---|
2892 | \begin{tabular}{ll} |
---|
2893 | ASC, PRJ $\rightarrow$ DEM $\rightarrow$ PTS & Convert |
---|
2894 | DEMs to native \code{.pts} file\\ |
---|
2895 | |
---|
2896 | NC $\rightarrow$ SWW & Convert MOST boundary files to |
---|
2897 | boundary \code{.sww}\\ |
---|
2898 | |
---|
2899 | PTS + TSH $\rightarrow$ TSH with elevation & Least squares fit\\ |
---|
2900 | |
---|
2901 | TSH $\rightarrow$ SWW & Convert TSH to \code{.sww}-viewable using |
---|
2902 | \code{animate}\\ |
---|
2903 | |
---|
2904 | TSH + Boundary SWW $\rightarrow$ SWW & Simulation using |
---|
2905 | \code{\anuga}\\ |
---|
2906 | |
---|
2907 | Polygonal mesh outline $\rightarrow$ & TSH or MSH |
---|
2908 | \end{tabular} |
---|
2909 | |
---|
2910 | |
---|
2911 | |
---|
2912 | |
---|
2913 | \bigskip |
---|
2914 | |
---|
2915 | \subsection{SWW and TMS Formats} |
---|
2916 | \label{sec:sww format} |
---|
2917 | |
---|
2918 | The SWW and TMS formats are both NetCDF formats, and are of key |
---|
2919 | importance for \anuga. |
---|
2920 | |
---|
2921 | An SWW file is used for storing \anuga output and therefore pertains |
---|
2922 | to a set of points and a set of times at which a model is evaluated. |
---|
2923 | It contains, in addition to dimension information, the following |
---|
2924 | variables: |
---|
2925 | |
---|
2926 | \begin{itemize} |
---|
2927 | \item \code{x} and \code{y}: coordinates of the points, represented as Numeric arrays |
---|
2928 | \item \code{elevation}, a Numeric array storing bed-elevations |
---|
2929 | \item \code{volumes}, a list specifying the points at the vertices of each of the |
---|
2930 | triangles |
---|
2931 | % Refer here to the example to be provided in describing the simple example |
---|
2932 | \item \code{time}, a Numeric array containing times for model |
---|
2933 | evaluation |
---|
2934 | \end{itemize} |
---|
2935 | |
---|
2936 | |
---|
2937 | The contents of an SWW file may be viewed using the anuga viewer |
---|
2938 | \code{animate}, which creates an on-screen geometric |
---|
2939 | representation. See section \ref{sec:animate} (page |
---|
2940 | \pageref{sec:animate}) in Appendix \ref{ch:supportingtools} for more |
---|
2941 | on \code{animate}. |
---|
2942 | |
---|
2943 | Alternatively, there are tools, such as \code{ncdump}, that allow |
---|
2944 | you to convert an NetCDF file into a readable format such as the |
---|
2945 | Class Definition Language (CDL). The following is an excerpt from a |
---|
2946 | CDL representation of the output file \file{runup.sww} generated |
---|
2947 | from running the simple example \file{runup.py} of |
---|
2948 | Chapter \ref{ch:getstarted}: |
---|
2949 | |
---|
2950 | \verbatiminput{examples/bedslopeexcerpt.cdl} |
---|
2951 | |
---|
2952 | The SWW format is used not only for output but also serves as input |
---|
2953 | for functions such as \function{file\_boundary} and |
---|
2954 | \function{file\_function}, described in Chapter \ref{ch:interface}. |
---|
2955 | |
---|
2956 | A TMS file is used to store time series data that is independent of |
---|
2957 | position. |
---|
2958 | |
---|
2959 | |
---|
2960 | \subsection{Mesh File Formats} |
---|
2961 | |
---|
2962 | A mesh file is a file that has a specific format suited to |
---|
2963 | triangular meshes and their outlines. A mesh file can have one of |
---|
2964 | two formats: it can be either a TSH file, which is an ASCII file, or |
---|
2965 | an MSH file, which is a NetCDF file. A mesh file can be generated |
---|
2966 | from the function \function{create\_mesh\_from\_regions} (see |
---|
2967 | Section \ref{sec:meshgeneration}) and used to initialise a domain. |
---|
2968 | |
---|
2969 | A mesh file can define the outline of the mesh---the vertices and |
---|
2970 | line segments that enclose the region in which the mesh is |
---|
2971 | created---and the triangular mesh itself, which is specified by |
---|
2972 | listing the triangles and their vertices, and the segments, which |
---|
2973 | are those sides of the triangles that are associated with boundary |
---|
2974 | conditions. |
---|
2975 | |
---|
2976 | In addition, a mesh file may contain `holes' and/or `regions'. A |
---|
2977 | hole represents an area where no mesh is to be created, while a |
---|
2978 | region is a labelled area used for defining properties of a mesh, |
---|
2979 | such as friction values. A hole or region is specified by a point |
---|
2980 | and bounded by a number of segments that enclose that point. |
---|
2981 | |
---|
2982 | A mesh file can also contain a georeference, which describes an |
---|
2983 | offset to be applied to $x$ and $y$ values---eg to the vertices. |
---|
2984 | |
---|
2985 | |
---|
2986 | \subsection{Formats for Storing Arbitrary Points and Attributes} |
---|
2987 | |
---|
2988 | |
---|
2989 | A CSV/TXT file is used to store data representing |
---|
2990 | arbitrary numerical attributes associated with a set of points. |
---|
2991 | |
---|
2992 | The format for an CSV/TXT file is:\\ |
---|
2993 | %\begin{verbatim} |
---|
2994 | |
---|
2995 | first line: \code{[column names]}\\ |
---|
2996 | other lines: \code{[x value], [y value], [attributes]}\\ |
---|
2997 | |
---|
2998 | for example:\\ |
---|
2999 | \code{x, y, elevation, friction}\\ |
---|
3000 | \code{0.6, 0.7, 4.9, 0.3}\\ |
---|
3001 | \code{1.9, 2.8, 5, 0.3}\\ |
---|
3002 | \code{2.7, 2.4, 5.2, 0.3} |
---|
3003 | |
---|
3004 | The delimiter is a comma. The first two columns are assumed to |
---|
3005 | be x, y coordinates. |
---|
3006 | |
---|
3007 | |
---|
3008 | A PTS file is a NetCDF representation of the data held in an points CSV |
---|
3009 | file. If the data is associated with a set of $N$ points, then the |
---|
3010 | data is stored using an $N \times 2$ Numeric array of float |
---|
3011 | variables for the points and an $N \times 1$ Numeric array for each |
---|
3012 | attribute. |
---|
3013 | |
---|
3014 | %\end{verbatim} |
---|
3015 | |
---|
3016 | \subsection{ArcView Formats} |
---|
3017 | |
---|
3018 | Files of the three formats ASC, PRJ and ERS are all associated with |
---|
3019 | data from ArcView. |
---|
3020 | |
---|
3021 | An ASC file is an ASCII representation of DEM output from ArcView. |
---|
3022 | It contains a header with the following format: |
---|
3023 | |
---|
3024 | \begin{tabular}{l l} |
---|
3025 | \code{ncols} & \code{753}\\ |
---|
3026 | \code{nrows} & \code{766}\\ |
---|
3027 | \code{xllcorner} & \code{314036.58727982}\\ |
---|
3028 | \code{yllcorner} & \code{6224951.2960092}\\ |
---|
3029 | \code{cellsize} & \code{100}\\ |
---|
3030 | \code{NODATA_value} & \code{-9999} |
---|
3031 | \end{tabular} |
---|
3032 | |
---|
3033 | The remainder of the file contains the elevation data for each grid point |
---|
3034 | in the grid defined by the above information. |
---|
3035 | |
---|
3036 | A PRJ file is an ArcView file used in conjunction with an ASC file |
---|
3037 | to represent metadata for a DEM. |
---|
3038 | |
---|
3039 | |
---|
3040 | \subsection{DEM Format} |
---|
3041 | |
---|
3042 | A DEM file is a NetCDF representation of regular DEM data. |
---|
3043 | |
---|
3044 | |
---|
3045 | \subsection{Other Formats} |
---|
3046 | |
---|
3047 | |
---|
3048 | |
---|
3049 | |
---|
3050 | \subsection{Basic File Conversions} |
---|
3051 | \label{sec:basicfileconversions} |
---|
3052 | |
---|
3053 | \begin{funcdesc}{sww2dem}{basename_in, basename_out = None, |
---|
3054 | quantity = None, |
---|
3055 | timestep = None, |
---|
3056 | reduction = None, |
---|
3057 | cellsize = 10, |
---|
3058 | NODATA_value = -9999, |
---|
3059 | easting_min = None, |
---|
3060 | easting_max = None, |
---|
3061 | northing_min = None, |
---|
3062 | northing_max = None, |
---|
3063 | expand_search = False, |
---|
3064 | verbose = False, |
---|
3065 | origin = None, |
---|
3066 | datum = 'WGS84', |
---|
3067 | format = 'ers'} |
---|
3068 | Module: \module{shallow\_water.data\_manager} |
---|
3069 | |
---|
3070 | Takes data from an SWW file \code{basename_in} and converts it to DEM format (ASC or |
---|
3071 | ERS) of a desired grid size \code{cellsize} in metres. |
---|
3072 | The easting and northing values are used if the user wished to clip the output |
---|
3073 | file to a specified rectangular area. The \code{reduction} input refers to a function |
---|
3074 | to reduce the quantities over all time step of the SWW file, example, maximum. |
---|
3075 | \end{funcdesc} |
---|
3076 | |
---|
3077 | |
---|
3078 | \begin{funcdesc}{dem2pts}{basename_in, basename_out=None, |
---|
3079 | easting_min=None, easting_max=None, |
---|
3080 | northing_min=None, northing_max=None, |
---|
3081 | use_cache=False, verbose=False} |
---|
3082 | Module: \module{shallow\_water.data\_manager} |
---|
3083 | |
---|
3084 | Takes DEM data (a NetCDF file representation of data from a regular Digital |
---|
3085 | Elevation Model) and converts it to PTS format. |
---|
3086 | \end{funcdesc} |
---|
3087 | |
---|
3088 | |
---|
3089 | |
---|
3090 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
3091 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
3092 | |
---|
3093 | \chapter{\anuga mathematical background} |
---|
3094 | \label{cd:mathematical background} |
---|
3095 | |
---|
3096 | \section{Introduction} |
---|
3097 | |
---|
3098 | This chapter outlines the mathematics underpinning \anuga. |
---|
3099 | |
---|
3100 | |
---|
3101 | |
---|
3102 | \section{Model} |
---|
3103 | \label{sec:model} |
---|
3104 | |
---|
3105 | The shallow water wave equations are a system of differential |
---|
3106 | conservation equations which describe the flow of a thin layer of |
---|
3107 | fluid over terrain. The form of the equations are: |
---|
3108 | \[ |
---|
3109 | \frac{\partial \UU}{\partial t}+\frac{\partial \EE}{\partial |
---|
3110 | x}+\frac{\partial \GG}{\partial y}=\SSS |
---|
3111 | \] |
---|
3112 | where $\UU=\left[ {{\begin{array}{*{20}c} |
---|
3113 | h & {uh} & {vh} \\ |
---|
3114 | \end{array} }} \right]^T$ is the vector of conserved quantities; water depth |
---|
3115 | $h$, $x$-momentum $uh$ and $y$-momentum $vh$. Other quantities |
---|
3116 | entering the system are bed elevation $z$ and stage (absolute water |
---|
3117 | level) $w$, where the relation $w = z + h$ holds true at all times. |
---|
3118 | The fluxes in the $x$ and $y$ directions, $\EE$ and $\GG$ are given |
---|
3119 | by |
---|
3120 | \[ |
---|
3121 | \EE=\left[ {{\begin{array}{*{20}c} |
---|
3122 | {uh} \hfill \\ |
---|
3123 | {u^2h+gh^2/2} \hfill \\ |
---|
3124 | {uvh} \hfill \\ |
---|
3125 | \end{array} }} \right]\mbox{ and }\GG=\left[ {{\begin{array}{*{20}c} |
---|
3126 | {vh} \hfill \\ |
---|
3127 | {vuh} \hfill \\ |
---|
3128 | {v^2h+gh^2/2} \hfill \\ |
---|
3129 | \end{array} }} \right] |
---|
3130 | \] |
---|
3131 | and the source term (which includes gravity and friction) is given |
---|
3132 | by |
---|
3133 | \[ |
---|
3134 | \SSS=\left[ {{\begin{array}{*{20}c} |
---|
3135 | 0 \hfill \\ |
---|
3136 | -{gh(z_{x} + S_{fx} )} \hfill \\ |
---|
3137 | -{gh(z_{y} + S_{fy} )} \hfill \\ |
---|
3138 | \end{array} }} \right] |
---|
3139 | \] |
---|
3140 | where $S_f$ is the bed friction. The friction term is modelled using |
---|
3141 | Manning's resistance law |
---|
3142 | \[ |
---|
3143 | S_{fx} =\frac{u\eta ^2\sqrt {u^2+v^2} }{h^{4/3}}\mbox{ and }S_{fy} |
---|
3144 | =\frac{v\eta ^2\sqrt {u^2+v^2} }{h^{4/3}} |
---|
3145 | \] |
---|
3146 | in which $\eta$ is the Manning resistance coefficient. |
---|
3147 | |
---|
3148 | As demonstrated in our papers, \cite{ZR1999,nielsen2005} these |
---|
3149 | equations provide an excellent model of flows associated with |
---|
3150 | inundation such as dam breaks and tsunamis. |
---|
3151 | |
---|
3152 | \section{Finite Volume Method} |
---|
3153 | \label{sec:fvm} |
---|
3154 | |
---|
3155 | We use a finite-volume method for solving the shallow water wave |
---|
3156 | equations \cite{ZR1999}. The study area is represented by a mesh of |
---|
3157 | triangular cells as in Figure~\ref{fig:mesh} in which the conserved |
---|
3158 | quantities of water depth $h$, and horizontal momentum $(uh, vh)$, |
---|
3159 | in each volume are to be determined. The size of the triangles may |
---|
3160 | be varied within the mesh to allow greater resolution in regions of |
---|
3161 | particular interest. |
---|
3162 | |
---|
3163 | \begin{figure} |
---|
3164 | \begin{center} |
---|
3165 | \includegraphics[width=8.0cm,keepaspectratio=true]{graphics/step-five} |
---|
3166 | \caption{Triangular mesh used in our finite volume method. Conserved |
---|
3167 | quantities $h$, $uh$ and $vh$ are associated with the centroid of |
---|
3168 | each triangular cell.} \label{fig:mesh} |
---|
3169 | \end{center} |
---|
3170 | \end{figure} |
---|
3171 | |
---|
3172 | The equations constituting the finite-volume method are obtained by |
---|
3173 | integrating the differential conservation equations over each |
---|
3174 | triangular cell of the mesh. Introducing some notation we use $i$ to |
---|
3175 | refer to the $i$th triangular cell $T_i$, and ${\cal N}(i)$ to the |
---|
3176 | set of indices referring to the cells neighbouring the $i$th cell. |
---|
3177 | Then $A_i$ is the area of the $i$th triangular cell and $l_{ij}$ is |
---|
3178 | the length of the edge between the $i$th and $j$th cells. |
---|
3179 | |
---|
3180 | By applying the divergence theorem we obtain for each volume an |
---|
3181 | equation which describes the rate of change of the average of the |
---|
3182 | conserved quantities within each cell, in terms of the fluxes across |
---|
3183 | the edges of the cells and the effect of the source terms. In |
---|
3184 | particular, rate equations associated with each cell have the form |
---|
3185 | $$ |
---|
3186 | \frac{d\UU_i }{dt}+ \frac1{A_i}\sum\limits_{j\in{\cal N}(i)} \HH_{ij} l_{ij} = \SSS_i |
---|
3187 | $$ |
---|
3188 | where |
---|
3189 | \begin{itemize} |
---|
3190 | \item $\UU_i$ the vector of conserved quantities averaged over the $i$th cell, |
---|
3191 | \item $\SSS_i$ is the source term associated with the $i$th cell, |
---|
3192 | and |
---|
3193 | \item $\HH_{ij}$ is the outward normal flux of |
---|
3194 | material across the \textit{ij}th edge. |
---|
3195 | \end{itemize} |
---|
3196 | |
---|
3197 | |
---|
3198 | %\item $l_{ij}$ is the length of the edge between the $i$th and $j$th |
---|
3199 | %cells |
---|
3200 | %\item $m_{ij}$ is the midpoint of |
---|
3201 | %the \textit{ij}th edge, |
---|
3202 | %\item |
---|
3203 | %$\mathbf{n}_{ij} = (n_{ij,1} , n_{ij,2})$is the outward pointing |
---|
3204 | %normal along the \textit{ij}th edge, and The |
---|
3205 | |
---|
3206 | The flux $\HH_{ij}$ is evaluated using a numerical flux function |
---|
3207 | $\HH(\cdot, \cdot ; \ \cdot)$ which is consistent with the shallow |
---|
3208 | water flux in the sense that for all conservation vectors $\UU$ and normal vectors $\nn$ |
---|
3209 | $$ |
---|
3210 | H(\UU,\UU;\ \nn) = \EE(\UU) n_1 + \GG(\UU) n_2 . |
---|
3211 | $$ |
---|
3212 | |
---|
3213 | Then |
---|
3214 | $$ |
---|
3215 | \HH_{ij} = \HH(\UU_i(m_{ij}), |
---|
3216 | \UU_j(m_{ij}); \mathbf{n}_{ij}) |
---|
3217 | $$ |
---|
3218 | where $m_{ij}$ is the midpoint of the \textit{ij}th edge and |
---|
3219 | $\mathbf{n}_{ij}$ is the outward pointing normal, with respect to the $i$th cell, on the |
---|
3220 | \textit{ij}th edge. The function $\UU_i(x)$ for $x \in |
---|
3221 | T_i$ is obtained from the vector $\UU_k$ of conserved average values for the $i$th and |
---|
3222 | neighbouring cells. |
---|
3223 | |
---|
3224 | We use a second order reconstruction to produce a piece-wise linear |
---|
3225 | function construction of the conserved quantities for all $x \in |
---|
3226 | T_i$ for each cell (see Figure~\ref{fig:mesh:reconstruct}. This |
---|
3227 | function is allowed to be discontinuous across the edges of the |
---|
3228 | cells, but the slope of this function is limited to avoid |
---|
3229 | artificially introduced oscillations. |
---|
3230 | |
---|
3231 | Godunov's method (see \cite{Toro1992}) involves calculating the |
---|
3232 | numerical flux function $\HH(\cdot, \cdot ; \ \cdot)$ by exactly |
---|
3233 | solving the corresponding one dimensional Riemann problem normal to |
---|
3234 | the edge. We use the central-upwind scheme of \cite{KurNP2001} to |
---|
3235 | calculate an approximation of the flux across each edge. |
---|
3236 | |
---|
3237 | \begin{figure} |
---|
3238 | \begin{center} |
---|
3239 | \includegraphics[width=8.0cm,keepaspectratio=true]{graphics/step-reconstruct} |
---|
3240 | \caption{From the values of the conserved quantities at the centroid |
---|
3241 | of the cell and its neighbouring cells, a discontinuous piecewise |
---|
3242 | linear reconstruction of the conserved quantities is obtained.} |
---|
3243 | \label{fig:mesh:reconstruct} |
---|
3244 | \end{center} |
---|
3245 | \end{figure} |
---|
3246 | |
---|
3247 | In the computations presented in this paper we use an explicit Euler |
---|
3248 | time stepping method with variable timestepping adapted to the |
---|
3249 | observed CFL condition. |
---|
3250 | |
---|
3251 | |
---|
3252 | \section{Flux limiting} |
---|
3253 | |
---|
3254 | The shallow water equations are solved numerically using a |
---|
3255 | finite volume method on unstructured triangular grid. |
---|
3256 | The upwind central scheme due to Kurganov and Petrova is used as an |
---|
3257 | approximate Riemann solver for the computation of inviscid flux functions. |
---|
3258 | This makes it possible to handle discontinuous solutions. |
---|
3259 | |
---|
3260 | To alleviate the problems associated with numerical instabilities due to |
---|
3261 | small water depths near a wet/dry boundary we employ a new flux limiter that |
---|
3262 | ensures that unphysical fluxes are never encounted. |
---|
3263 | |
---|
3264 | |
---|
3265 | Let $u$ and $v$ be the velocity components in the $x$ and $y$ direction, |
---|
3266 | $w$ the absolute water level (stage) and |
---|
3267 | $z$ the bed elevation. The latter are assumed to be relative to the |
---|
3268 | same height datum. |
---|
3269 | The conserved quantities tracked by ANUGA are momentum in the |
---|
3270 | $x$-direction ($\mu = uh$), momentum in the $y$-direction ($\nu = vh$) |
---|
3271 | and depth ($h = w-z$). |
---|
3272 | |
---|
3273 | The flux calculation requires access to the velocity vector $(u, v)$ |
---|
3274 | where each component is obtained as $u = \mu/h$ and $v = \nu/h$ respectively. |
---|
3275 | In the presence of very small water depths, these calculations become |
---|
3276 | numerically unreliable and will typically cause unphysical speeds. |
---|
3277 | |
---|
3278 | We have employed a flux limiter which replaces the calculations above with |
---|
3279 | the limited approximations. |
---|
3280 | \begin{equation} |
---|
3281 | \hat{u} = \frac{\mu}{h + h_0/h}, \bigskip \hat{v} = \frac{\nu}{h + h_0/h}, |
---|
3282 | \end{equation} |
---|
3283 | where $h_0$ is a regularisation parameter that controls the minimal |
---|
3284 | magnitude of the denominator. Taking the limits we have for $\hat{u}$ |
---|
3285 | \[ |
---|
3286 | \lim_{h \rightarrow 0} \hat{u} = |
---|
3287 | \lim_{h \rightarrow 0} \frac{\mu}{h + h_0/h} = 0 |
---|
3288 | \] |
---|
3289 | and |
---|
3290 | \[ |
---|
3291 | \lim_{h \rightarrow \infty} \hat{u} = |
---|
3292 | \lim_{h \rightarrow \infty} \frac{\mu}{h + h_0/h} = \frac{\mu}{h} = u |
---|
3293 | \] |
---|
3294 | with similar results for $\hat{v}$. |
---|
3295 | |
---|
3296 | The maximal value of $\hat{u}$ is attained when $h+h_0/h$ is minimal or (by differentiating the denominator) |
---|
3297 | \[ |
---|
3298 | 1 - h_0/h^2 = 0 |
---|
3299 | \] |
---|
3300 | or |
---|
3301 | \[ |
---|
3302 | h_0 = h^2 |
---|
3303 | \] |
---|
3304 | |
---|
3305 | |
---|
3306 | ANUGA has a global parameter $H_0$ that controls the minimal depth which |
---|
3307 | is considered in the various equations. This parameter is typically set to |
---|
3308 | $10^{-3}$. Setting |
---|
3309 | \[ |
---|
3310 | h_0 = H_0^2 |
---|
3311 | \] |
---|
3312 | provides a reasonable balance between accurracy and stability. In fact, |
---|
3313 | setting $h=H_0$ will scale the predicted speed by a factor of $0.5$: |
---|
3314 | \[ |
---|
3315 | \left[ \frac{\mu}{h + h_0/h} \right]_{h = H_0} = \frac{\mu}{2 H_0} |
---|
3316 | \] |
---|
3317 | In general, for multiples of the minimal depth $N H_0$ one obtains |
---|
3318 | \[ |
---|
3319 | \left[ \frac{\mu}{h + h_0/h} \right]_{h = N H_0} = |
---|
3320 | \frac{\mu}{H_0 (1 + 1/N^2)} |
---|
3321 | \] |
---|
3322 | which converges quadratically to the true value with the multiple N. |
---|
3323 | |
---|
3324 | |
---|
3325 | %The developed numerical model has been applied to several test cases as well as to real flows. Numerical tests prove the robustness and accuracy of the model. |
---|
3326 | |
---|
3327 | |
---|
3328 | |
---|
3329 | |
---|
3330 | |
---|
3331 | \section{Slope limiting} |
---|
3332 | A multidimensional slope-limiting technique is employed to achieve second-order spatial accuracy and to prevent spurious oscillations. This is using the MinMod limiter and is documented elsewhere. |
---|
3333 | |
---|
3334 | However close to the bed, the limiter must ensure that no negative depths occur. On the other hand, in deep water, the bed topography should be ignored for the purpose of the limiter. |
---|
3335 | |
---|
3336 | |
---|
3337 | Let $w, z, h$ be the stage, bed elevation and depth at the centroid and |
---|
3338 | let $w_i, z_i, h_i$ be the stage, bed elevation and depth at vertex $i$. |
---|
3339 | Define the minimal depth across all vertices as $\hmin$ as |
---|
3340 | \[ |
---|
3341 | \hmin = \min_i h_i |
---|
3342 | \] |
---|
3343 | |
---|
3344 | Let $\tilde{w_i}$ be the stage obtained from a gradient limiter |
---|
3345 | limiting on stage only. The corresponding depth is then defined as |
---|
3346 | \[ |
---|
3347 | \tilde{h_i} = \tilde{w_i} - z_i |
---|
3348 | \] |
---|
3349 | We would use this limiter in deep water which we will define (somewhat boldly) |
---|
3350 | as |
---|
3351 | \[ |
---|
3352 | \hmin \ge \epsilon |
---|
3353 | \] |
---|
3354 | |
---|
3355 | |
---|
3356 | Similarly, let $\bar{w_i}$ be the stage obtained from a gradient |
---|
3357 | limiter limiting on depth respecting the bed slope. |
---|
3358 | The corresponding depth is defined as |
---|
3359 | \[ |
---|
3360 | \bar{h_i} = \bar{w_i} - z_i |
---|
3361 | \] |
---|
3362 | |
---|
3363 | |
---|
3364 | We introduce the concept of a balanced stage $w_i$ which is obtained as |
---|
3365 | the linear combination |
---|
3366 | |
---|
3367 | \[ |
---|
3368 | w_i = \alpha \tilde{w_i} + (1-\alpha) \bar{w_i} |
---|
3369 | \] |
---|
3370 | or |
---|
3371 | \[ |
---|
3372 | w_i = z_i + \alpha \tilde{h_i} + (1-\alpha) \bar{h_i} |
---|
3373 | \] |
---|
3374 | where $\alpha \in [0, 1]$. |
---|
3375 | |
---|
3376 | Since $\tilde{w_i}$ is obtained in 'deep' water where the bedslope |
---|
3377 | is ignored we have immediately that |
---|
3378 | \[ |
---|
3379 | \alpha = 1 \mbox{ for } \hmin \ge \epsilon %or dz=0 |
---|
3380 | \] |
---|
3381 | %where the maximal bed elevation range $dz$ is defined as |
---|
3382 | %\[ |
---|
3383 | % dz = \max_i |z_i - z| |
---|
3384 | %\] |
---|
3385 | |
---|
3386 | If $\hmin < \epsilon$ we want to use the 'shallow' limiter just enough that |
---|
3387 | no negative depths occur. Formally, we will require that |
---|
3388 | \[ |
---|
3389 | \alpha \tilde{h_i} + (1-\alpha) \bar{h_i} > \epsilon, \forall i |
---|
3390 | \] |
---|
3391 | or |
---|
3392 | \begin{equation} |
---|
3393 | \alpha(\tilde{h_i} - \bar{h_i}) > \epsilon - \bar{h_i}, \forall i |
---|
3394 | \label{eq:limiter bound} |
---|
3395 | \end{equation} |
---|
3396 | |
---|
3397 | There are two cases: |
---|
3398 | \begin{enumerate} |
---|
3399 | \item $\bar{h_i} \le \tilde{h_i}$: The deep water (limited using stage) |
---|
3400 | vertex is at least as far away from the bed than the shallow water |
---|
3401 | (limited using depth). In this case we won't need any contribution from |
---|
3402 | $\bar{h_i}$ and can accept any $\alpha$. |
---|
3403 | |
---|
3404 | E.g.\ $\alpha=1$ reduces Equation \ref{eq:limiter bound} to |
---|
3405 | \[ |
---|
3406 | \tilde{h_i} > \epsilon |
---|
3407 | \] |
---|
3408 | whereas $\alpha=0$ yields |
---|
3409 | \[ |
---|
3410 | \bar{h_i} > \epsilon |
---|
3411 | \] |
---|
3412 | all well and good. |
---|
3413 | \item $\bar{h_i} > \tilde{h_i}$: In this case the the deep water vertex is |
---|
3414 | closer to the bed than the shallow water vertex or even below the bed. |
---|
3415 | In this case we need to find an $\alpha$ that will ensure a positive depth. |
---|
3416 | Rearranging Equation \ref{eq:limiter bound} and solving for $\alpha$ one |
---|
3417 | obtains the bound |
---|
3418 | \[ |
---|
3419 | \alpha < \frac{\epsilon - \bar{h_i}}{\tilde{h_i} - \bar{h_i}}, \forall i |
---|
3420 | \] |
---|
3421 | \end{enumerate} |
---|
3422 | |
---|
3423 | Ensuring Equation \ref{eq:limiter bound} holds true for all vertices one |
---|
3424 | arrives at the definition |
---|
3425 | \[ |
---|
3426 | \alpha = \min_{i} \frac{\bar{h_i} - \epsilon}{\bar{h_i} - \tilde{h_i}} |
---|
3427 | \] |
---|
3428 | which will guarantee that no vertex 'cuts' through the bed. Finally, should |
---|
3429 | $\bar{h_i} < \epsilon$ and therefore $\alpha < 0$, we suggest setting |
---|
3430 | $\alpha=0$ and similarly capping $\alpha$ at 1 just in case. |
---|
3431 | |
---|
3432 | %Furthermore, |
---|
3433 | %dropping the $\epsilon$ ensures that alpha is always positive and also |
---|
3434 | %provides a numerical safety {??) |
---|
3435 | |
---|
3436 | |
---|
3437 | |
---|
3438 | |
---|
3439 | |
---|
3440 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
3441 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
3442 | |
---|
3443 | \chapter{Basic \anuga Assumptions} |
---|
3444 | |
---|
3445 | |
---|
3446 | Physical model time cannot be earlier than 1 Jan 1970 00:00:00. |
---|
3447 | If one wished to recreate scenarios prior to that date it must be done |
---|
3448 | using some relative time (e.g. 0). |
---|
3449 | |
---|
3450 | |
---|
3451 | All spatial data relates to the WGS84 datum (or GDA94) and has been |
---|
3452 | projected into UTM with false easting of 500000 and false northing of |
---|
3453 | 1000000 on the southern hemisphere (0 on the northern). |
---|
3454 | |
---|
3455 | It is assumed that all computations take place within one UTM zone and |
---|
3456 | all locations must consequently be specified in Cartesian coordinates |
---|
3457 | (eastings, northings) or (x,y) where the unit is metres. |
---|
3458 | |
---|
3459 | DEMs, meshes and boundary conditions can have different origins within |
---|
3460 | one UTM zone. However, the computation will use that of the mesh for |
---|
3461 | numerical stability. |
---|
3462 | |
---|
3463 | When generating a mesh it is assumed that polygons do not cross. |
---|
3464 | Having polygons tht cross can cause the mesh generation to fail or bad |
---|
3465 | meshes being produced. |
---|
3466 | |
---|
3467 | |
---|
3468 | %OLD |
---|
3469 | %The dataflow is: (See data_manager.py and from scenarios) |
---|
3470 | % |
---|
3471 | % |
---|
3472 | %Simulation scenarios |
---|
3473 | %--------------------% |
---|
3474 | %% |
---|
3475 | % |
---|
3476 | %Sub directories contain scrips and derived files for each simulation. |
---|
3477 | %The directory ../source_data contains large source files such as |
---|
3478 | %DEMs provided externally as well as MOST tsunami simulations to be used |
---|
3479 | %as boundary conditions. |
---|
3480 | % |
---|
3481 | %Manual steps are: |
---|
3482 | % Creation of DEMs from argcview (.asc + .prj) |
---|
3483 | % Creation of mesh from pmesh (.tsh) |
---|
3484 | % Creation of tsunami simulations from MOST (.nc) |
---|
3485 | %% |
---|
3486 | % |
---|
3487 | %Typical scripted steps are% |
---|
3488 | % |
---|
3489 | % prepare_dem.py: Convert asc and prj files supplied by arcview to |
---|
3490 | % native dem and pts formats% |
---|
3491 | % |
---|
3492 | % prepare_pts.py: Convert netcdf output from MOST to an sww file suitable |
---|
3493 | % as boundary condition% |
---|
3494 | % |
---|
3495 | % prepare_mesh.py: Merge DEM (pts) and mesh (tsh) using least squares |
---|
3496 | % smoothing. The outputs are tsh files with elevation data.% |
---|
3497 | % |
---|
3498 | % run_simulation.py: Use the above together with various parameters to |
---|
3499 | % run inundation simulation. |
---|
3500 | |
---|
3501 | |
---|
3502 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
3503 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
3504 | |
---|
3505 | \appendix |
---|
3506 | |
---|
3507 | \chapter{Supporting Tools} |
---|
3508 | \label{ch:supportingtools} |
---|
3509 | |
---|
3510 | This section describes a number of supporting tools, supplied with \anuga, that offer a |
---|
3511 | variety of types of functionality and enhance the basic capabilities of \anuga. |
---|
3512 | |
---|
3513 | \section{caching} |
---|
3514 | \label{sec:caching} |
---|
3515 | |
---|
3516 | The \code{cache} function is used to provide supervised caching of function |
---|
3517 | results. A Python function call of the form |
---|
3518 | |
---|
3519 | {\small \begin{verbatim} |
---|
3520 | result = func(arg1,...,argn) |
---|
3521 | \end{verbatim}} |
---|
3522 | |
---|
3523 | can be replaced by |
---|
3524 | |
---|
3525 | {\small \begin{verbatim} |
---|
3526 | from caching import cache |
---|
3527 | result = cache(func,(arg1,...,argn)) |
---|
3528 | \end{verbatim}} |
---|
3529 | |
---|
3530 | which returns the same output but reuses cached |
---|
3531 | results if the function has been computed previously in the same context. |
---|
3532 | \code{result} and the arguments can be simple types, tuples, list, dictionaries or |
---|
3533 | objects, but not unhashable types such as functions or open file objects. |
---|
3534 | The function \code{func} may be a member function of an object or a module. |
---|
3535 | |
---|
3536 | This type of caching is particularly useful for computationally intensive |
---|
3537 | functions with few frequently used combinations of input arguments. Note that |
---|
3538 | if the inputs or output are very large caching may not save time because |
---|
3539 | disc access may dominate the execution time. |
---|
3540 | |
---|
3541 | If the function definition changes after a result has been cached, this will be |
---|
3542 | detected by examining the functions \code{bytecode (co\_code, co\_consts, |
---|
3543 | func\_defaults, co\_argcount)} and the function will be recomputed. |
---|
3544 | However, caching will not detect changes in modules used by \code{func}. |
---|
3545 | In this case cache must be cleared manually. |
---|
3546 | |
---|
3547 | Options are set by means of the function \code{set\_option(key, value)}, |
---|
3548 | where \code{key} is a key associated with a |
---|
3549 | Python dictionary \code{options}. This dictionary stores settings such as the name of |
---|
3550 | the directory used, the maximum |
---|
3551 | number of cached files allowed, and so on. |
---|
3552 | |
---|
3553 | The \code{cache} function allows the user also to specify a list of dependent files. If any of these |
---|
3554 | have been changed, the function is recomputed and the results stored again. |
---|
3555 | |
---|
3556 | %Other features include support for compression and a capability to \ldots |
---|
3557 | |
---|
3558 | |
---|
3559 | \textbf{USAGE:} \nopagebreak |
---|
3560 | |
---|
3561 | {\small \begin{verbatim} |
---|
3562 | result = cache(func, args, kwargs, dependencies, cachedir, verbose, |
---|
3563 | compression, evaluate, test, return_filename) |
---|
3564 | \end{verbatim}} |
---|
3565 | |
---|
3566 | |
---|
3567 | \section{ANUGA viewer - animate} |
---|
3568 | \label{sec:animate} |
---|
3569 | The output generated by \anuga may be viewed by |
---|
3570 | means of the visualisation tool \code{animate}, which takes the |
---|
3571 | \code{SWW} file output by \anuga and creates a visual representation |
---|
3572 | of the data. Examples may be seen in Figures \ref{fig:runupstart} |
---|
3573 | and \ref{fig:runup2}. To view an \code{SWW} file with |
---|
3574 | \code{animate} in the Windows environment, you can simply drag the |
---|
3575 | icon representing the file over an icon on the desktop for the |
---|
3576 | \code{animate} executable file (or a shortcut to it), or set up a |
---|
3577 | file association to make files with the extension \code{.sww} open |
---|
3578 | with \code{animate}. Alternatively, you can operate \code{animate} |
---|
3579 | from the command line, in both Windows and Linux environments. |
---|
3580 | |
---|
3581 | On successful operation, you will see an interactive moving-picture |
---|
3582 | display. You can use keys and the mouse to slow down, speed up or |
---|
3583 | stop the display, change the viewing position or carry out a number |
---|
3584 | of other simple operations. Help is also displayed when you press |
---|
3585 | the \code{h} key. |
---|
3586 | |
---|
3587 | The main keys operating the interactive screen are:\\ |
---|
3588 | |
---|
3589 | \begin{center} |
---|
3590 | \begin{tabular}{|ll|} \hline |
---|
3591 | |
---|
3592 | \code{w} & toggle wireframe \\ |
---|
3593 | |
---|
3594 | space bar & start/stop\\ |
---|
3595 | |
---|
3596 | up/down arrows & increase/decrease speed\\ |
---|
3597 | |
---|
3598 | left/right arrows & direction in time \emph{(when running)}\\ |
---|
3599 | & step through simulation \emph{(when stopped)}\\ |
---|
3600 | |
---|
3601 | left mouse button & rotate\\ |
---|
3602 | |
---|
3603 | middle mouse button & pan\\ |
---|
3604 | |
---|
3605 | right mouse button & zoom\\ \hline |
---|
3606 | |
---|
3607 | \end{tabular} |
---|
3608 | \end{center} |
---|
3609 | |
---|
3610 | \vfill |
---|
3611 | |
---|
3612 | The following table describes how to operate animate from the command line: |
---|
3613 | |
---|
3614 | Usage: \code{animate [options] swwfile \ldots}\\ \nopagebreak |
---|
3615 | Options:\\ \nopagebreak |
---|
3616 | \begin{tabular}{ll} |
---|
3617 | \code{--display <type>} & \code{MONITOR | POWERWALL | REALITY\_CENTER |}\\ |
---|
3618 | & \code{HEAD\_MOUNTED\_DISPLAY}\\ |
---|
3619 | \code{--rgba} & Request a RGBA colour buffer visual\\ |
---|
3620 | \code{--stencil} & Request a stencil buffer visual\\ |
---|
3621 | \code{--stereo} & Use default stereo mode which is \code{ANAGLYPHIC} if not \\ |
---|
3622 | & overridden by environmental variable\\ |
---|
3623 | \code{--stereo <mode>} & \code{ANAGLYPHIC | QUAD\_BUFFER | HORIZONTAL\_SPLIT |}\\ |
---|
3624 | & \code{VERTICAL\_SPLIT | LEFT\_EYE | RIGHT\_EYE |}\\ |
---|
3625 | & \code{ON | OFF} \\ |
---|
3626 | \code{-alphamax <float 0-1>} & Maximum transparency clamp value\\ |
---|
3627 | \code{-alphamin <float 0-1>} & Transparency value at \code{hmin}\\ |
---|
3628 | \end{tabular} |
---|
3629 | |
---|
3630 | \begin{tabular}{ll} |
---|
3631 | \code{-cullangle <float angle 0-90>} & Cull triangles steeper than this value\\ |
---|
3632 | \code{-help} & Display this information\\ |
---|
3633 | \code{-hmax <float>} & Height above which transparency is set to |
---|
3634 | \code{alphamax}\\ |
---|
3635 | \end{tabular} |
---|
3636 | |
---|
3637 | \begin{tabular}{ll} |
---|
3638 | |
---|
3639 | \code{-hmin <float>} & Height below which transparency is set to |
---|
3640 | zero\\ |
---|
3641 | \end{tabular} |
---|
3642 | |
---|
3643 | \begin{tabular}{ll} |
---|
3644 | \code{-lightpos <float>,<float>,<float>} & $x,y,z$ of bedslope directional light ($z$ is |
---|
3645 | up, default is overhead)\\ |
---|
3646 | \end{tabular} |
---|
3647 | |
---|
3648 | \begin{tabular}{ll} |
---|
3649 | \code{-loop} & Repeated (looped) playback of \code{.swm} files\\ |
---|
3650 | |
---|
3651 | \end{tabular} |
---|
3652 | |
---|
3653 | \begin{tabular}{ll} |
---|
3654 | \code{-movie <dirname>} & Save numbered images to named directory and |
---|
3655 | quit\\ |
---|
3656 | |
---|
3657 | \code{-nosky} & Omit background sky\\ |
---|
3658 | |
---|
3659 | |
---|
3660 | \code{-scale <float>} & Vertical scale factor\\ |
---|
3661 | \code{-texture <file>} & Image to use for bedslope topography\\ |
---|
3662 | \code{-tps <rate>} & Timesteps per second\\ |
---|
3663 | \code{-version} & Revision number and creation (not compile) |
---|
3664 | date\\ |
---|
3665 | \end{tabular} |
---|
3666 | |
---|
3667 | \section{utilities/polygons} |
---|
3668 | |
---|
3669 | \declaremodule{standard}{utilities.polygon} |
---|
3670 | \refmodindex{utilities.polygon} |
---|
3671 | |
---|
3672 | \begin{classdesc}{Polygon\_function}{regions, default=0.0, geo_reference=None} |
---|
3673 | Module: \code{utilities.polygon} |
---|
3674 | |
---|
3675 | Creates a callable object that returns one of a specified list of values when |
---|
3676 | evaluated at a point \code{x, y}, depending on which polygon, from a specified list of polygons, the |
---|
3677 | point belongs to. The parameter \code{regions} is a list of pairs |
---|
3678 | \code{(P, v)}, where each \code{P} is a polygon and each \code{v} |
---|
3679 | is either a constant value or a function of coordinates \code{x} |
---|
3680 | and \code{y}, specifying the return value for a point inside \code{P}. The |
---|
3681 | optional parameter \code{default} may be used to specify a value |
---|
3682 | (or a function) |
---|
3683 | for a point not lying inside any of the specified polygons. When a |
---|
3684 | point lies in more than one polygon, the return value is taken to |
---|
3685 | be the value for whichever of these polygon appears later in the |
---|
3686 | list. |
---|
3687 | %FIXME (Howard): CAN x, y BE VECTORS? |
---|
3688 | The optional parameter geo\_reference refers to the status of points |
---|
3689 | that are passed into the function. Typically they will be relative to |
---|
3690 | some origin. In ANUGA, a typical call will take the form: |
---|
3691 | {\small \begin{verbatim} |
---|
3692 | set_quantity('elevation', |
---|
3693 | Polygon_function([(P1, v1), (P2, v2)], |
---|
3694 | default=v3, |
---|
3695 | geo_reference=domain.geo_reference)) |
---|
3696 | \end{verbatim}} |
---|
3697 | |
---|
3698 | |
---|
3699 | \end{classdesc} |
---|
3700 | |
---|
3701 | \begin{funcdesc}{read\_polygon}{filename} |
---|
3702 | Module: \code{utilities.polygon} |
---|
3703 | |
---|
3704 | Reads the specified file and returns a polygon. Each |
---|
3705 | line of the file must contain exactly two numbers, separated by a comma, which are interpreted |
---|
3706 | as coordinates of one vertex of the polygon. |
---|
3707 | \end{funcdesc} |
---|
3708 | |
---|
3709 | \begin{funcdesc}{populate\_polygon}{polygon, number_of_points, seed = None, exclude = None} |
---|
3710 | Module: \code{utilities.polygon} |
---|
3711 | |
---|
3712 | Populates the interior of the specified polygon with the specified number of points, |
---|
3713 | selected by means of a uniform distribution function. |
---|
3714 | \end{funcdesc} |
---|
3715 | |
---|
3716 | \begin{funcdesc}{point\_in\_polygon}{polygon, delta=1e-8} |
---|
3717 | Module: \code{utilities.polygon} |
---|
3718 | |
---|
3719 | Returns a point inside the specified polygon and close to the edge. The distance between |
---|
3720 | the returned point and the nearest point of the polygon is less than $\sqrt{2}$ times the |
---|
3721 | second argument \code{delta}, which is taken as $10^{-8}$ by default. |
---|
3722 | \end{funcdesc} |
---|
3723 | |
---|
3724 | \begin{funcdesc}{inside\_polygon}{points, polygon, closed = True, verbose = False} |
---|
3725 | Module: \code{utilities.polygon} |
---|
3726 | |
---|
3727 | Used to test whether the members of a list of points |
---|
3728 | are inside the specified polygon. Returns a Numeric |
---|
3729 | array comprising the indices of the points in the list that lie inside the polygon. |
---|
3730 | (If none of the points are inside, returns \code{zeros((0,), 'l')}.) |
---|
3731 | Points on the edges of the polygon are regarded as inside if |
---|
3732 | \code{closed} is set to \code{True} or omitted; otherwise they are regarded as outside. |
---|
3733 | \end{funcdesc} |
---|
3734 | |
---|
3735 | \begin{funcdesc}{outside\_polygon}{points, polygon, closed = True, verbose = False} |
---|
3736 | Module: \code{utilities.polygon} |
---|
3737 | |
---|
3738 | Exactly like \code{inside\_polygon}, but with the words `inside' and `outside' interchanged. |
---|
3739 | \end{funcdesc} |
---|
3740 | |
---|
3741 | \begin{funcdesc}{is\_inside\_polygon}{point, polygon, closed=True, verbose=False} |
---|
3742 | Module: \code{utilities.polygon} |
---|
3743 | |
---|
3744 | Returns \code{True} if \code{point} is inside \code{polygon} or |
---|
3745 | \code{False} otherwise. Points on the edges of the polygon are regarded as inside if |
---|
3746 | \code{closed} is set to \code{True} or omitted; otherwise they are regarded as outside. |
---|
3747 | \end{funcdesc} |
---|
3748 | |
---|
3749 | \begin{funcdesc}{is\_outside\_polygon}{point, polygon, closed=True, verbose=False} |
---|
3750 | Module: \code{utilities.polygon} |
---|
3751 | |
---|
3752 | Exactly like \code{is\_outside\_polygon}, but with the words `inside' and `outside' interchanged. |
---|
3753 | \end{funcdesc} |
---|
3754 | |
---|
3755 | \begin{funcdesc}{point\_on\_line}{x, y, x0, y0, x1, y1} |
---|
3756 | Module: \code{utilities.polygon} |
---|
3757 | |
---|
3758 | Returns \code{True} or \code{False}, depending on whether the point with coordinates |
---|
3759 | \code{x, y} is on the line passing through the points with coordinates \code{x0, y0} |
---|
3760 | and \code{x1, y1} (extended if necessary at either end). |
---|
3761 | \end{funcdesc} |
---|
3762 | |
---|
3763 | \begin{funcdesc}{separate\_points\_by\_polygon}{points, polygon, closed = True, verbose = False} |
---|
3764 | \indexedcode{separate\_points\_by\_polygon} |
---|
3765 | Module: \code{utilities.polygon} |
---|
3766 | |
---|
3767 | \end{funcdesc} |
---|
3768 | |
---|
3769 | \begin{funcdesc}{polygon\_area}{polygon} |
---|
3770 | Module: \code{utilities.polygon} |
---|
3771 | |
---|
3772 | Returns area of arbitrary polygon (reference http://mathworld.wolfram.com/PolygonArea.html) |
---|
3773 | \end{funcdesc} |
---|
3774 | |
---|
3775 | \begin{funcdesc}{plot\_polygons}{polygons, style, figname, verbose = False} |
---|
3776 | Module: \code{utilities.polygon} |
---|
3777 | |
---|
3778 | Plots each polygon contained in input polygon list, e.g. |
---|
3779 | \code{polygons = [poly1, poly2, poly3]} where \code{poly1 = [[x11,y11],[x12,y12],[x13,y13]]} |
---|
3780 | etc. Each polygon can be closed for plotting purposes by assigning the style type to each |
---|
3781 | polygon in the list, e.g. \code{style = ['line','line','line']}. The default will be a line |
---|
3782 | type when \code{style = None}. |
---|
3783 | The subsequent plot will be saved to \code{figname} or defaulted to \code{test_image.png}. |
---|
3784 | The function returns a list containing the minimum and maximum of \code{x} and \code{y}, |
---|
3785 | i.e. \code{[x_{min}, x_{max}, y_{min}, y_{max}]}. |
---|
3786 | \end{funcdesc} |
---|
3787 | |
---|
3788 | \section{coordinate\_transforms} |
---|
3789 | |
---|
3790 | \section{geospatial\_data} |
---|
3791 | \label{sec:geospatial} |
---|
3792 | |
---|
3793 | This describes a class that represents arbitrary point data in UTM |
---|
3794 | coordinates along with named attribute values. |
---|
3795 | |
---|
3796 | %FIXME (Ole): This gives a LaTeX error |
---|
3797 | %\declaremodule{standard}{geospatial_data} |
---|
3798 | %\refmodindex{geospatial_data} |
---|
3799 | |
---|
3800 | |
---|
3801 | |
---|
3802 | \begin{classdesc}{Geospatial\_data} |
---|
3803 | {data_points = None, |
---|
3804 | attributes = None, |
---|
3805 | geo_reference = None, |
---|
3806 | default_attribute_name = None, |
---|
3807 | file_name = None} |
---|
3808 | Module: \code{geospatial\_data} |
---|
3809 | |
---|
3810 | This class is used to store a set of data points and associated |
---|
3811 | attributes, allowing these to be manipulated by methods defined for |
---|
3812 | the class. |
---|
3813 | |
---|
3814 | The data points are specified either by reading them from a NetCDF |
---|
3815 | or CSV file, identified through the parameter \code{file\_name}, or |
---|
3816 | by providing their \code{x}- and \code{y}-coordinates in metres, |
---|
3817 | either as a sequence of 2-tuples of floats or as an $M \times 2$ |
---|
3818 | Numeric array of floats, where $M$ is the number of points. |
---|
3819 | Coordinates are interpreted relative to the origin specified by the |
---|
3820 | object \code{geo\_reference}, which contains data indicating the UTM |
---|
3821 | zone, easting and northing. If \code{geo\_reference} is not |
---|
3822 | specified, a default is used. |
---|
3823 | |
---|
3824 | Attributes are specified through the parameter \code{attributes}, |
---|
3825 | set either to a list or array of length $M$ or to a dictionary whose |
---|
3826 | keys are the attribute names and whose values are lists or arrays of |
---|
3827 | length $M$. One of the attributes may be specified as the default |
---|
3828 | attribute, by assigning its name to \code{default\_attribute\_name}. |
---|
3829 | If no value is specified, the default attribute is taken to be the |
---|
3830 | first one. |
---|
3831 | \end{classdesc} |
---|
3832 | |
---|
3833 | |
---|
3834 | \begin{methoddesc}{import\_points\_file}{delimiter = None, verbose = False} |
---|
3835 | |
---|
3836 | \end{methoddesc} |
---|
3837 | |
---|
3838 | |
---|
3839 | \begin{methoddesc}{export\_points\_file}{ofile, absolute=False} |
---|
3840 | |
---|
3841 | \end{methoddesc} |
---|
3842 | |
---|
3843 | |
---|
3844 | \begin{methoddesc}{get\_data\_points}{absolute = True, as\_lat\_long = |
---|
3845 | False} |
---|
3846 | If \code{as\_lat\_long} is\code{True} the point information |
---|
3847 | returned will be in Latitudes and Longitudes. |
---|
3848 | |
---|
3849 | \end{methoddesc} |
---|
3850 | |
---|
3851 | |
---|
3852 | \begin{methoddesc}{set\_attributes}{attributes} |
---|
3853 | |
---|
3854 | \end{methoddesc} |
---|
3855 | |
---|
3856 | |
---|
3857 | \begin{methoddesc}{get\_attributes}{attribute_name = None} |
---|
3858 | |
---|
3859 | \end{methoddesc} |
---|
3860 | |
---|
3861 | |
---|
3862 | \begin{methoddesc}{get\_all\_attributes}{} |
---|
3863 | |
---|
3864 | \end{methoddesc} |
---|
3865 | |
---|
3866 | |
---|
3867 | \begin{methoddesc}{set\_default\_attribute\_name}{default_attribute_name} |
---|
3868 | |
---|
3869 | \end{methoddesc} |
---|
3870 | |
---|
3871 | |
---|
3872 | \begin{methoddesc}{set\_geo\_reference}{geo_reference} |
---|
3873 | |
---|
3874 | \end{methoddesc} |
---|
3875 | |
---|
3876 | |
---|
3877 | \begin{methoddesc}{add}{} |
---|
3878 | |
---|
3879 | \end{methoddesc} |
---|
3880 | |
---|
3881 | |
---|
3882 | \begin{methoddesc}{clip}{} |
---|
3883 | Clip geospatial data by a polygon |
---|
3884 | |
---|
3885 | Inputs are \code{polygon} which is either a list of points, an Nx2 array or |
---|
3886 | a Geospatial data object and \code{closed}(optional) which determines |
---|
3887 | whether points on boundary should be regarded as belonging to the polygon |
---|
3888 | (\code{closed=True}) or not (\code{closed=False}). |
---|
3889 | Default is \code{closed=True}. |
---|
3890 | |
---|
3891 | Returns new Geospatial data object representing points |
---|
3892 | inside specified polygon. |
---|
3893 | \end{methoddesc} |
---|
3894 | |
---|
3895 | |
---|
3896 | \begin{methoddesc}{clip_outside}{} |
---|
3897 | Clip geospatial data by a polygon |
---|
3898 | |
---|
3899 | Inputs are \code{polygon} which is either a list of points, an Nx2 array or |
---|
3900 | a Geospatial data object and \code{closed}(optional) which determines |
---|
3901 | whether points on boundary should be regarded as belonging to the polygon |
---|
3902 | (\code{closed=True}) or not (\code{closed=False}). |
---|
3903 | Default is \code{closed=True}. |
---|
3904 | |
---|
3905 | Returns new Geospatial data object representing points |
---|
3906 | \emph{out}side specified polygon. |
---|
3907 | \end{methoddesc} |
---|
3908 | |
---|
3909 | \begin{methoddesc}{split}{factor=0.5, seed_num=None, verbose=False} |
---|
3910 | Returns two geospatial_data object, first is the size of the 'factor' |
---|
3911 | smaller the original and the second is the remainder. The two |
---|
3912 | new object are disjoin set of each other. |
---|
3913 | |
---|
3914 | Points of the two new geospatial_data object are selected RANDOMLY. |
---|
3915 | |
---|
3916 | Input - the (\code{factor}) which to split the object, if 0.1 then 10% of the |
---|
3917 | together object will be returned |
---|
3918 | |
---|
3919 | Output - two geospatial_data objects that are disjoint sets of the original |
---|
3920 | \end{methoddesc} |
---|
3921 | |
---|
3922 | \begin{methoddesc}{find_optimal_smoothing_parameter}{data_file, alpha_list=None, mesh_file=None, boundary_poly=None, mesh_resolution=100000, |
---|
3923 | north_boundary=None, south_boundary=None, east_boundary=None, west_boundary=None, plot_name='all_alphas', split_factor=0.1, seed_num=None, cache=False, verbose=False} |
---|
3924 | |
---|
3925 | Removes a small random sample of points from 'data_file'. Creates |
---|
3926 | models from resulting points in 'data_file' with different alpha values from 'alpha_list' and cross validates |
---|
3927 | the predicted value to the previously removed point data. Returns the |
---|
3928 | alpha value which has the smallest covariance. |
---|
3929 | |
---|
3930 | data_file: must not contain points outside the boundaries defined |
---|
3931 | and it either a pts, txt or csv file. |
---|
3932 | |
---|
3933 | alpha_list: the alpha values to test in a single list |
---|
3934 | |
---|
3935 | mesh_file: name of the created mesh file or if passed in will read it. |
---|
3936 | NOTE, if there is a mesh file mesh_resolution, north_boundary, south... etc will be ignored. |
---|
3937 | |
---|
3938 | mesh_resolution: the maximum area size for a triangle |
---|
3939 | |
---|
3940 | north_boundary... west_boundary: the value of the boundary |
---|
3941 | |
---|
3942 | plot_name: the name for the plot contain the results |
---|
3943 | |
---|
3944 | seed_num: the seed to the random number generator |
---|
3945 | |
---|
3946 | USAGE: |
---|
3947 | convariance_value, alpha = find_optimal_smoothing_parameter(data_file=fileName, |
---|
3948 | alpha_list=[0.0001, 0.01, 1], |
---|
3949 | mesh_file=None, |
---|
3950 | mesh_resolution=3, |
---|
3951 | north_boundary=5, |
---|
3952 | south_boundary=-5, |
---|
3953 | east_boundary=5, |
---|
3954 | west_boundary=-5, |
---|
3955 | plot_name='all_alphas', |
---|
3956 | seed_num=100000, |
---|
3957 | verbose=False) |
---|
3958 | |
---|
3959 | OUTPUT: returns the minumum normalised covalance calculate AND the |
---|
3960 | alpha that created it. PLUS writes a plot of the results |
---|
3961 | |
---|
3962 | NOTE: code will not work if the data_file extent is greater than the |
---|
3963 | boundary_polygon or any of the boundaries, eg north_boundary...west_boundary |
---|
3964 | \end{methoddesc} |
---|
3965 | |
---|
3966 | |
---|
3967 | |
---|
3968 | \section{Graphical Mesh Generator GUI} |
---|
3969 | The program \code{graphical\_mesh\_generator.py} in the pmesh module |
---|
3970 | allows the user to set up the mesh of the problem interactively. |
---|
3971 | It can be used to build the outline of a mesh or to visualise a mesh |
---|
3972 | automatically generated. |
---|
3973 | |
---|
3974 | Graphical Mesh Generator will let the user select various modes. The |
---|
3975 | current allowable modes are vertex, segment, hole or region. The mode |
---|
3976 | describes what sort of object is added or selected in response to |
---|
3977 | mouse clicks. When changing modes any prior selected objects become |
---|
3978 | deselected. |
---|
3979 | |
---|
3980 | In general the left mouse button will add an object and the right |
---|
3981 | mouse button will select an object. A selected object can de deleted |
---|
3982 | by pressing the the middle mouse button (scroll bar). |
---|
3983 | |
---|
3984 | \section{alpha\_shape} |
---|
3985 | \emph{Alpha shapes} are used to generate close-fitting boundaries |
---|
3986 | around sets of points. The alpha shape algorithm produces a shape |
---|
3987 | that approximates to the `shape formed by the points'---or the shape |
---|
3988 | that would be seen by viewing the points from a coarse enough |
---|
3989 | resolution. For the simplest types of point sets, the alpha shape |
---|
3990 | reduces to the more precise notion of the convex hull. However, for |
---|
3991 | many sets of points the convex hull does not provide a close fit and |
---|
3992 | the alpha shape usually fits more closely to the original point set, |
---|
3993 | offering a better approximation to the shape being sought. |
---|
3994 | |
---|
3995 | In \anuga, an alpha shape is used to generate a polygonal boundary |
---|
3996 | around a set of points before mesh generation. The algorithm uses a |
---|
3997 | parameter $\alpha$ that can be adjusted to make the resultant shape |
---|
3998 | resemble the shape suggested by intuition more closely. An alpha |
---|
3999 | shape can serve as an initial boundary approximation that the user |
---|
4000 | can adjust as needed. |
---|
4001 | |
---|
4002 | The following paragraphs describe the class used to model an alpha |
---|
4003 | shape and some of the important methods and attributes associated |
---|
4004 | with instances of this class. |
---|
4005 | |
---|
4006 | \begin{classdesc}{Alpha\_Shape}{points, alpha = None} |
---|
4007 | Module: \code{alpha\_shape} |
---|
4008 | |
---|
4009 | To instantiate this class the user supplies the points from which |
---|
4010 | the alpha shape is to be created (in the form of a list of 2-tuples |
---|
4011 | \code{[[x1, y1],[x2, y2]}\ldots\code{]}, assigned to the parameter |
---|
4012 | \code{points}) and, optionally, a value for the parameter |
---|
4013 | \code{alpha}. The alpha shape is then computed and the user can then |
---|
4014 | retrieve details of the boundary through the attributes defined for |
---|
4015 | the class. |
---|
4016 | \end{classdesc} |
---|
4017 | |
---|
4018 | |
---|
4019 | \begin{funcdesc}{alpha\_shape\_via\_files}{point_file, boundary_file, alpha= None} |
---|
4020 | Module: \code{alpha\_shape} |
---|
4021 | |
---|
4022 | This function reads points from the specified point file |
---|
4023 | \code{point\_file}, computes the associated alpha shape (either |
---|
4024 | using the specified value for \code{alpha} or, if no value is |
---|
4025 | specified, automatically setting it to an optimal value) and outputs |
---|
4026 | the boundary to a file named \code{boundary\_file}. This output file |
---|
4027 | lists the coordinates \code{x, y} of each point in the boundary, |
---|
4028 | using one line per point. |
---|
4029 | \end{funcdesc} |
---|
4030 | |
---|
4031 | |
---|
4032 | \begin{methoddesc}{set\_boundary\_type}{self,raw_boundary=True, |
---|
4033 | remove_holes=False, |
---|
4034 | smooth_indents=False, |
---|
4035 | expand_pinch=False, |
---|
4036 | boundary_points_fraction=0.2} |
---|
4037 | Module: \code{alpha\_shape}, Class: \class{Alpha\_Shape} |
---|
4038 | |
---|
4039 | This function sets flags that govern the operation of the algorithm |
---|
4040 | that computes the boundary, as follows: |
---|
4041 | |
---|
4042 | \code{raw\_boundary = True} returns raw boundary, i.e. the regular edges of the |
---|
4043 | alpha shape.\\ |
---|
4044 | \code{remove\_holes = True} removes small holes (`small' is defined by |
---|
4045 | \code{boundary\_points\_fraction})\\ |
---|
4046 | \code{smooth\_indents = True} removes sharp triangular indents in |
---|
4047 | boundary\\ |
---|
4048 | \code{expand\_pinch = True} tests for pinch-off and |
---|
4049 | corrects---preventing a boundary vertex from having more than two edges. |
---|
4050 | \end{methoddesc} |
---|
4051 | |
---|
4052 | |
---|
4053 | \begin{methoddesc}{get\_boundary}{} |
---|
4054 | Module: \code{alpha\_shape}, Class: \class{Alpha\_Shape} |
---|
4055 | |
---|
4056 | Returns a list of tuples representing the boundary of the alpha |
---|
4057 | shape. Each tuple represents a segment in the boundary by providing |
---|
4058 | the indices of its two endpoints. |
---|
4059 | \end{methoddesc} |
---|
4060 | |
---|
4061 | |
---|
4062 | \begin{methoddesc}{write\_boundary}{file_name} |
---|
4063 | Module: \code{alpha\_shape}, Class: \class{Alpha\_Shape} |
---|
4064 | |
---|
4065 | Writes the list of 2-tuples returned by \code{get\_boundary} to the |
---|
4066 | file \code{file\_name}, using one line per tuple. |
---|
4067 | \end{methoddesc} |
---|
4068 | |
---|
4069 | \section{Numerical Tools} |
---|
4070 | |
---|
4071 | The following table describes some useful numerical functions that |
---|
4072 | may be found in the module \module{utilities.numerical\_tools}: |
---|
4073 | |
---|
4074 | \begin{tabular}{|p{8cm} p{8cm}|} \hline |
---|
4075 | \code{angle(v1, v2=None)} & Angle between two-dimensional vectors |
---|
4076 | \code{v1} and \code{v2}, or between \code{v1} and the $x$-axis if |
---|
4077 | \code{v2} is \code{None}. Value is in range $0$ to $2\pi$. \\ |
---|
4078 | |
---|
4079 | \code{normal\_vector(v)} & Normal vector to \code{v}.\\ |
---|
4080 | |
---|
4081 | \code{mean(x)} & Mean value of a vector \code{x}.\\ |
---|
4082 | |
---|
4083 | \code{cov(x, y=None)} & Covariance of vectors \code{x} and \code{y}. |
---|
4084 | If \code{y} is \code{None}, returns \code{cov(x, x)}.\\ |
---|
4085 | |
---|
4086 | \code{err(x, y=0, n=2, relative=True)} & Relative error of |
---|
4087 | $\parallel$\code{x}$-$\code{y}$\parallel$ to |
---|
4088 | $\parallel$\code{y}$\parallel$ (2-norm if \code{n} = 2 or Max norm |
---|
4089 | if \code{n} = \code{None}). If denominator evaluates to zero or if |
---|
4090 | \code{y} |
---|
4091 | is omitted or if \code{relative = False}, absolute error is returned.\\ |
---|
4092 | |
---|
4093 | \code{norm(x)} & 2-norm of \code{x}.\\ |
---|
4094 | |
---|
4095 | \code{corr(x, y=None)} & Correlation of \code{x} and \code{y}. If |
---|
4096 | \code{y} is \code{None} returns autocorrelation of \code{x}.\\ |
---|
4097 | |
---|
4098 | \code{ensure\_numeric(A, typecode = None)} & Returns a Numeric array |
---|
4099 | for any sequence \code{A}. If \code{A} is already a Numeric array it |
---|
4100 | will be returned unaltered. Otherwise, an attempt is made to convert |
---|
4101 | it to a Numeric array. (Needed because \code{array(A)} can |
---|
4102 | cause memory overflow.)\\ |
---|
4103 | |
---|
4104 | \code{histogram(a, bins, relative=False)} & Standard histogram. If |
---|
4105 | \code{relative} is \code{True}, values will be normalised against |
---|
4106 | the total and thus represent frequencies rather than counts.\\ |
---|
4107 | |
---|
4108 | \code{create\_bins(data, number\_of\_bins = None)} & Safely create |
---|
4109 | bins for use with histogram. If \code{data} contains only one point |
---|
4110 | or is constant, one bin will be created. If \code{number\_of\_bins} |
---|
4111 | is omitted, 10 bins will be created.\\ \hline |
---|
4112 | |
---|
4113 | \section{Finding the Optimal Alpha Value} |
---|
4114 | |
---|
4115 | The function ???? |
---|
4116 | more to come very soon |
---|
4117 | |
---|
4118 | \end{tabular} |
---|
4119 | |
---|
4120 | |
---|
4121 | \chapter{Modules available in \anuga} |
---|
4122 | |
---|
4123 | |
---|
4124 | \section{\module{abstract\_2d\_finite\_volumes.general\_mesh} } |
---|
4125 | \declaremodule[generalmesh]{}{general\_mesh} |
---|
4126 | \label{mod:generalmesh} |
---|
4127 | |
---|
4128 | \section{\module{abstract\_2d\_finite\_volumes.neighbour\_mesh} } |
---|
4129 | \declaremodule[neighbourmesh]{}{neighbour\_mesh} |
---|
4130 | \label{mod:neighbourmesh} |
---|
4131 | |
---|
4132 | \section{\module{abstract\_2d\_finite\_volumes.domain} --- Generic module for 2D triangular domains for finite-volume computations of conservation laws} |
---|
4133 | \declaremodule{}{domain} |
---|
4134 | \label{mod:domain} |
---|
4135 | |
---|
4136 | |
---|
4137 | \section{\module{abstract\_2d\_finite\_volumes.quantity}} |
---|
4138 | \declaremodule{}{quantity} |
---|
4139 | \label{mod:quantity} |
---|
4140 | |
---|
4141 | \begin{verbatim} |
---|
4142 | Class Quantity - Implements values at each triangular element |
---|
4143 | |
---|
4144 | To create: |
---|
4145 | |
---|
4146 | Quantity(domain, vertex_values) |
---|
4147 | |
---|
4148 | domain: Associated domain structure. Required. |
---|
4149 | |
---|
4150 | vertex_values: N x 3 array of values at each vertex for each element. |
---|
4151 | Default None |
---|
4152 | |
---|
4153 | If vertex_values are None Create array of zeros compatible with domain. |
---|
4154 | Otherwise check that it is compatible with dimenions of domain. |
---|
4155 | Otherwise raise an exception |
---|
4156 | |
---|
4157 | \end{verbatim} |
---|
4158 | |
---|
4159 | |
---|
4160 | |
---|
4161 | |
---|
4162 | \section{\module{shallow\_water} --- 2D triangular domains for finite-volume |
---|
4163 | computations of the shallow water wave equation. This module contains a specialisation |
---|
4164 | of class Domain from module domain.py consisting of methods specific to the Shallow Water |
---|
4165 | Wave Equation |
---|
4166 | } |
---|
4167 | \declaremodule[shallowwater]{}{shallow\_water} |
---|
4168 | \label{mod:shallowwater} |
---|
4169 | |
---|
4170 | |
---|
4171 | |
---|
4172 | |
---|
4173 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
4174 | |
---|
4175 | \chapter{Frequently Asked Questions} |
---|
4176 | |
---|
4177 | |
---|
4178 | \section{General Questions} |
---|
4179 | |
---|
4180 | \subsubsection{What is \anuga?} |
---|
4181 | It is a software package suitable for simulating 2D water flows in |
---|
4182 | complex geometries. |
---|
4183 | |
---|
4184 | \subsubsection{Why is it called \anuga?} |
---|
4185 | The software was developed in collaboration between the |
---|
4186 | Australian National University (ANU) and Geoscience Australia (GA). |
---|
4187 | |
---|
4188 | \subsubsection{How do I obtain a copy of \anuga?} |
---|
4189 | See \url{https://datamining.anu.edu.au/anuga} for all things ANUGA. |
---|
4190 | |
---|
4191 | %\subsubsection{What developments are expected for \anuga in the future?} |
---|
4192 | %This |
---|
4193 | |
---|
4194 | \subsubsection{Are there any published articles about \anuga that I can reference?} |
---|
4195 | See \url{https://datamining.anu.edu.au/anuga} for links. |
---|
4196 | |
---|
4197 | |
---|
4198 | \subsubsection{How do I find out what version of \anuga I am running?} |
---|
4199 | Use the following code snippet |
---|
4200 | \begin{verbatim} |
---|
4201 | from anuga.utilities.system_tools import get_revision_number |
---|
4202 | print get_revision_number() |
---|
4203 | \end{verbatim} |
---|
4204 | This should work both for installations from SourceForge as well as when working off the repository. |
---|
4205 | |
---|
4206 | |
---|
4207 | |
---|
4208 | |
---|
4209 | \section{Modelling Questions} |
---|
4210 | |
---|
4211 | \subsubsection{Which type of problems are \anuga good for?} |
---|
4212 | General 2D waterflows in complex geometries such as |
---|
4213 | dam breaks, flows amoung structurs, coastal inundation etc. |
---|
4214 | |
---|
4215 | \subsubsection{Which type of problems are beyond the scope of \anuga?} |
---|
4216 | See Chapter \ref{ch:limitations}. |
---|
4217 | |
---|
4218 | \subsubsection{Can I start the simulation at an arbitrary time?} |
---|
4219 | Yes, using \code{domain.set\_time()} you can specify an arbitrary |
---|
4220 | starting time. This is for example useful in conjunction with a |
---|
4221 | file\_boundary, which may start hours before anything hits the model |
---|
4222 | boundary. By assigning a later time for the model to start, |
---|
4223 | computational resources aren't wasted. |
---|
4224 | |
---|
4225 | \subsubsection{Can I change values for any quantity during the simulation?} |
---|
4226 | Yes, using \code{domain.set\_quantity()} inside the domain.evolve |
---|
4227 | loop you can change values of any quantity. This is for example |
---|
4228 | useful if you wish to let the system settle for a while before |
---|
4229 | assigning an initial condition. Another example would be changing |
---|
4230 | the values for elevation to model e.g. erosion. |
---|
4231 | |
---|
4232 | \subsubsection{Can I change boundary conditions during the simulation?} |
---|
4233 | Yes - see example on page \pageref{sec:change boundary code} in Section |
---|
4234 | \ref{sec:change boundary}. |
---|
4235 | |
---|
4236 | \subsubsection{How do I access model time during the simulation?} |
---|
4237 | The variable \code{t} in the evolve for loop is the model time. |
---|
4238 | For example to change the boundary at a particular time (instead of basing this on the state of the system as in Section \ref{sec:change boundary}) |
---|
4239 | one would write something like |
---|
4240 | {\small \begin{verbatim} |
---|
4241 | for t in domain.evolve(yieldstep = 0.2, duration = 40.0): |
---|
4242 | |
---|
4243 | if Numeric.allclose(t, 15): |
---|
4244 | print 'Changing boundary to outflow' |
---|
4245 | domain.set_boundary({'right': Bo}) |
---|
4246 | |
---|
4247 | \end{verbatim}} |
---|
4248 | The model time can also be accessed through the public interface \code{domain.get\_time()}, or changed (at your own peril) through \code{domain.set\_time()}. |
---|
4249 | |
---|
4250 | |
---|
4251 | \subsubsection{Why does a file\_function return a list of numbers when evaluated?} |
---|
4252 | Currently, file\_function works by returning values for the conserved |
---|
4253 | quantities \code{stage}, \code{xmomentum} and \code{ymomentum} at a given point in time |
---|
4254 | and space as a triplet. To access e.g.\ \code{stage} one must specify element 0 of the |
---|
4255 | triplet returned by file\_function. |
---|
4256 | |
---|
4257 | \subsubsection{Which diagnostics are available to troubleshoot a simulation?} |
---|
4258 | |
---|
4259 | \subsubsection{How do I use a DEM in my simulation?} |
---|
4260 | You use \code{dem2pts} to convert your DEM to the required .pts format. This .pts file is then called |
---|
4261 | when setting the elevation data to the mesh in \code{domain.set_quantity} |
---|
4262 | |
---|
4263 | \subsubsection{What sort of DEM resolution should I use?} |
---|
4264 | Try and work with the \emph{best} you have available. Onshore DEMs |
---|
4265 | are typically available in 25m, 100m and 250m grids. Note, offshore |
---|
4266 | data is often sparse, or non-existent. |
---|
4267 | |
---|
4268 | \subsubsection{What sort of mesh resolution should I use?} |
---|
4269 | The mesh resolution should be commensurate with your DEM - it does not make sense to put in place a mesh which is finer than your DEM. As an example, |
---|
4270 | if your DEM is on a 25m grid, then the cell resolution should be of the order of 315$m^2$ (this represents half the area of the square grid). Ideally, |
---|
4271 | you need a fine mesh over regions where the DEM changes rapidly, and other areas of significant interest, such as the coast. |
---|
4272 | If meshes are too coarse, discretisation errors in both stage and momentum may lead to unphysical results. All studies should include sensitivity and convergence studies based on different resolutions. |
---|
4273 | |
---|
4274 | |
---|
4275 | \subsubsection{How do I tag interior polygons?} |
---|
4276 | At the moment create_mesh_from_regions does not allow interior |
---|
4277 | polygons with symbolic tags. If tags are needed, the interior |
---|
4278 | polygons must be created subsequently. For example, given a filename |
---|
4279 | of polygons representing solid walls (in Arc Ungenerate format) can |
---|
4280 | be tagged as such using the code snippet: |
---|
4281 | \begin{verbatim} |
---|
4282 | # Create mesh outline with tags |
---|
4283 | mesh = create_mesh_from_regions(bounding_polygon, |
---|
4284 | boundary_tags=boundary_tags) |
---|
4285 | # Add buildings outlines with tags set to 'wall'. This would typically |
---|
4286 | # bind to a Reflective boundary |
---|
4287 | mesh.import_ungenerate_file(buildings_filename, tag='wall') |
---|
4288 | |
---|
4289 | # Generate and write mesh to file |
---|
4290 | mesh.generate_mesh(maximum_triangle_area=max_area) |
---|
4291 | mesh.export_mesh_file(mesh_filename) |
---|
4292 | \end{verbatim} |
---|
4293 | |
---|
4294 | Note that a mesh object is returned from \code{create_mesh_from_regions} |
---|
4295 | when file name is omitted. |
---|
4296 | |
---|
4297 | \subsubsection{How often should I store the output?} |
---|
4298 | This will depend on what you are trying to answer with your model and how much memory you have available on your machine. If you need |
---|
4299 | to look in detail at the evolution, then you will need to balance your storage requirements and the duration of the simulation. |
---|
4300 | If the SWW file exceeds 1Gb, another SWW file will be created until the end of the simulation. As an example, to store all the conserved |
---|
4301 | quantities on a mesh with approximately 300000 triangles on a 2 min interval for 5 hours will result in approximately 350Mb SWW file |
---|
4302 | (as for the \file{run\_sydney\_smf.py} example). |
---|
4303 | |
---|
4304 | \subsubsection{How can I set the friction in different areas in the domain?} |
---|
4305 | The model area will typically be estimating the water height and momentum over varying |
---|
4306 | topographies which will have different friction values. One way of assigning |
---|
4307 | different friction values is to create polygons (say \code{poly1, poly2 and poly3}) describing each |
---|
4308 | area and then set the corresponding friction values in the following way |
---|
4309 | |
---|
4310 | \code{domain.set_quantity('friction',Polygon_function([(poly1,f1),(poly2,f2), |
---|
4311 | (poly3,f3))]))} |
---|
4312 | |
---|
4313 | The values of \code{f1,f2} and \code{f3} could be constant or functions |
---|
4314 | as determined by the user. |
---|
4315 | |
---|
4316 | \subsubsection{How can I combine data sets?} |
---|
4317 | |
---|
4318 | A user may have access to a range of different resolution DEMs and raw data points (such |
---|
4319 | as beach profiles, spot heights, single or multi-beam data etc) and will need |
---|
4320 | to combine them to create an overall elevation data set. |
---|
4321 | |
---|
4322 | If there are multiple DEMs, say of 10m and 25m resolution, then the technique is similar to |
---|
4323 | that defined in the Cairns example described earlier, that is |
---|
4324 | |
---|
4325 | {\small \begin{verbatim} |
---|
4326 | convert_dem_from_ascii2netcdf(10m_dem_name, use_cache=True, verbose=True) |
---|
4327 | convert_dem_from_ascii2netcdf(25m_dem_name, use_cache=True, verbose=True) |
---|
4328 | \end{verbatim}} |
---|
4329 | followed by |
---|
4330 | {\small \begin{verbatim} |
---|
4331 | dem2pts(10m_dem_name, use_cache=True, verbose=True) |
---|
4332 | dem2pts(25m_dem_name, use_cache=True, verbose=True) |
---|
4333 | \end{verbatim}} |
---|
4334 | These data sets can now be combined by |
---|
4335 | {\small \begin{verbatim} |
---|
4336 | from anuga.geospatial_data.geospatial_data import * |
---|
4337 | G1 = Geospatial_data(file_name = 10m_dem_name + '.pts') |
---|
4338 | G2 = Geospatial_data(file_name = 25m_dem_name + '.pts') |
---|
4339 | G = G1 + G2 |
---|
4340 | G.export_points_file(combined_dem_name + .pts) |
---|
4341 | \end{verbatim}} |
---|
4342 | this is the basic way of combining data sets, however, the user will need to |
---|
4343 | assess the boundaries of each data set and whether they overlap. For example, consider |
---|
4344 | if the 10m DEM is describing by \code{poly1} and the 25m DEM is described by \code{poly2} |
---|
4345 | with \code{poly1} completely enclosed in \code{poly2} as shown in Figure \ref{fig:polydata} |
---|
4346 | \begin{figure}[hbt] |
---|
4347 | \centerline{\includegraphics{graphics/polyanddata.jpg}} |
---|
4348 | \caption{Polygons describing the extent of the 10m and 25m DEM.} |
---|
4349 | \label{fig:polydata} |
---|
4350 | \end{figure} |
---|
4351 | To combine the data sets, the geospatial addition is updated to |
---|
4352 | {\small \begin{verbatim} |
---|
4353 | G = G1 + G2.clip_outside(Geospatial_data(poly1)) |
---|
4354 | \end{verbatim}} |
---|
4355 | For this example, we assume that \code{poly2} is the domain, otherwise an additional dataset |
---|
4356 | would be required for the remainder of the domain. |
---|
4357 | |
---|
4358 | This technique can be expanded to handle point data sets as well. In the case |
---|
4359 | of a bathymetry data set available in text format in an \code{.csv} file, then |
---|
4360 | the geospatial addition is updated to |
---|
4361 | {\small \begin{verbatim} |
---|
4362 | G3 = Geospatial_data(file_name = bathy_data_name + '.csv') |
---|
4363 | G = G1 + G2.clip_outside(Geospatial_data(poly1)) + G3 |
---|
4364 | \end{verbatim}} |
---|
4365 | The \code{.csv} file has the data stored as \code{x,y,elevation} with the text \code{elevation} |
---|
4366 | on the first line. |
---|
4367 | |
---|
4368 | The coastline could be included |
---|
4369 | as part of the clipping polygon to separate the offshore and onshore datasets if required. |
---|
4370 | Assume that \code{poly1} crosses the coastline |
---|
4371 | In this case, two new polygons could be created out of \code{poly1} which uses the coastline |
---|
4372 | as the divider. As shown in Figure \ref{fig:polycoast}, \code{poly3} describes the |
---|
4373 | onshore data and \code{poly4} describes the offshore data. |
---|
4374 | \begin{figure}[hbt] |
---|
4375 | \centerline{\includegraphics{graphics/polyanddata2.jpg}} |
---|
4376 | \caption{Inclusion of new polygons separating the 10m DEM area into an |
---|
4377 | onshore (poly3) and offshore (poly4) data set.} |
---|
4378 | \label{fig:polycoast} |
---|
4379 | \end{figure} |
---|
4380 | Let's include the bathymetry |
---|
4381 | data described above, so to combine the datasets in this case, |
---|
4382 | {\small \begin{verbatim} |
---|
4383 | G = G1.clip(Geospatial_data(poly3)) + G2.clip_outside(Geospatial_data(poly1)) + G3 |
---|
4384 | \end{verbatim}} |
---|
4385 | |
---|
4386 | Finally, to fit the elevation data to the mesh, the script is adjusted in this way |
---|
4387 | {\small \begin{verbatim} |
---|
4388 | domain.set_quantity('elevation', |
---|
4389 | filename = combined_dem_name + '.pts', |
---|
4390 | use_cache = True, |
---|
4391 | verbose = True) |
---|
4392 | \end{verbatim}} |
---|
4393 | \subsection{Boundary Conditions} |
---|
4394 | |
---|
4395 | \subsubsection{How do I create a Dirichlet boundary condition?} |
---|
4396 | |
---|
4397 | A Dirichlet boundary condition sets a constant value for the |
---|
4398 | conserved quantities at the boundaries. A list containing |
---|
4399 | the constant values for stage, xmomentum and ymomentum is constructed |
---|
4400 | and used in the function call, e.g. \code{Dirichlet_boundary([0.2,0.,0.])} |
---|
4401 | |
---|
4402 | \subsubsection{How do I know which boundary tags are available?} |
---|
4403 | The method \code{domain.get\_boundary\_tags()} will return a list of |
---|
4404 | available tags for use with |
---|
4405 | \code{domain.set\_boundary\_condition()}. |
---|
4406 | |
---|
4407 | \subsubsection{What is the difference between file_boundary and field_boundary?} |
---|
4408 | The only difference is field_boundary will allow you to change the level of the stage height when you read in the boundary condition. |
---|
4409 | This is very useful when running different tide heights in the same area as you need only to convert |
---|
4410 | one boundary condition to a SWW file, ideally for tide height of 0 m (saving disk space). Then you can |
---|
4411 | use field_boundary to read this SWW file and change the stage height (tide) on the fly depending on the scenario. |
---|
4412 | |
---|
4413 | |
---|
4414 | |
---|
4415 | |
---|
4416 | \subsection{Analysing Results} |
---|
4417 | |
---|
4418 | \subsubsection{How do I easily plot "tide gauges" timeseries graphs from a SWW file?} |
---|
4419 | |
---|
4420 | There is two ways to do this. |
---|
4421 | |
---|
4422 | 1) Create csv files from the sww file using \code{anuga.abstract_2d_finite_volumes.util sww2csv_gauges} |
---|
4423 | and then use \code{anuga.abstract_2d_finite_volumes.util csv2timeseries_graphs} to |
---|
4424 | create the plots. This code is newer, has unit tests and might be easier to use. Read doc strings for more information and |
---|
4425 | review section 4.7 of this manual. |
---|
4426 | |
---|
4427 | Or |
---|
4428 | |
---|
4429 | 2) Use \code{anuga.abstract_2d_finite_volumes.util sww2timeseries} to do the whole thing |
---|
4430 | however this doesn't have a much control on the file name and plots. Plus there is no unit tests yet. |
---|
4431 | |
---|
4432 | Read the doc string for more information. |
---|
4433 | |
---|
4434 | \subsubsection{How do I extract elevation and other quantities from a SWW file?} |
---|
4435 | |
---|
4436 | The function \code{sww2dem} can extract any quantity, or expression using |
---|
4437 | quantities, from a SWW file as used in |
---|
4438 | the Cairns example described earlier. This function is used in \code{ExportResults.py} |
---|
4439 | in the Cairns demo folder where stage, absolute momentum, depth, speed and elevation |
---|
4440 | can be exported from the input sww file. Note that depth, absolute momentum and speed |
---|
4441 | are expressions and stage and elevation are quantities. In addition to extracting a particular |
---|
4442 | quantity or expression, the user can define a region to extract these values by |
---|
4443 | defining the minimum and maximum of both the easting and northing coordinates. The function |
---|
4444 | also calls for a grid resolution, or cell size, to extract these values at. It is |
---|
4445 | recommended to align this resolution with the mesh resolution in the desired region and to not |
---|
4446 | generate a fine grid where the model output cannot support that resolution. |
---|
4447 | |
---|
4448 | |
---|
4449 | |
---|
4450 | \chapter{Glossary} |
---|
4451 | |
---|
4452 | \begin{tabular}{|lp{10cm}|c|} \hline |
---|
4453 | %\begin{tabular}{|llll|} \hline |
---|
4454 | \emph{Term} & \emph{Definition} & \emph{Page}\\ \hline |
---|
4455 | |
---|
4456 | \indexedbold{\anuga} & Name of software (joint development between ANU and |
---|
4457 | GA) & \pageref{def:anuga}\\ |
---|
4458 | |
---|
4459 | \indexedbold{bathymetry} & offshore elevation &\\ |
---|
4460 | |
---|
4461 | \indexedbold{conserved quantity} & conserved (stage, x and y |
---|
4462 | momentum) & \\ |
---|
4463 | |
---|
4464 | % \indexedbold{domain} & The domain of a function is the set of all input values to the |
---|
4465 | % function.&\\ |
---|
4466 | |
---|
4467 | \indexedbold{Digital Elevation Model (DEM)} & DEMs are digital files consisting of points of elevations, |
---|
4468 | sampled systematically at equally spaced intervals.& \\ |
---|
4469 | |
---|
4470 | \indexedbold{Dirichlet boundary} & A boundary condition imposed on a differential equation |
---|
4471 | that specifies the values the solution is to take on the boundary of the |
---|
4472 | domain. & \pageref{def:dirichlet boundary}\\ |
---|
4473 | |
---|
4474 | \indexedbold{edge} & A triangular cell within the computational mesh can be depicted |
---|
4475 | as a set of vertices joined by lines (the edges). & \\ |
---|
4476 | |
---|
4477 | \indexedbold{elevation} & refers to bathymetry and topography &\\ |
---|
4478 | |
---|
4479 | \indexedbold{evolution} & integration of the shallow water wave equations |
---|
4480 | over time &\\ |
---|
4481 | |
---|
4482 | \indexedbold{finite volume method} & The method evaluates the terms in the shallow water |
---|
4483 | wave equation as fluxes at the surfaces of each finite volume. Because the |
---|
4484 | flux entering a given volume is identical to that leaving the adjacent volume, |
---|
4485 | these methods are conservative. Another advantage of the finite volume method is |
---|
4486 | that it is easily formulated to allow for unstructured meshes. The method is used |
---|
4487 | in many computational fluid dynamics packages. & \\ |
---|
4488 | |
---|
4489 | \indexedbold{forcing term} & &\\ |
---|
4490 | |
---|
4491 | \indexedbold{flux} & the amount of flow through the volume per unit |
---|
4492 | time & \\ |
---|
4493 | |
---|
4494 | \indexedbold{grid} & Evenly spaced mesh & \\ |
---|
4495 | |
---|
4496 | \indexedbold{latitude} & The angular distance on a mericlear north and south of the |
---|
4497 | equator, expressed in degrees and minutes. & \\ |
---|
4498 | |
---|
4499 | \indexedbold{longitude} & The angular distance east or west, between the meridian |
---|
4500 | of a particular place on Earth and that of the Prime Meridian (located in Greenwich, |
---|
4501 | England) expressed in degrees or time.& \\ |
---|
4502 | |
---|
4503 | \indexedbold{Manning friction coefficient} & &\\ |
---|
4504 | |
---|
4505 | \indexedbold{mesh} & Triangulation of domain &\\ |
---|
4506 | |
---|
4507 | \indexedbold{mesh file} & A TSH or MSH file & \pageref{def:mesh file}\\ |
---|
4508 | |
---|
4509 | \indexedbold{NetCDF} & &\\ |
---|
4510 | |
---|
4511 | \indexedbold{node} & A point at which edges meet & \\ |
---|
4512 | |
---|
4513 | \indexedbold{northing} & A rectangular (x,y) coordinate measurement of distance |
---|
4514 | north from a north-south reference line, usually a meridian used as the axis of |
---|
4515 | origin within a map zone or projection. Northing is a UTM (Universal Transverse |
---|
4516 | Mercator) coordinate. & \\ |
---|
4517 | |
---|
4518 | |
---|
4519 | \indexedbold{points file} & A PTS or CSV file & \\ \hline |
---|
4520 | |
---|
4521 | \end{tabular} |
---|
4522 | |
---|
4523 | \begin{tabular}{|lp{10cm}|c|} \hline |
---|
4524 | |
---|
4525 | \indexedbold{polygon} & A sequence of points in the plane. \anuga represents a polygon |
---|
4526 | either as a list consisting of Python tuples or lists of length 2 or as an $N \times 2$ |
---|
4527 | Numeric array, where $N$ is the number of points. |
---|
4528 | |
---|
4529 | The unit square, for example, would be represented either as |
---|
4530 | \code{[ [0,0], [1,0], [1,1], [0,1] ]} or as \code{array( [0,0], [1,0], [1,1], |
---|
4531 | [0,1] )}. |
---|
4532 | |
---|
4533 | NOTE: For details refer to the module \module{utilities/polygon.py}. & |
---|
4534 | \\ \indexedbold{resolution} & The maximal area of a triangular cell in a |
---|
4535 | mesh & \\ |
---|
4536 | |
---|
4537 | |
---|
4538 | \indexedbold{reflective boundary} & Models a solid wall. Returns same conserved |
---|
4539 | quantities as those present in the neighbouring volume but reflected. Specific to the |
---|
4540 | shallow water equation as it works with the momentum quantities assumed to be the |
---|
4541 | second and third conserved quantities. & \pageref{def:reflective boundary}\\ |
---|
4542 | |
---|
4543 | \indexedbold{stage} & &\\ |
---|
4544 | |
---|
4545 | % \indexedbold{try this} |
---|
4546 | |
---|
4547 | \indexedbold{animate} & visualisation tool used with \anuga & |
---|
4548 | \pageref{sec:animate}\\ |
---|
4549 | |
---|
4550 | \indexedbold{time boundary} & Returns values for the conserved |
---|
4551 | quantities as a function of time. The user must specify |
---|
4552 | the domain to get access to the model time. & \pageref{def:time boundary}\\ |
---|
4553 | |
---|
4554 | \indexedbold{topography} & onshore elevation &\\ |
---|
4555 | |
---|
4556 | \indexedbold{transmissive boundary} & & \pageref{def:transmissive boundary}\\ |
---|
4557 | |
---|
4558 | \indexedbold{vertex} & A point at which edges meet. & \\ |
---|
4559 | |
---|
4560 | \indexedbold{xmomentum} & conserved quantity (note, two-dimensional SWW equations say |
---|
4561 | only \code{x} and \code{y} and NOT \code{z}) &\\ |
---|
4562 | |
---|
4563 | \indexedbold{ymomentum} & conserved quantity & \\ \hline |
---|
4564 | |
---|
4565 | \end{tabular} |
---|
4566 | |
---|
4567 | |
---|
4568 | %The \code{\e appendix} markup need not be repeated for additional |
---|
4569 | %appendices. |
---|
4570 | |
---|
4571 | |
---|
4572 | % |
---|
4573 | % The ugly "%begin{latexonly}" pseudo-environments are really just to |
---|
4574 | % keep LaTeX2HTML quiet during the \renewcommand{} macros; they're |
---|
4575 | % not really valuable. |
---|
4576 | % |
---|
4577 | % If you don't want the Module Index, you can remove all of this up |
---|
4578 | % until the second \input line. |
---|
4579 | % |
---|
4580 | |
---|
4581 | %begin{latexonly} |
---|
4582 | %\renewcommand{\indexname}{Module Index} |
---|
4583 | %end{latexonly} |
---|
4584 | \input{mod\jobname.ind} % Module Index |
---|
4585 | % |
---|
4586 | %begin{latexonly} |
---|
4587 | %\renewcommand{\indexname}{Index} |
---|
4588 | %end{latexonly} |
---|
4589 | \input{\jobname.ind} % Index |
---|
4590 | |
---|
4591 | |
---|
4592 | |
---|
4593 | \begin{thebibliography}{99} |
---|
4594 | \bibitem[nielsen2005]{nielsen2005} |
---|
4595 | {\it Hydrodynamic modelling of coastal inundation}. |
---|
4596 | Nielsen, O., S. Roberts, D. Gray, A. McPherson and A. Hitchman. |
---|
4597 | In Zerger, A. and Argent, R.M. (eds) MODSIM 2005 International Congress on |
---|
4598 | Modelling and Simulation. Modelling and Simulation Society of Australia and |
---|
4599 | New Zealand, December 2005, pp. 518-523. ISBN: 0-9758400-2-9.\\ |
---|
4600 | http://www.mssanz.org.au/modsim05/papers/nielsen.pdf |
---|
4601 | |
---|
4602 | \bibitem[grid250]{grid250} |
---|
4603 | Australian Bathymetry and Topography Grid, June 2005. |
---|
4604 | Webster, M.A. and Petkovic, P. |
---|
4605 | Geoscience Australia Record 2005/12. ISBN: 1-920871-46-2.\\ |
---|
4606 | http://www.ga.gov.au/meta/ANZCW0703008022.html |
---|
4607 | |
---|
4608 | \bibitem[ZR1999]{ZR1999} |
---|
4609 | \newblock {Catastrophic Collapse of Water Supply Reservoirs in Urban Areas}. |
---|
4610 | \newblock C.~Zoppou and S.~Roberts. |
---|
4611 | \newblock {\em ASCE J. Hydraulic Engineering}, 125(7):686--695, 1999. |
---|
4612 | |
---|
4613 | \bibitem[Toro1999]{Toro1992} |
---|
4614 | \newblock Riemann problems and the waf method for solving the two-dimensional |
---|
4615 | shallow water equations. |
---|
4616 | \newblock E.~F. Toro. |
---|
4617 | \newblock {\em Philosophical Transactions of the Royal Society, Series A}, |
---|
4618 | 338:43--68, 1992. |
---|
4619 | |
---|
4620 | \bibitem{KurNP2001} |
---|
4621 | \newblock Semidiscrete central-upwind schemes for hyperbolic conservation laws |
---|
4622 | and hamilton-jacobi equations. |
---|
4623 | \newblock A.~Kurganov, S.~Noelle, and G.~Petrova. |
---|
4624 | \newblock {\em SIAM Journal of Scientific Computing}, 23(3):707--740, 2001. |
---|
4625 | \end{thebibliography}{99} |
---|
4626 | |
---|
4627 | \end{document} |
---|