source: documentation/user_manual/anuga_user_manual.tex @ 2805

Last change on this file since 2805 was 2805, checked in by ole, 19 years ago

Comments

  • Property svn:keywords set to LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
File size: 77.2 KB
Line 
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
16
17\documentclass{manual}
18
19\usepackage{graphicx}
20\usepackage{datetime}
21
22\input{definitions}
23
24\title{\anuga User Manual}
25\author{Geoscience Australia and the Australian National University}
26
27% Please at least include a long-lived email address;
28% the rest is at your discretion.
29\authoraddress{Geoscience Australia \\
30  Email: \email{ole.nielsen@ga.gov.au}
31}
32
33%Draft date
34
35% update before release!
36% Use an explicit date so that reformatting
37% doesn't cause a new date to be used.  Setting
38% the date to \today can be used during draft
39% stages to make it easier to handle versions.
40
41
42\longdate       % Make date format long using datetime.sty
43%\settimeformat{xxivtime} % 24 hour Format
44\settimeformat{oclock} % Verbose
45\date{\today, \ \currenttime}
46
47\ifhtml
48\date{\today} % latex2html does not know about datetime
49\fi
50
51
52
53
54
55\release{1.0}   % release version; this is used to define the
56                % \version macro
57
58\makeindex          % tell \index to actually write the .idx file
59\makemodindex       % If this contains a lot of module sections.
60
61\setcounter{tocdepth}{3}
62\setcounter{secnumdepth}{3}
63
64
65\begin{document}
66\maketitle
67
68
69% This makes the contents more accessible from the front page of the HTML.
70\ifhtml
71\chapter*{Front Matter\label{front}}
72\fi
73
74%Subversion keywords:
75%
76%$LastChangedDate: 2006-05-05 06:26:00 +0000 (Fri, 05 May 2006) $
77%$LastChangedRevision: 2805 $
78%$LastChangedBy: ole $
79
80\input{copyright}
81
82
83\begin{abstract}
84
85\noindent \anuga\index{\anuga} is a hydrodynamic modelling tool that
86allows users to model realistic flow problems in complex geometries.
87Examples include dam breaks or the effects of natural hazards such
88as riverine flooding, storm surges and tsunami.
89
90The user must specify a study area represented by a mesh of triangular
91cells, the topography and bathymetry, frictional resistance, initial
92values for water level (called \emph{stage}\index{stage} within \anuga),
93boundary
94conditions and forces such as windstress or pressure gradients if
95applicable.
96
97\anuga tracks the evolution of water depth and horizontal momentum
98within each cell over time by solving the shallow water wave equation
99governing equation using a finite-volume method.
100
101\anuga cannot model details of breaking waves, flow under ceilings such
102as pipes, turbulence and vortices, vertical convection or viscous
103flows.
104
105\anuga also incorporates a mesh generator, called \code{pmesh}, that
106allows the user to set up the geometry of the problem interactively as
107well as tools for interpolation and surface fitting, and a number of
108auxiliary tools for visualising and interrogating the model output.
109
110Most \anuga components are written in the object-oriented programming
111language Python and most users will interact with \anuga by writing
112small Python programs based on the \anuga library
113functions. Computationally intensive components are written for
114efficiency in C routines working directly with the Numerical Python
115structures.
116
117
118\end{abstract}
119
120\tableofcontents
121
122
123\chapter{Introduction}
124
125
126\section{Purpose}
127
128The purpose of this user manual is to introduce the new user to
129the software, describe what it can do and give step-by-step
130instructions for setting up and running hydrodynamic simulations.
131
132\section{Scope}
133
134This manual covers only what is needed to operate the software
135after installation and configuration. It does not includes instructions for
136installing the software or detailed API documentation, both of
137which will be covered in separate publications.
138
139\section{Audience}
140
141Readers are assumed to be familiar with the operating environment
142and have a general understanding of the problem background, as
143well as enough programming experience to adapt the code to
144different requirements, as described in this manual,  and to
145understand the basic terminology of object-oriented programming.
146
147\section{Structure of This Manual}
148
149This manual is structured as follows:
150
151\begin{itemize}
152  \item Background (What \anuga does)
153  \item A \emph{Getting Started} section
154  \item A detailed description of the public interface
155  \item \anuga 's overall architecture, components and file formats
156  \item Assumptions
157\end{itemize}
158
159
160\pagebreak
161\chapter{Background}
162
163\chapter{Getting Started}
164\label{ch:getstarted}
165
166This section is designed to assist the reader to get started with
167\anuga by working through simple examples. Two examples are discussed;
168the first is a simple but artificial example that is useful to illustrate
169many of the ideas, and the second is a more realistic example.
170
171\section{A Simple Example}
172
173\subsection{Overview}
174
175What follows is a discussion of the structure and operation of the
176file \file{bedslopephysical.py}, with just enough detail to allow
177the reader to appreciate what's involved in setting up a scenario
178like the one it depicts.
179
180This example carries out the solution of the shallow-water wave
181equation in the simple case of a configuration comprising a flat
182bed, sloping at a fixed angle in one direction and having a
183constant depth across each line in the perpendicular direction.
184
185The example demonstrates many of the basic ideas involved in
186setting up a more complex scenario. In the general case the user
187specifies the geometry (bathymetry and topography), the initial
188water level, boundary conditions such as tide, and any forcing
189terms that may drive the system such as wind stress or atmospheric
190pressure gradients. Frictional resistance from the different
191terrains in the model is represented by predefined forcing
192terms. The boundary is reflective on three sides and a time dependent wave on one side.
193
194The present example represents a simple scenario and does not
195include any forcing terms, nor is the data taken from a file as it
196would be in many typical cases.
197
198The conserved quantities involved in the
199problem are water depth, $x$-momentum and $y$-momentum. Other quantities
200involved in the computation are the friction, stage (absolute height of water surface)
201and elevation, the last two being related to
202the depth through the equation
203
204\begin{tabular}{rcrcl}
205  \code{stage} &=& \code{elevation} &+& \code{depth}
206\end{tabular}
207
208
209%\emph{[More details of the problem background]}
210
211\subsection{Outline of the Program}
212
213In outline, \file{bedslopephysical.py} performs the following steps:
214
215\begin{enumerate}
216
217   \item Sets up a triangular mesh.
218
219   \item Sets certain parameters governing the mode of
220operation of the model-specifying, for instance, where to store the model output.
221
222   \item Inputs various quantities describing physical measurements, such
223as the elevation, to be specified at each mesh point (vertex).
224
225   \item Sets up the boundary conditions.
226
227   \item Carries out the evolution of the model through a series of time
228steps and outputs the results, providing a results file that can
229be visualised.
230
231\end{enumerate}
232
233\subsection{The Code}
234
235%FIXME: we are using the \code function here.
236%This should be used wherever possible
237For reference we include below the complete code listing for
238\file{bedslopephysical.py}. Subsequent paragraphs provide a
239`commentary' that describes each step of the program and explains it
240significance.
241
242\verbatiminput{examples/bedslopephysical.py}
243%\verbatiminput{examples/bedslope.py}
244
245\subsection{Establishing the Mesh}
246
247The first task is to set up the triangular mesh to be used for the
248scenario. This is carried out through the statement:
249
250{\small \begin{verbatim}
251    points, vertices, boundary = rectangular(10, 10)
252\end{verbatim}}
253
254The function \function{rectangular} is imported from a module
255\module{mesh\_factory} defined elsewhere. (\anuga also contains
256several other schemes that can be used for setting up meshes, but we
257shall not discuss these now.) The above assignment sets up a $10
258\times 10$ rectangular mesh, triangulated in a specific way. In
259general, the assignment
260
261{\small \begin{verbatim}
262    points, vertices, boundary = rectangular(m, n)
263\end{verbatim}}
264
265returns:
266
267\begin{itemize}
268
269   \item a list \code{points} of length $N$, where $N = (m + 1)(n + 1)$,
270comprising the coordinates \code{(x, y)} of each of the $N$ mesh
271points,
272
273   \item a list \code{vertices} of length $2mn$ (each entry specifies the three
274vertices of one of the triangles used in the triangulation) , and
275
276   \item a dictionary \code{boundary}, used to tag the triangle edges on
277the boundaries. Each key corresponds to a triangle edge on one of
278the four boundaries and its value is one of \code{`left'},
279\code{`right'}, \code{`top'} and \code{`bottom'}, indicating
280which boundary the edge in question belongs to.
281
282\end{itemize}
283
284
285\subsection{Initialising the Domain}
286
287These variables are then used to set up a data structure
288\code{domain}, through the assignment:
289
290{\small \begin{verbatim}
291    domain = Domain(points, vertices, boundary)
292\end{verbatim}}
293
294This uses a Python class \class{Domain}, imported from
295\module{shallow\_water}, which is an extension of a more generic
296class of the same name in the module \refmodule{pyvolution.domain}
297(page \pageref{mod:pyvolution.domain}),
298and inherits
299some methods from the generic class but has others specific to the
300shallow-water scenarios in which it is used. Specific options for
301domain are set at this point. One of them is to set the basename for
302the output file:
303
304{\small \begin{verbatim}
305    domain.set_name('bedslope')
306\end{verbatim}}
307
308
309\subsection{Initial Conditions}
310
311The next task is to specify a number of quantities that we wish to
312set for each mesh point. The class \class{Domain} has a method
313\method{set\_quantity}, used to specify these quantities. It is a
314particularly flexible method that allows the user to set quantities
315in a variety of ways---using constants, functions, numeric arrays or
316expressions involving other quantities, arbitrary data points with
317associated values, all of which can be passed as arguments. All
318quantities can be initialised using \method{set\_quantity}. For
319conserved quantities (\code{stage, xmomentum, ymomentum}) this is
320called the \emph{initial condition}, for other quantities that
321aren't updated by the equation, the same interface is used to assign
322their values. The code in the present example demonstrates a number
323of forms in which we can invoke \method{set\_quantity}.
324
325
326\subsubsection{Elevation}
327
328The elevation, or height of the bed, is set using a function,
329defined through the statements below, which is specific to this
330example and specifies a particularly simple initial configuration
331for demonstration purposes:
332
333{\small \begin{verbatim}
334    def f(x,y):
335        return -x/2
336\end{verbatim}}
337
338This simply associates an elevation with each point \code{(x, y)} of
339the plane.  It specifies that the bed slopes linearly in the
340\code{x} direction, with slope $-\frac{1}{2}$,  and is constant in
341the \code{y} direction.  %[screen shot?]
342
343Once the function \function{f} is specified, the quantity
344\code{elevation} is assigned through the simple statement:
345
346{\small \begin{verbatim}
347    domain.set_quantity('elevation', f)
348\end{verbatim}}
349
350
351\subsubsection{Friction}
352
353The assignment of the friction quantity demonstrates another way we
354can use \method{set\_quantity} to set quantities---namely, assign
355them to a constant numerical value:
356
357{\small \begin{verbatim}
358    domain.set_quantity('friction', 0.1)
359\end{verbatim}}
360
361This just specifies that the Manning friction coefficient is set
362to 0.1 at every mesh point.
363
364\subsubsection{Stage}
365
366The stage (the height of the water surface) is related to the
367elevation and the depth at any time by the equation
368
369
370{\small \begin{verbatim}
371    stage = elevation + depth
372\end{verbatim}}
373
374
375For this example, we simply assign a constant value to \code{stage},
376using the statement
377
378{\small \begin{verbatim}
379    domain.set_quantity('stage', -.4)
380\end{verbatim}}
381
382which specifies that the surface level is set to a height of $-0.4$, i.e. 0.4 units
383below the zero level.
384
385(Although it is not necessary for this example, it may be useful to
386digress here and mention a variant to this requirement, which allows
387us to illustrate another way to use \method{set\_quantity}---namely,
388incorporating an expression involving other quantities. Suppose,
389instead of setting a constant value for the stage, we wished to
390specify a constant value for the \emph{depth}. For such a case we
391need to specify that \code{stage} is everywhere obtained by adding
392that value to the value already specified for \code{elevation}. We
393would do this by means of the statements:
394
395{\small \begin{verbatim}
396    h = 0.05 # Constant depth
397    domain.set_quantity('stage', expression = 'elevation + %f' %h)
398\end{verbatim}}
399
400That is, the value of \code{stage} is set to $\code{h} = 0.05$ plus
401the value of \code{elevation} already defined.
402
403The reader will probably appreciate that this capability to
404incorporate expressions into statements using \method{set\_quantity}
405greatly expands its power.)
406
407\subsection{Boundary Conditions}
408
409The boundary conditions are specified as follows:
410
411{\small \begin{verbatim}
412    Br = Reflective_boundary(domain)
413
414    Bt = Transmissive_boundary(domain)
415
416    Bd = Dirichlet_boundary([0.2,0.,0.])
417
418    Bw = Time_boundary(domain=domain,
419                f=lambda t: [(0.1*sin(t*2*pi)-0.3), 0.0, 0.0])
420\end{verbatim}}
421
422The effect of these statements is to set up four alternative
423boundary conditions and store them in variables that can be
424assigned as needed. Each boundary condition specifies the
425behaviour at a boundary in terms of the behaviour in neighbouring
426elements. The boundary conditions introduced here may be briefly described as
427follows:
428
429\begin{description}
430    \item[Reflective boundary] Returns same \code{stage} as
431    as present in its neighbour volume but momentum vector reversed 180 degrees (reflected).
432    Specific to the shallow water equation as it works with the
433    momentum quantities assumed to be the second and third conserved
434    quantities.
435
436    \item[Transmissive boundary]Returns same conserved quantities as
437    those present in its neighbour volume.
438
439    \item[Dirichlet boundary]Specifies a fixed value at the
440boundary and assigns initial values to the $x$-momentum and $y$-momentum.
441
442    \item[Time boundary.]A Dirichlet boundary whose behaviour varies with time.
443\end{description}
444
445Once the four boundary types have been specified through the
446statements above, they can be applied through a statement of the
447form
448
449{\small \begin{verbatim}
450    domain.set_boundary({'left': Br, 'right': Bw, 'top': Br, 'bottom': Br})
451\end{verbatim}}
452
453This statement stipulates that, in the current example, the right
454boundary varies with time, as defined by the equation, while the other
455boundaries are all reflective.
456
457The reader may wish to experiment by varying the choice of boundary
458types for one or more of the boundaries. In the case of \code{Bd}
459and \code{Bw}, the three arguments in each case represent the
460elevation, $x$-momentum and $y$-momentum, respectively.
461
462{\small \begin{verbatim}
463    Bw = Time_boundary(domain=domain,
464                f=lambda t: [(0.1*sin(t*2*pi)-0.3), 0.0, 0.0])
465\end{verbatim}}
466
467
468
469\subsection{Evolution}
470
471The final statement \nopagebreak[3]
472{\small \begin{verbatim}
473    for t in domain.evolve(yieldstep = 0.1, duration = 4.0):
474        print domain.timestepping_statistics()
475\end{verbatim}}
476
477is the key step that causes the configuration of the domain to
478`evolve' in accordance with the model embodied in the code, over a
479series of steps indicated by the values of \code{yieldstep} and
480\code{duration}, which can be altered as required.
481The value of \code{yieldstep} controls the time interval between successive model outputs.
482Behind the scenes more time steps are generally taken.
483
484
485\subsection{Output}
486
487%Give details here of the form of the output and explain how it can
488%be used with swollen. Include screen shots.//
489
490The output is a NetCDF file with the extension \code{.sww}. It
491contains stage and momentum information and can be used with the
492\code{swollen} visualisation package to generate a visual display.
493See Section \ref{sec:file formats} (page \pageref{sec:file formats})
494for more on NetCDF and other file formats.
495
496
497\section{How to Run the Code}
498
499The code can be run in various ways:
500
501\begin{itemize}
502  \item{from a Windows command line} as in \code{python bedslopephysical.py}
503  \item{within the Python IDLE environment}
504  \item{within emacs}
505  \item{from a Linux command line} as in \code{python bedslopephysical.py}
506\end{itemize}
507
508
509\section{Exploring the model output}
510
511Figure \ref{fig:bedslopestart} shows the \\
512Figure \ref{fig:bedslope2} shows later snapshots...
513
514
515
516\begin{figure}[hbt]
517
518  \centerline{ \includegraphics[width=75mm, height=75mm]{examples/bedslopestart.eps}}
519
520  \caption{Bedslope example viewed with Swollen}
521  \label{fig:bedslopestart}
522\end{figure}
523
524
525\begin{figure}[hbt]
526
527  \centerline{
528    \includegraphics[width=75mm, height=75mm]{examples/bedslopeduring.eps}
529    \includegraphics[width=75mm, height=75mm]{examples/bedslopeend.eps}
530   }
531
532  \caption{Bedslope example viewed with Swollen}
533  \label{fig:bedslope2}
534\end{figure}
535
536
537
538
539\clearpage
540
541%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
542
543\section{An Example with Real Data}
544
545The following discussion builds on the concepts introduced through
546the \file{bedslopephysical.py} example and introduces a second
547example, \file{run\_sydney\_smf.py}, that follows the same basic
548outline, but incorporates more complex features and refers to a
549real-life scenario, rather than the artificial illustrative one used
550in \file{bedslopephysical.py}. The domain of interest surrounds the
551Sydney region, and predominantly covers Sydney Harbour. A
552hypothetical tsunami wave is generated by a submarine mass failure
553situated on the edge of the continental shelf.
554
555\subsection{Overview}
556As in the case of \file{bedslopephysical.py}, the actions carried
557out by the program can be organised according to this outline:
558
559\begin{enumerate}
560
561   \item Set up a triangular mesh.
562
563   \item Set certain parameters governing the mode of
564operation of the model---specifying, for instance, where to store the
565model output.
566
567   \item Input various quantities describing physical measurements, such
568as the elevation, to be specified at each mesh point (vertex).
569
570   \item Set up the boundary conditions.
571
572   \item Carry out the evolution of the model through a series of time
573steps and outputs the results, providing a results file that can be
574visualised.
575
576\end{enumerate}
577
578
579
580\subsection{The Code}
581
582Here is the code for \file{run\_sydney\_smf.py}:
583
584%\verbatiminput{"runsydneysmf.py"}
585\verbatiminput{examples/runsydney.py}
586
587In discussing the details of this example, we follow the outline
588given above, discussing each major step of the code in turn.
589
590\subsection{Establishing the Mesh}
591
592One obvious way that the present example differs from
593\file{bedslopephysical.py} is in the use of a more complex method to
594create the mesh. Instead of imposing a mesh structure on a
595rectangular grid, the technique used for this example involves
596building mesh structures inside polygons specified by the user,
597using a mesh-generator referred to as \code{pmesh}.
598
599The following remarks may help the reader understand how
600\code{pmesh} is used.
601
602In its simplest form, \code{pmesh} creates the mesh within a single
603polygon whose vertices are at geographical locations specified by the
604user. The user specifies the \emph{resolution}---that is, the maximal
605area of a triangle used for triangulation---and mesh points are
606created inside the polygon through a random process. Figure
607\ref{fig:pentagon} shows a simple example of this, in which
608the triangulation is carried out within a pentagon.
609
610
611\begin{figure}[hbt]
612
613
614
615  \caption{Mesh points are created inside the polygon}
616  \label{fig:pentagon}
617\end{figure}
618
619Boundary tags are not restricted to \code{`left'}, \code{`right'},
620\code{`bottom'} and \code{`top'}, as in the case of
621\file{bedslopephysical.py}. Instead the user specifies a list of
622tags appropriate to the configuration being modelled.
623
624While a mesh created inside a polygon offers more flexibility than
625one based on a rectangular grid, using \code{pmesh} in the limited
626form we have described so far still doesn't provide a way to adapt
627to geographic or other features in the landscape, whose presence may
628require us to vary the resolution in the neighbourhood of the
629features. To cope with this requirement, \code{pmesh} also allows
630the user to specify a number of \emph{interior polygons}, which are
631triangulated separately, each according to a separately specified
632resolution. See Figure \ref{fig:interior meshes}.
633
634\begin{figure}[hbt]
635
636
637
638  \caption{Interior meshes with individual resolution}
639  \label{fig:interior meshes}
640\end{figure}
641
642In its general form, \code{pmesh} takes for its input a bounding
643polygon and (optionally) a list of interior polygons. The user
644specifies resolutions, both for the bounding polygon and for each of
645the interior polygons. Given this data, \code{pmesh} first creates a
646triangular mesh inside the bounding polygon, using the specified
647resolution, and then creates a separate triangulation inside each of
648the interior polygons, using the resolution specified for that
649polygon.
650
651The function used to implement this process is
652\function{create\_mesh\_from\_regions}. Its arguments include the
653bounding polygon and its resolution, a list of boundary tags, and a
654list of pairs \code{[polygon, resolution]}, specifying the interior
655polygons and their resolutions.
656
657In practice, the details of the polygons used are read from a
658separate file \file{project.py}. The resulting mesh is output to a
659\emph{meshfile}\index{meshfile}. This term is used to describe a
660file of a specific format used to store the data specifying a mesh.
661(There are in fact two possible formats for such a file: it can
662either be a binary file, with extension \code{.msh}, or an ASCII
663file, with extension \code{.tsh}. In the present case, the binary
664file format \code{.msh} is used. See Section \ref{sec:file formats}
665(page \pageref{sec:file formats}) for more on file formats.)
666\code{pmesh} assigns a name to the file by appending the extension
667\code{.msh} to the name specified in the input file
668\file{project.py}. This name is stored in the variable
669\code{meshname}.
670
671The statements
672
673{\small \begin{verbatim}
674    interior_res = 5000%
675    interior_regions = [[project.harbour_polygon_2, interior_res],
676                    [project.botanybay_polygon_2, interior_res]]
677\end{verbatim}}
678
679are used to read in the specific polygons \code{project.harbour\_polygon\_2} and
680\code{botanybay\_polygon\_2} from \file{project.py} and assign a
681common resolution of 5000 to each. The statement
682
683{\small \begin{verbatim}
684    create_mesh_from_regions(project.diffpolygonall,%
685                         boundary_tags= {'bottom': [0],%
686                                         'right1': [1],%
687                                         'right0': [2],%
688                                         'right2': [3],%
689                                         'top': [4],%
690                                         'left1': [5],%
691                                         'left2': [6],%
692                                         'left3': [7]},%
693                         maximum_triangle_area=100000,%
694                         filename=meshname,%
695                         interior_regions=interior_regions)
696\end{verbatim}}
697
698is then used to create the mesh, taking the bounding polygon to be the polygon
699\code{diffpolygonall} specified in \file{project.py}. The
700argument \code{boundary\_tags} assigns a dictionary, whose keys are the
701names of the boundary tags used for the bounding polygon---\code{`bottom'},
702`right0', `right1', `right2', `top', `left1', `left2' and `left3'---
703and whose values identify the indices of the segments associated with each of these
704tags. (The value associated with each boundary tag is a one-element list.)
705
706
707\subsection{Initialising the Domain}
708
709As with \file{bedslopephysical.py}, once we have created the mesh, the next
710step is to create the data structure \code{domain}. We did this for
711\file{bedslopephysical.py} by inputting lists of points and triangles and
712specifying the boundary tags directly. However, in the present case,
713we use a method that works directly with the meshfile
714\code{meshname}, as follows:
715
716
717\emph{NOTE: Will be replaced by domain=Domain(meshname, use_cache=True, verbose=True)}
718
719
720{\small \begin{verbatim}
721    domain = pmesh_to_domain_instance(meshname,
722    Domain, use_cache = True, verbose = True)
723\end{verbatim}}
724
725The function \function{pmesh\_to\_domain\_instance} converts a meshfile
726\code{meshname} into an instance of the data structure
727\code{domain}, allowing us to use methods like \method{set\_quantity}
728to set quantities and to apply other operations. (In principle, the
729second argument of \function{pmesh\_to\_domain\_instance} can be any
730subclass of \class{Domain}, but for applications involving the
731shallow-water wave equation, the second argument of
732\function{pmesh\_to\_domain\_instance} can always be set simply to
733\class{Domain}.)
734
735The following statements specify a basename and data directory, and
736identify quantities to be stored. For the first two, values are
737taken from \file{project.py}.
738
739{\small \begin{verbatim}
740    domain.set_name(project.basename)%
741    domain.set_datadir(project.outputdir)%
742    domain.set_quantities_to_be_stored(['stage', 'xmomentum',
743        'ymomentum'])
744\end{verbatim}}
745
746
747\subsection{Initial Conditions}
748Quantities for \file{run\_sydney\_smf.py} are set
749using similar methods to those in \file{bedslopephysical.py}. However,
750in this case, many of the values are read from the auxiliary file
751\file{project.py} or, in the case of \code{elevation}, from an
752ancillary points file.
753
754
755
756\subsubsection{Stage}
757
758For the scenario we are modelling in this case, we use a callable
759object \code{tsunami\_source}, assigned by means of a function
760\function{slump\_tsunami}. This is similar to how we set elevation in
761\file{bedslopephysical.py} using a function---however, in this case the
762function is both more complex and more interesting.
763
764The function returns the water displacement for all \code{x} and
765\code{y} in the domain. The water displacement is a double Gaussian
766function that depends on the characteristics of the slump (length,
767thickness, slope, etc), its location (origin) and the depth at that
768location.
769
770
771\subsubsection{Friction}
772
773We assign the friction exactly as we did for \file{bedslopephysical.py}:
774
775{\small \begin{verbatim}
776    domain.set_quantity('friction', 0.03)
777\end{verbatim}}
778
779
780\subsubsection{Elevation}
781
782The elevation is specified by reading data from a file:
783
784{\small \begin{verbatim}
785    domain.set_quantity('elevation',
786                    filename = project.combineddemname + '.pts',
787                    use_cache = True,
788                    verbose = True)
789\end{verbatim}}
790
791However, before this step can be executed, some preliminary steps
792are needed to prepare the file from which the data is taken. Two
793source files are used for this data---their names are specified in
794the file \file{project.py}, in the variables \code{coarsedemname}
795and \code{finedemname}. They contain `coarse' and `fine' data,
796respectively---that is, data sampled at widely spaced points over a
797large region and data sampled at closely spaced points over a
798smaller subregion. The data in these files is combined through the
799statement
800
801{\small \begin{verbatim}
802combine_rectangular_points_files(project.finedemname + '.pts',
803                                 project.coarsedemname + '.pts',
804                                 project.combineddemname + '.pts')
805\end{verbatim}}
806
807The effect of this is simply to combine the datasets by eliminating
808any coarse data associated with points inside the smaller region
809common to both datasets. The name to be assigned to the resulting
810dataset is also derived from the name stored in the variable
811\code{combinedname} in the file \file{project.py}.
812
813\subsection{Boundary Conditions}
814
815Setting boundaries follows a similar pattern to the one used for
816\file{bedslopephysical.py}, except that in this case we need to associate a
817boundary type with each of the
818boundary tag names introduced when we established the mesh. In place of the four
819boundary types introduced for \file{bedslopephysical.py}, we use the reflective
820boundary for each of the
821eight tagged segments:
822
823{\small \begin{verbatim}
824    Br = Reflective_boundary(domain)
825    domain.set_boundary( {'bottom': Br, 'right1': Br, 'right0': Br,
826                          'right2': Br, 'top': Br, 'left1': Br,
827                          'left2': Br, 'left3': Br} )
828\end{verbatim}}
829
830\subsection{Evolution}
831
832With the basics established, the running of the `evolve' step is
833very similar to the corresponding step in \file{bedslopephysical.py}:
834
835{\small \begin{verbatim}
836    import time t0 = time.time()
837
838    for t in domain.evolve(yieldstep = 120, duration = 18000):
839        print domain.timestepping_statistics()
840        print domain.boundary_statistics(tags = 'bottom')
841
842    print 'That took %.2f seconds' %(time.time()
843\end{verbatim}}
844
845%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
846%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
847
848\chapter{\anuga Public Interface}
849
850This chapter gives an overview of the features of \anuga available
851to the user at the public interface. These are grouped under the
852following headings:
853
854\begin{itemize}
855    \item Establishing the Mesh
856    \item Initialising the Domain
857    \item Specifying the Quantities
858    \item Initial Conditions
859    \item Boundary Conditions
860    \item Forcing Functions
861    \item Evolution
862\end{itemize}
863
864The listings are intended merely to give the reader an idea of what
865each feature is, where to find it and how it can be used---they do
866not give full specifications. For these the reader
867may consult the code. The code for every function or class contains
868a documentation string, or `docstring', that specifies the precise
869syntax for its use. This appears immediately after the line
870introducing the code, between two sets of triple quotes.
871
872Each listing also describes the location of the module in which
873the code for the feature being described can be found. All modules
874are in the folder \file{inundation} or one of its subfolders, and the
875location of each module is described relative to \file{inundation}. Rather
876than using pathnames, whose syntax depends on the operating system,
877we use the format adopted for importing the function or class for
878use in Python code. For example, suppose we wish to specify that the
879function \function{create\_mesh\_from\_regions} is in a module called
880\module{mesh\_interface} in a subfolder of \module{inundation} called
881\code{pmesh}. In Linux or Unix syntax, the pathname of the file
882containing the function, relative to \file{inundation}, would be
883
884\begin{center}
885%    \code{pmesh/mesh\_interface.py}
886    \code{pmesh}$\slash$\code{mesh\_interface.py}
887\end{center}
888
889while in Windows syntax it would be
890
891\begin{center}
892    \code{pmesh}$\backslash$\code{mesh\_interface.py}
893\end{center}
894
895Rather than using either of these forms, in this chapter we specify
896the location simply as \code{pmesh.mesh_interface}, in keeping with
897the usage in the Python statement for importing the function,
898namely:
899\begin{center}
900    \code{from pmesh.mesh\_interface import create\_mesh\_from\_regions}
901\end{center}
902
903Each listing details the full set of parameters for the class or
904function; however, the description is generally limited to the most
905important parameters and the reader is again referred to the code
906for more details.
907
908The following parameters are common to many functions and classes
909and are omitted from the descriptions given below:
910
911\begin{tabular}{|l|l|}  \hline
912\textbf{Name } & \textbf{Description}\\
913\hline
914\code{usecache} & Specifies whether caching is to be used\\
915\code{verbose} & If \code{True}, provides detailed terminal output
916to the user\\   \hline
917\end{tabular}
918
919
920\section{Mesh Generation}
921\refmodindex[pmesh.meshinterface]{pmesh.mesh\_interface}
922\begin{funcdesc}  {create\_mesh\_from\_regions}{bounding_polygon,
923                             boundary_tags,
924                             maximum_triangle_area,
925                             filename=None,
926                             interior_regions=None,
927                             poly_geo_reference=None,
928                             mesh_geo_reference=None,
929                             minimum_triangle_angle=28.0}
930Module: \module{pmesh.mesh\_interface}
931
932
933% Translate following into layman's language
934This function is used to create a triangular mesh suitable for use with
935\anuga, within a specified region. The region is specified as the interior of a polygon
936(the \emph{bounding polygon}). The user specifies the bounding polygon and the
937\emph{resolution}---that is, maximal area of any triangle in the mesh. There is
938also an option to specify a number of internal polygons within each of which a
939separate mesh is created, generally with a smaller resolution. Additionally,
940the user specifies a list of boundary tags, one for each edge of the bounding
941polygon.
942\end{funcdesc}
943
944
945\begin{funcdesc}  {Mesh}{}
946Module: \module{pmesh.mesh}
947
948% Translate following into layman's language
949This function is used to create a Mesh instance.  This can then be
950used to build the outline of the mesh and then generate the
951mesh.
952\end{funcdesc}
953
954
955\begin{funcdesc}  {add_region_from_polygon}{self, polygon, tags=None,
956                                max_triangle_area=None, geo_reference=None}
957Module: \module{pmesh.mesh.Mesh}
958
959% Translate following into layman's language
960This method is used to add a region to a Mesh instance.  The region is
961described by the polygon passed in.  Additionally,
962the user specifies a list of boundary tags, one for each edge of the bounding
963polygon.
964\end{funcdesc}
965
966\begin{funcdesc}  {add_hole_from_polygon}{self, polygon, tags=None,
967    geo_reference=None}
968Module: \module{pmesh.mesh.Mesh}
969
970% Translate following into layman's language
971This method is used to add a region where the triangular mesh will not
972be generated to a Mesh instance.  The region is
973described by the polygon passed in.  Additionally,
974the user specifies a list of boundary tags, one for each edge of the bounding
975polygon.
976\end{funcdesc}
977
978\begin{funcdesc}  {generate_mesh}{self,
979                      maximum_triangle_area=None,
980                      minimum_triangle_angle=28.0,
981                      verbose=False}
982Module: \module{pmesh.mesh.Mesh}
983
984% Translate following into layman's language
985This method is used to generate the triangular mesh.  The  maximal area
986of any triangle in the mesh can be specified, along with the minimum
987angle of all triangles.
988\end{funcdesc}
989
990
991\begin{funcdesc}  {export_mesh_file}{self,ofile}
992Module: \module{pmesh.mesh.Mesh}
993
994% Translate following into layman's language
995This method is used to save the mesh to a file. \code{ofile} is the name of the mesh file to be writen,
996including the extension.  Use the extension \code{.msh} for the file to
997be in NetCDF format and \code{.tsh} for the file to be ASCII format.
998\end{funcdesc}
999
1000%%%%%%
1001\section{Initialising Domain}
1002
1003\begin{funcdesc}  {pmesh\_to\_domain\_instance}{file_name, DomainClass, use_cache = False, verbose = False}
1004Module: \module{pyvolution.pmesh2domain}
1005
1006Once the initial mesh file has been created, this function is applied
1007to convert it to a domain object---that is, to a member of
1008the special Python class Domain (or a subclass of Domain), which provides access to properties and
1009methods that allow quantities to be set and other operations to be carried out.
1010
1011\code{file\_name} is the name of the mesh file to be converted,
1012including the extension. \code{DomainClass} is the class to be
1013returned, which must be a subclass of \class{Domain} having the same
1014interface as \class{Domain}---in practice, it can usually be set
1015simply to \class{Domain}.
1016
1017This is now superseded by Domain(mesh_filename).
1018\end{funcdesc}
1019
1020
1021\subsection{Key Methods of Domain}
1022
1023\begin{funcdesc} {set\_name}{name}
1024    Module: \refmodule{pyvolution.domain}, page \pageref{mod:pyvolution.domain}  %\code{pyvolution.domain}
1025
1026    Assigns the name \code{name} to the domain.
1027\end{funcdesc}
1028
1029\begin{funcdesc} {get\_name}{}
1030    Module: \module{pyvolution.domain}
1031
1032    Returns the name assigned to the domain by \code{set_name}. If no name has been
1033    assigned, returns `domain'.
1034\end{funcdesc}
1035
1036\begin{funcdesc} {set\_datadir}{name}
1037    Module: \module{pyvolution.domain}
1038
1039    Specifies the directory used for data, assigning it to the pathname \code{name}. The default value, before
1040    \code{set\_datadir} has been run, is the value \code{default_datadir}
1041    specified in \code{config.py}.
1042
1043    Since different operating systems use different formats for specifying pathnames,
1044    it is necessary to specify path separators using the Python code \code{os.sep}, rather than
1045    the operating-specific ones such as `$\slash$' or `$\backslash$'.
1046    For this to work you will need to include the statement \code{import os}
1047    in your code, before the first appearance of \code{set\_datadir}.
1048
1049    For example, if you wished to set the data directory to a subdirectory
1050    \code{data} of the directory \code{project}, you might use
1051    statements of the following type:
1052
1053    {\small \begin{verbatim}
1054        import os
1055        domain.set_datadir{'project' + os.sep + 'data'}
1056    \end{verbatim}}
1057\end{funcdesc}
1058
1059\begin{funcdesc} {get_datadir}{}
1060    Module: \module{pyvolution.domain}
1061
1062    Returns the data directory set by \code{set\_datadir} or, if \code{set\_datadir} has not
1063    been run, returns the value \code{default_datadir} specified in
1064    \code{config.py}.
1065\end{funcdesc}
1066
1067\begin{funcdesc} {set_time}{time=0.0}
1068    Module: \module{pyvolution.domain}
1069
1070    Sets the initial time, in seconds, for the simulation. The
1071    default is 0.0.
1072\end{funcdesc}
1073
1074\begin{funcdesc} {set_default_order}{??}
1075\end{funcdesc}
1076
1077
1078%%%%%%
1079\section{Initial Conditions}
1080
1081\begin{funcdesc}{set\_quantity}{name,
1082    numeric = None,
1083    quantity = None,
1084    function = None,
1085    geospatial_data = None,
1086    filename = None,
1087    attribute_name = None,
1088    alpha = None,
1089    location = 'vertices',
1090    indices = None,
1091    verbose = False,
1092    use_cache = False}
1093  Module: \module{pyvolution.domain}
1094  (see also \module{pyvolution.quantity.set_values})
1095
1096This function is used to assign values to individual quantities for a
1097domain. It is very flexible and can be used with many data types: a
1098statement of the form \code{domain.set\_quantity(name, x)} can be used
1099to define a quantity having the name \code{name}, where the other
1100argument \code{x} can be any of the following:
1101
1102\begin{itemize}
1103\item a number, in which case all vertices in the mesh gets that for
1104the quantity in question.
1105\item a list of numbers or a Numeric array ordered the same way as the mesh vertices.
1106\item a function (e.g.\ see the samples introduced in Chapter 2)
1107\item an expression composed of other quantities and numbers, arrays, lists (for
1108example, a linear combination of quantities)
1109\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.
1110\item a geospatial dataset (See ?????). Optional argument attribute_name applies here as with files.
1111\end{itemize}
1112
1113
1114Exactly one of the arguments
1115  numeric, quantity, function, points, filename
1116must be present.
1117
1118
1119Set quantity will look at the type of the second argument (\code{numeric}) and
1120determine what action to take.
1121
1122Values can also be set using the appropriate keyword arguments.
1123If 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)}
1124are all equivalent.
1125
1126
1127Other optional arguments are
1128\begin{itemize}
1129\item \code{indices} which is a list of ids of triangles to which set_quantity should apply its assignment of values.
1130\item \code{location} determines which part of the triangles to assign to. Options are 'vertices' (default), 'edges', and 'centroids'.
1131\end{itemize}
1132
1133
1134a number, in which case all vertices in the mesh gets that for
1135the quantity in question.
1136\item a list of numbers or a Numeric array ordered the same way as the mesh vertices.
1137
1138
1139\end{funcdesc}
1140
1141
1142
1143
1144
1145
1146
1147%%%
1148\anuga provides a number of predefined initial conditions to be used
1149with \code{set_quantity}.
1150
1151\begin{funcdesc}{tsunami_slump}{length, depth, slope, width=None, thickness=None,
1152                x0=0.0, y0=0.0, alpha=0.0,
1153                gravity=9.8, gamma=1.85,
1154                massco=1, dragco=1, frictionco=0, psi=0,
1155                dx=None, kappa=3.0, kappad=0.8, zsmall=0.01,
1156                domain=None,
1157                verbose=False}
1158This function returns a callable object representing an initial water
1159displacement generated by a submarine sediment failure. These failures can take the form of
1160a submarine slump or slide.
1161
1162The arguments include as a minimum, the slump or slide length, the water depth to the centre of sediment
1163mass, and the bathymetric slope. Other slump or slide parameters can be included if they are known.
1164\end{funcdesc}
1165
1166
1167%%%
1168\begin{funcdesc}{file_function}{filename,
1169                  domain = None,
1170                  quantities = None,
1171                  interpolation_points = None,
1172                  verbose = False,
1173                  use_cache = False}
1174Module: \module{pyvolution.util}
1175
1176Reads the time history of spatial data from NetCDF file and returns
1177a callable object. Returns interpolated values based on the input
1178file using the underlying \code{interpolation\_function}.
1179
1180\code{quantities} is either the name of a single quantity to be
1181interpolated or a list of such quantity names. In the second case, the resulting
1182function will return a tuple of values---one for each quantity.
1183
1184\code{interpolation\_points} is a list of absolute UTM coordinates
1185for points at which values are sought.
1186\end{funcdesc}
1187
1188%%%
1189\begin{classdesc}{Interpolation\_function}{self,
1190                 time,
1191                 quantities,
1192                 quantity_names = None,
1193                 vertex_coordinates = None,
1194                 triangles = None,
1195                 interpolation_points = None,
1196                 verbose = False}
1197Module: \module{pyvolution.least\_squares}
1198
1199Given a time series, either as a sequence of numbers or
1200defined at the vertices of a triangular mesh (such
1201as those stored in \code{sww} files), \code{Interpolation\_function}
1202is used to create a callable object that interpolates a value for
1203an arbitrary time \code{t} within the model limits and possibly a
1204point \code{(x, y)} within a mesh region.
1205
1206The actual time series at which data is available is specified by
1207means of an array \code{time} of monotonically increasing times. The
1208quantities containing the values to be interpolated are specified in
1209an array---or dictionary of arrays (used in conjunction with the
1210optional argument \code{quantity\_names}) --- called
1211\code{quantities}. The optional arguments \code{vertex_coordinates}
1212and \code{triangles} represent the spatial mesh associated with the
1213quantity arrays. If omitted the function created by
1214\code{Interpolation\_function} will be a function of \code{t} only.
1215
1216Since, in practice, values need to be computed at specified points,
1217the syntax allows the user to specify, once and for all, a list
1218\code{interpolation\_points} of points at which values are required.
1219In this case, the function may be called using the form \code{f(t,
1220id)}, where \code{id} is an index for the list
1221\code{interpolation\_points}.
1222
1223\end{classdesc}
1224
1225%%%
1226\begin{funcdesc}{set\_region}{functions}
1227[Low priority. Will be merged into set\_quantity]
1228
1229Module:\module{pyvolution.domain}
1230\end{funcdesc}
1231
1232
1233
1234%%%%%%
1235\section{Boundary Conditions}
1236
1237\anuga provides a large number of predefined boundary conditions,
1238represented by objects such as \code{Reflective\_boundary(domain)} and
1239\code{Dirichlet\_boundary([0.2, 0.0, 0.0])}, described in the examples
1240in Chapter 2. Alternatively, you may prefer to ``roll your own'',
1241following the method explained in Section \ref{sec:roll your own}.
1242
1243These boundary objects may be used with the function \code{set\_boundary} described below
1244to assign boundary conditions according to the tags used to label boundary segments.
1245
1246\begin{funcdesc}{set\_boundary}{boundary_map}
1247Module: \module{pyvolution.domain}
1248
1249This function allows you to assign a boundary object (corresponding to a
1250pre-defined or user-specified boundary condition) to every boundary segment that
1251has been assigned a particular tag.
1252
1253This is done by specifying a dictionary \code{boundary\_map}, whose values are the boundary objects
1254and whose keys are the symbolic tags.
1255
1256\end{funcdesc}
1257
1258\begin{funcdesc} {get_boundary_tags}{}
1259Module: \module{pyvolution.mesh}
1260\end{funcdesc}
1261
1262%%%
1263\subsection{Predefined boundary conditions}
1264
1265\begin{classdesc}{Reflective_boundary}{Boundary}
1266Module: \module{pyvolution.shallow\_water}
1267
1268Reflective boundary returns same conserved quantities as those present in
1269the neighbouring volume but reflected.
1270
1271This class is specific to the shallow water equation as it works with the
1272momentum quantities assumed to be the second and third conserved quantities.
1273\end{classdesc}
1274
1275%%%
1276\begin{classdesc}{Transmissive_boundary}{domain = None}
1277Module: \module{pyvolution.generic\_boundary\_conditions}
1278
1279A transmissive boundary returns the same conserved quantities as
1280those present in the neighbouring volume.
1281
1282The underlying domain must be specified when the boundary is instantiated.
1283\end{classdesc}
1284
1285%%%
1286\begin{classdesc}{Dirichlet_boundary}{conserved_quantities=None}
1287Module: \module{pyvolution.generic\_boundary\_conditions}
1288
1289A Dirichlet boundary returns constant values for the conserved
1290quantities.
1291\end{classdesc}
1292
1293%%%
1294\begin{classdesc}{Time_boundary}{domain = None, f = None}
1295Module: \module{pyvolution.generic\_boundary\_conditions}
1296
1297A time-dependent boundary returns values for the conserved
1298quantities as a function \code{f(t)} of time. The user must specify
1299the domain to get access to the model time.
1300\end{classdesc}
1301
1302%%%
1303\begin{classdesc}{File_boundary}{Boundary}
1304Module: \module{pyvolution.generic\_boundary\_conditions}
1305
1306The boundary values are obtained from a file and interpolated. The
1307file is assumed to contain a time series and possibly also spatial
1308information. The conserved quantities are given as a function of
1309time.
1310\end{classdesc}
1311
1312
1313\subsection{User-defined boundary conditions}
1314\label{sec:roll your own}
1315[How to roll your own]
1316
1317
1318
1319
1320
1321\section{Forcing Functions}
1322
1323\anuga provides a number of predefined forcing functions to be used with .....
1324
1325%\begin{itemize}
1326
1327
1328%  \item \indexedcode{}
1329%  [function, arguments]
1330
1331%  \item \indexedcode{}
1332
1333%\end{itemize}
1334
1335
1336
1337\section{Evolution}
1338
1339  \begin{funcdesc}{evolve}{yieldstep = None, finaltime = None, duration = None, skip_initial_step = False}
1340
1341  Module: \module{pyvolution.domain}
1342
1343  This function (a method of \class{domain}) is invoked once all the
1344  preliminaries have been completed, and causes the model to progress
1345  through successive steps in its evolution, storing results and
1346  outputting statistics whenever a user-specified period
1347  \code{yieldstep} is completed (generally during this period the
1348  model will evolve through several steps internally). The user
1349  specifies the total time period over which the evolution is to take
1350  place, by specifying values (in seconds) for either \code{duration}
1351  or \code{finaltime}, as well as the interval in seconds after which
1352  results are to be stored and statistics output.
1353
1354  You can include \method{evolve} in a statement of the type:
1355
1356  {\small \begin{verbatim}
1357      for t in domain.evolve(yieldstep, finaltime):
1358          <Do something with domain and t>
1359  \end{verbatim}}
1360
1361  \end{funcdesc}
1362
1363
1364
1365\subsection{Diagnostics}
1366
1367  \begin{funcdesc}{timestepping_statistics}{}
1368  Module: \module{pyvolution.domain}
1369
1370
1371  \end{funcdesc}
1372
1373
1374  \begin{funcdesc}{boundary\_statistics}{quantities = None, tags = None}
1375  Module: \module{pyvolution.domain}
1376
1377
1378  \end{funcdesc}
1379
1380
1381  \begin{funcdesc}{get_quantity}{name, location='vertices', indices = None}
1382  Module: \module{pyvolution.domain}
1383  Allow access to individual quantities and their methods
1384
1385  \end{funcdesc}
1386
1387
1388  \begin{funcdesc}{get_values}{location='vertices', indices = None}
1389  Module: \module{pyvolution.quantity}
1390
1391  Extract values for quantity as an array
1392
1393  \end{funcdesc}
1394
1395
1396  \begin{funcdesc}{get_integral}{}
1397  Module: \module{pyvolution.quantity}
1398
1399  Return computed integral over entire domain for this quantity
1400
1401  \end{funcdesc}
1402
1403
1404\section{Other}
1405
1406  \begin{funcdesc}{domain.create_quantity_from_expression}{???}
1407
1408  Handy for creating derived quantities on-the-fly.
1409  See \file{Analytical\_solution\_circular\_hydraulic\_jump.py} for an example of use.
1410  \end{funcdesc}
1411
1412
1413  \begin{funcdesc}{Geospatial_data}{???}
1414    Module: \module{geospatial_data.geo_spatial_data}
1415    Creates a georeferenced geospatial data object from either arrays or a file (pts or xya).
1416
1417    Objects of this class can be used with \method{set\_quantity}.
1418  \end{funcdesc}
1419
1420
1421
1422
1423
1424%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1425%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1426
1427\chapter{\anuga System Architecture}
1428
1429From pyvolution/documentation
1430
1431\section{File Formats}
1432\label{sec:file formats}
1433
1434\anuga makes use of a number of different file formats. The
1435following table lists all these formats, which are described in more
1436detail in the paragraphs below.
1437
1438\bigskip
1439
1440\begin{center}
1441
1442\begin{tabular}{|ll|}  \hline
1443
1444\textbf{Extension} & \textbf{Description} \\
1445\hline\hline
1446
1447\code{.sww} & NetCDF format for storing model output
1448\code{f(t,x,y)}\\
1449
1450\code{.tms} & NetCDF format for storing time series \code{f(t)}\\
1451
1452\code{.xya} & ASCII format for storing arbitrary points and
1453associated attributes\\
1454
1455\code{.pts} & NetCDF format for storing arbitrary points and
1456associated attributes\\
1457
1458\code{.asc} & ASCII format of regular DEMs as output from ArcView\\
1459
1460\code{.prj} & Associated ArcView file giving more metadata for
1461\code{.asc} format\\
1462
1463\code{.ers} & ERMapper header format of regular DEMs for ArcView\\
1464
1465\code{.dem} & NetCDF representation of regular DEM data\\
1466
1467\code{.tsh} & ASCII format for storing meshes and associated
1468boundary and region info\\
1469
1470\code{.msh} & NetCDF format for storing meshes and associated
1471boundary and region info\\
1472
1473\code{.nc} & Native ferret NetCDF format\\
1474
1475\code{.geo} & Houdinis ASCII geometry format (?) \\  \par \hline
1476%\caption{File formats used by \anuga}
1477\end{tabular}
1478
1479
1480\end{center}
1481
1482The above table shows the file extensions used to identify the
1483formats of files. However, typically, in referring to a format we
1484capitalise the extension and omit the initial full stop---thus, we
1485refer, for example, to `SWW files' or `PRJ files'.
1486
1487\bigskip
1488
1489A typical dataflow can be described as follows:
1490
1491\subsection{Manually Created Files}
1492
1493\begin{tabular}{ll}
1494ASC, PRJ & Digital elevation models (gridded)\\
1495TSH & Triangular meshes (e.g. created from \code{pmesh})\\
1496NC & Model outputs for use as boundary conditions (e.g. from MOST)
1497\end{tabular}
1498
1499\subsection{Automatically Created Files}
1500
1501\begin{tabular}{ll}
1502ASC, PRJ  $\rightarrow$  DEM  $\rightarrow$  PTS & Convert
1503DEMs to native \code{.pts} file\\
1504
1505NC $\rightarrow$ SWW & Convert MOST boundary files to
1506boundary \code{.sww}\\
1507
1508PTS + TSH $\rightarrow$ TSH with elevation & Least squares fit\\
1509
1510TSH $\rightarrow$ SWW & Convert TSH to \code{.sww}-viewable using
1511Swollen\\
1512
1513TSH + Boundary SWW $\rightarrow$ SWW & Simulation using
1514\code{pyvolution}
1515\end{tabular}
1516
1517
1518
1519
1520\bigskip
1521
1522\subsection{SWW and TMS Formats}
1523
1524The SWW and TMS formats are both NetCDF formats, and are of key
1525importance for \anuga.
1526
1527An SWW file is used for storing \anuga output and therefore pertains
1528to a set of points and a set of times at which a model is evaluated.
1529It contains, in addition to dimension information, the following
1530variables:
1531
1532\begin{itemize}
1533    \item \code{x} and \code{y}: coordinates of the points, represented as Numeric arrays
1534    \item \code{elevation}, a Numeric array storing bed-elevations
1535    \item \code{volumes}, a list specifying the points at the vertices of each of the
1536    triangles
1537    \item \code{time}, a Numeric array containing times for model
1538    evaluation
1539\end{itemize}
1540
1541
1542The contents of an SWW file may be viewed using the visualisation
1543tool \code{swollen}, which creates an on-screen geometric
1544representation. See section \ref{sec:swollen} (page
1545\pageref{sec:swollen}) in Appendix \ref{ch:supportingtools} for more
1546on \code{swollen}.
1547
1548Alternatively, there are tools, such as \code{ncdump}, that allow
1549you to convert an NetCDF file into a readable format such as the
1550Class Definition Language (CDL). The following is an excerpt from a
1551CDL representation of the output file \file{bedslope.sww} generated
1552from running the simple example \file{bedslopephysical.py} of
1553Chapter \ref{ch:getstarted}.
1554
1555\verbatiminput{examples/bedslopeexcerpt.cdl}
1556
1557A TMS file is used to store time series...
1558
1559
1560\subsection{Meshfile Formats}
1561
1562A meshfile is a file that has a specific format suited to specifying
1563mesh data for \anuga. A meshfile can have one of two formats: it can
1564be either a TSH file, which is an ASCII file, or an MSH file, which
1565is a NetCDF file.
1566
1567A meshfile describes the outline of the mesh---the vertices and line
1568segments that enclose the region in which the mesh is created---and
1569the triangular mesh itself, which is specified by listing the
1570triangles and their vertices, and the segments, which are those
1571sides of the triangles that are associated with boundary conditions.
1572
1573In addition, a meshfile may contain `holes' and/or `regions'. A hole
1574or region is defined by specifying a point and a number of segments
1575that enclose that point. A hole represents an area where no mesh is
1576to be created, while a region is a labelled area used for defining
1577properties of a mesh, such as friction values.
1578
1579A meshfile can also contain a georeference, which describes an
1580offset to be applied to $x$ and $y$ values---eg to the vertices.
1581
1582
1583\subsection{Formats for Storing Arbitrary Points and Attributes}
1584
1585An XYA file is used to store data representing arbitrary numerical
1586attributes associated with a set of points.
1587
1588The format for a .xya file is:
1589\begin{verbatim}
1590            1st line:     [attribute names]
1591            other lines:  x y [attributes]
1592
1593            for example:
1594            elevation, friction
1595            0.6, 0.7, 4.9, 0.3
1596            1.9, 2.8, 5, 0.3
1597            2.7, 2.4, 5.2, 0.3
1598
1599        The first two columns are always implicitly assumed to be x, y coordinates.
1600        Use the same delimiter for the attribute names and the data
1601
1602        An xya file can optionally end with
1603            #geo reference
1604            56
1605            466600.0
1606            8644444.0
1607
1608        When the 1st # is the zone,
1609        2nd # the xllcorner and
1610        3rd # the yllcorner
1611\end{verbatim}
1612
1613\subsection{ArcView Formats}
1614
1615
1616\subsection{Other Formats}
1617
1618\subsection{Basic File Conversions}
1619
1620  \begin{funcdesc}{sww2dem}{basename_in, basename_out = None,
1621            quantity = None,
1622            timestep = None,
1623            reduction = None,
1624            cellsize = 10,
1625            NODATA_value = -9999,
1626            easting_min = None,
1627            easting_max = None,
1628            northing_min = None,
1629            northing_max = None,
1630            expand_search = False,
1631            verbose = False,
1632            origin = None,
1633            datum = 'WGS84',
1634            format = 'ers'}
1635  Module: \module{pyvolution.data\_manager}
1636
1637  Takes data from an SWW file and converts it to DEM format (ASC or
1638  ERS)
1639  \end{funcdesc}
1640
1641
1642  \begin{funcdesc}{dem2pts}{basename_in, basename_out=None,
1643            easting_min=None, easting_max=None,
1644            northing_min=None, northing_max=None,
1645            use_cache=False, verbose=False}
1646  Module: \module{pyvolution.data\_manager}
1647
1648  Takes DEM data (a NetCDF file representation of data from a regular Digital
1649  Elevation Model) and converts it to PTS format.
1650  \end{funcdesc}
1651
1652
1653
1654%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1655%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1656
1657\chapter{Basic \anuga Assumptions}
1658
1659(From pyvolution/documentation)
1660
1661
1662Physical model time cannot be earlier than 1 Jan 1970 00:00:00.
1663If one wished to recreate scenarios prior to that date it must be done
1664using some relative time (e.g. 0).
1665
1666
1667All spatial data relates to the WGS84 datum (or GDA94) and has been
1668projected into UTM with false easting of 500000 and false northing of
16691000000 on the southern hemisphere (0 on the northern).
1670
1671It is assumed that all computations take place within one UTM zone.
1672
1673DEMs, meshes and boundary conditions can have different origins within
1674one UTM zone. However, the computation will use that of the mesh for
1675numerical stability.
1676
1677
1678%OLD
1679%The dataflow is: (See data_manager.py and from scenarios)
1680%
1681%
1682%Simulation scenarios
1683%--------------------%
1684%%
1685%
1686%Sub directories contain scrips and derived files for each simulation.
1687%The directory ../source_data contains large source files such as
1688%DEMs provided externally as well as MOST tsunami simulations to be used
1689%as boundary conditions.
1690%
1691%Manual steps are:
1692%  Creation of DEMs from argcview (.asc + .prj)
1693%  Creation of mesh from pmesh (.tsh)
1694%  Creation of tsunami simulations from MOST (.nc)
1695%%
1696%
1697%Typical scripted steps are%
1698%
1699%  prepare_dem.py:  Convert asc and prj files supplied by arcview to
1700%                   native dem and pts formats%
1701%
1702%  prepare_pts.py: Convert netcdf output from MOST to an sww file suitable
1703%                  as boundary condition%
1704%
1705%  prepare_mesh.py: Merge DEM (pts) and mesh (tsh) using least squares
1706%                   smoothing. The outputs are tsh files with elevation data.%
1707%
1708%  run_simulation.py: Use the above together with various parameters to
1709%                     run inundation simulation.
1710
1711
1712%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1713%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1714
1715\appendix
1716
1717\chapter{Supporting Tools}
1718\label{ch:supportingtools}
1719
1720This section describes a number of supporting tools, supplied with \anuga, that offer a
1721variety of types of functionality and enhance the basic capabilities of \anuga.
1722
1723\section{caching}
1724
1725  The \code{cache} function is used to provide supervised caching of function results. A Python
1726  function call of the form
1727
1728      {\small \begin{verbatim}
1729      result = func(arg1,...,argn)
1730      \end{verbatim}}
1731
1732  can be replaced by
1733
1734      {\small \begin{verbatim}
1735      from caching import cache
1736      result = cache(func,(arg1,...,argn))
1737      \end{verbatim}}
1738
1739  which returns the same output but reuses cached
1740  results if the function has been computed previously in the same context.
1741  \code{result} and the arguments can be simple types, tuples, list, dictionaries or
1742  objects, but not unhashable types such as functions or open file objects.
1743  The function \code{func} may be a member function of an object or a module.
1744
1745  This type of caching is particularly useful for computationally intensive
1746  functions with few frequently used combinations of input arguments. Note that
1747  if the inputs or output are very large caching may not save time because
1748  disc access may dominate the execution time.
1749
1750  If the function definition changes after a result has been cached, this will be
1751  detected by examining the functions \code{bytecode (co_code, co_consts,
1752  func_defualts, co_argcount)} and the function will be recomputed.
1753
1754  Options are set by means of the function \code{set_option(key, value)},
1755  where \code{key} is a key associated with a
1756  Python dictionary \code{options}. This dictionary stores settings such as the name of
1757  the directory used, the maximum
1758  number of cached files allowed, and so on.
1759
1760  The \code{cache} function allows the user also to specify a list of dependent files. If any of these
1761  have been changed, the function is recomputed and the results stored again.
1762
1763  %Other features include support for compression and a capability to \ldots
1764
1765
1766   \textbf{USAGE:}
1767
1768    {\small \begin{verbatim}
1769    result = cache(func, args, kwargs, dependencies, cachedir, verbose,
1770                   compression, evaluate, test, return_filename)
1771    \end{verbatim}}
1772
1773
1774\section{swollen}
1775\label{sec:swollen}
1776 The output generated by \anuga may be viewed by
1777means of the visualisation tool \code{swollen}, which takes the
1778\code{sww} file output by \anuga and creates a visual representation
1779of the data. Examples may be seen in Figures \ref{fig:bedslopestart}
1780and \ref{fig:bedslope2}. To view an \code{sww} file with
1781\code{swollen} in the Windows environment, you can simply drag the
1782icon representing the file over an icon on the desktop for the
1783\code{swollen} executable file (or a shortcut to it). Alternatively,
1784you can operate \code{swollen} from the command line, in both
1785Windows and Linux environments.
1786
1787On successful operation, you will see an interactive moving-picture display. You can use keys and the mouse
1788to slow down, speed up or stop the display, change the viewing position or carry out a number of other
1789simple operations.
1790
1791The main keys operating the interactive screen are:\\
1792
1793\begin{tabular}{|ll|}   \hline
1794
1795\code{w} & toggle wireframe\\
1796
1797space bar & start/stop\\
1798
1799up/down arrows & increase/decrease speed\\
1800
1801left/right arrows & direction in time \emph{(when running)}\\ & step through simulation \emph{(when stopped)}\\
1802
1803left mouse button & rotate\\
1804
1805middle mouse button & pan\\
1806
1807right mouse button & zoom\\  \hline
1808
1809\end{tabular}
1810
1811\vfill
1812
1813The following table describes how to operate swollen from the command line:
1814
1815Usage: \code{swollen [options] swwfile \ldots}\\  \nopagebreak
1816Options:\\  \nopagebreak
1817\begin{tabular}{ll}
1818  \code{--display <type>} & \code{MONITOR | POWERWALL | REALITY_CENTER |}\\
1819                                    & \code{HEAD_MOUNTED_DISPLAY}\\
1820  \code{--rgba} & Request a RGBA colour buffer visual\\
1821  \code{--stencil} & Request a stencil buffer visual\\
1822  \code{--stereo} & Use default stereo mode which is \code{ANAGLYPHIC} if not \\
1823                                    & overridden by environmental variable\\
1824  \code{--stereo <mode>} & \code{ANAGLYPHIC | QUAD_BUFFER | HORIZONTAL_SPLIT |}\\
1825                                    & \code{VERTICAL_SPLIT | LEFT_EYE | RIGHT_EYE |}\\
1826                                     & \code{ON | OFF} \\
1827  \code{-alphamax <float 0-1>} & Maximum transparency clamp value\\
1828  \code{-alphamin <float 0-1>} & Transparency value at \code{hmin}\\
1829  \code{-cullangle <float angle 0-90>} & Cull triangles steeper than this value\\
1830  \code{-help} & Display this information\\
1831  \code{-hmax <float>} & Height above which transparency is set to
1832                                     \code{alphamax}\\
1833  \code{-hmin <float>} & Height below which transparency is set to
1834                                     zero\\
1835  \code{-lightpos <float>,<float>,<float>} & $x,y,z$ of bedslope directional light ($z$ is
1836                                     up, default is overhead)\\
1837  \code{-loop}  & Repeated (looped) playback of \code{.swm} files\\
1838  \code{-movie <dirname>} & Save numbered images to named directory and
1839                                     quit\\
1840  \code{-nosky} & Omit background sky\\
1841  \code{-scale <float>} & Vertical scale factor\\
1842  \code{-texture <file>} & Image to use for bedslope topography\\
1843  \code{-tps <rate>} & Timesteps per second\\
1844  \code{-version} & Revision number and creation (not compile)
1845                                     date\\
1846\end{tabular}
1847
1848\section{utilities/polygons}
1849
1850  \begin{classdesc}{Polygon_function}{regions, default = 0.0, geo_reference = None}
1851  Module: \code{utilities.polygon}
1852
1853
1854  \end{classdesc}
1855
1856  \begin{funcdesc}{read_polygon}{filename}
1857  Module: \code{utilities.polygon}
1858
1859  Reads the specified file and returns a polygon. Each
1860  line of the file must contain exactly two numbers, separated by a comma, which are interpreted
1861  as coordinates of one vertex of the polygon.
1862  \end{funcdesc}
1863
1864  \begin{funcdesc}{populate_polygon}{polygon, number_of_points, seed = None, exclude = None}
1865  Module: \code{utilities.polygon}
1866
1867  Populates the interior of the specified polygon with the specified number of points,
1868  selected by means of a uniform distribution function.
1869  \end{funcdesc}
1870
1871  \begin{funcdesc}{point_in_polygon}{polygon, delta=1e-8}
1872  Module: \code{utilities.polygon}
1873
1874  Returns a point inside the specified polygon and close to the edge. The distance between
1875  the returned point and the nearest point of the polygon is less than $\sqrt{2}$ times the
1876  second argument \code{delta}, which is taken as $10^{-8}$ by default.
1877  \end{funcdesc}
1878
1879  \begin{funcdesc}{inside_polygon}{points, polygon, closed = True, verbose = False}
1880  Module: \code{utilities.polygon}
1881
1882  Used to test whether a single point---or the members of a list of points---
1883  are inside the specified polygon. If the first argument is a single point,
1884  returns \code{True} if the point is inside the polygon, or \code{False}
1885  otherwise. If the first argument is a list of points, returns a Numeric
1886  array comprising the indices of the points in the list that lie inside the polygon.
1887  (If none of the points are inside, returns \code{zeros((0,), 'l')}.)
1888  Points on the edges of the polygon are regarded as inside if
1889  \code{closed} is set to \code{True} or omitted; otherwise they are regarded as outside.
1890  \end{funcdesc}
1891
1892  \begin{funcdesc}{outside_polygon}{points, polygon, closed = True, verbose = False}
1893  Module: \code{utilities.polygon}
1894
1895  Exactly like \code{inside_polygon}, but with the words `inside' and `outside' interchanged.
1896  \end{funcdesc}
1897
1898  \begin{funcdesc}{point_on_line}{x, y, x0, y0, x1, y1}
1899  Module: \code{utilities.polygon}
1900
1901  Returns \code{True} or \code{False}, depending on whether the point with coordinates
1902  \code{x, y} is on the line passing through the points with coordinates \code{x0, y0}
1903  and \code{x1, y1} (extended if necessary at either end).
1904  \end{funcdesc}
1905
1906  \begin{funcdesc}{separate_points_by_polygon}{points, polygon,
1907                               closed = True, verbose = False}\indexedcode{separate_points_by_polygon}
1908  Module: \code{utilities.polygon}
1909
1910  \end{funcdesc}
1911
1912
1913
1914\section{coordinate_transforms}
1915
1916\section{geo_spatial_data}
1917
1918This describes a class that represents arbitrary point data in UTM
1919coordinates along with named attribute values.
1920
1921TBA
1922
1923\section{pmesh GUI}
1924
1925\section{alpha_shape}
1926
1927
1928\section{utilities/numerical_tools} Do now.
1929
1930\begin{itemize}
1931  \item \indexedcode{ensure_numeric}
1932  \item \indexedcode{mean}
1933  \item
1934\end{itemize}
1935
1936
1937\chapter{Modules available in \anuga}
1938
1939
1940\section{\module{pyvolution.general\_mesh} }
1941\declaremodule[pyvolution.generalmesh]{}{pyvolution.general\_mesh}
1942\label{mod:pyvolution.generalmesh}
1943
1944\section{\module{pyvolution.mesh} }
1945\declaremodule{}{pyvolution.mesh}
1946\label{mod:pyvolution.mesh}
1947
1948\section{\module{pyvolution.domain} --- Generic module for 2D triangular domains for finite-volume computations of conservation laws}
1949\declaremodule{}{pyvolution.domain}
1950\label{mod:pyvolution.domain}
1951
1952
1953\section{\module{pyvolution.quantity}}
1954\declaremodule{}{pyvolution.quantity}
1955\label{mod:pyvolution.quantity}
1956
1957
1958\section{\module{pyvolution.shallow\_water} --- 2D triangular domains for finite-volume computations of the shallow water wave equation. This module contains a specialisation of class Domain from module domain.py consisting of methods specific to the Shallow Water Wave Equation
1959}
1960\declaremodule[pyvolution.shallowwater]{}{pyvolution.shallow\_water}
1961\label{mod:pyvolution.shallowwater}
1962
1963
1964
1965
1966%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1967
1968\chapter{Frequently Asked Questions}
1969
1970
1971\section{General Questions}
1972
1973\subsubsection{What is \anuga?}
1974
1975\subsubsection{Why is it called \anuga?}
1976
1977\subsubsection{How do I obtain a copy of \anuga?}
1978
1979\subsubsection{What developments are expected for \anuga in the future?}
1980
1981\subsubsection{Are there any published articles about \anuga that I can reference?}
1982
1983\section{Modelling Questions}
1984
1985\subsubsection{Which type of problems are \anuga good for?}
1986
1987\subsubsection{Which type of problems are beyond the scope of \anuga?}
1988
1989\subsubsection{Can I start the simulation at an arbitrary time?}
1990Yes, using \code{domain.set_time()} you can specify an arbitrary starting time.
1991This is for example useful in conjunction with a file_boundary, which may start hours before anything hits the model boundary. By assigning a later time for the model to start, computational resources aren't wasted.
1992
1993\subsubsection{Can I change values for any quantity during the simulation?}
1994Yes, using \code{domain.set_quantity()} inside the domain.evolve loop you
1995can change values of any quantity. This is for example useful if you wish to
1996let the system settle for a while before assigning an initial condition. Another example would be changing the values for elevation to model e.g. erosion.
1997
1998\subsubsection{Can I change boundary conditions during the simulation?}
1999Not sure, but it would be nice :-)
2000
2001\subsubsection{Why does a file\_function return a list of numbers when evaluated?}
2002Currently, file\_function works by returning values for the conserved
2003quantities \code{stage}, \code{xmomentum} and \code{ymomentum} at a given point in time and space as a triplet. To access e.g.\ \code{stage} one must specify element 0 of the triplet returned by file\_function.
2004
2005\subsubsection{Which diagnostics are available to troubleshoot a simulation?}
2006
2007\subsubsection{How do I use a DEM in my simulation?}
2008You use \code{dem2pts} to convert your DEM to the required .pts format. This .pts file is then called When setting the elevation data to the mesh
2009in \code{domain.set_quantity}
2010
2011\subsubsection{What sort of DEM resolution should I use?}
2012Try and work with the "best" you have available. Onshore DEMs are typically available in 25m, 100m and 250m grids. Note, offshore data is often sparse,
2013or non-existant.
2014
2015\subsubsection{What sort of mesh resolution should I use?}
2016The 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,
2017if 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,
2018you need a fine mesh over regions where the DEM changes rapidly, and other areas of significant interest, such as the coast.
2019
2020\subsubsection{How often should I store the output?}
2021This 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
2022to look in detail at the evolution, then you will need to balance against your storage requirements and the duration of the simulation.
2023If 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
2024quantities on a mesh with approximately 300000 triangles on a 2 min interval for 5 hours will result in approximately 350Mb sww file.
2025
2026\subsection{Boundary Conditions}
2027
2028\subsubsection{How do I create a Dirichlet boundary condition?}
2029
2030\subsubsection{How do I know which boundary tags are available?}
2031The method \code{domain.get_boundary_tags()} will return a list of
2032available tags for use with \code{domain.set_boundary_condition()}.
2033
2034
2035
2036
2037
2038\chapter{Glossary}
2039
2040\begin{itemize}
2041    \item \indexedbold{\anuga} Name of software (joint development between ANU and GA)
2042
2043    \item \indexedbold{domain} The domain of a function is the set of all input values to the function.
2044
2045    \item \indexedbold{Dirichlet boundary} - A Dirichlet boundary condition imposed on a differential equation
2046 which specifies the values the solution is to take on the boundary of the domain.
2047
2048    \item \indexedbold{elevation} - refers to bathymetry and topography
2049
2050    \item \indexedbold{bathymetry} - offshore elevation
2051
2052    \item \indexedbold{topography} - onshore elevation
2053
2054    \item \indexedbold{evolution} - integration of the shallow water wave equations over time
2055
2056    \item \indexedbold{forcing term}
2057
2058    \item \indexedbold{IDLE} - Development environment shipped with Python
2059
2060    \item \indexedbold{Manning friction coefficient}
2061
2062    \item \indexedbold{mesh}    - Triangulation of domain
2063
2064    \item \indexedbold{meshfile}  [generic word for either .tsh or
2065    .msh file]
2066
2067    \item \indexedbold{points file}  [generic word for either .pts or
2068    .xya file]
2069
2070    \item \indexedbold{grid} - evenly spaced mesh
2071
2072    \item \indexedbold{NetCDF}
2073
2074    \item \indexedbold{pmesh} does this really need to be here? it's a class/module?
2075
2076    \item \indexedbold{pyvolution} does this really need to be here? it's a class/module?
2077
2078    \item \indexedbold{conserved quantity} conserved (stage, x and y momentum)
2079
2080    \item \indexedbold{reflective boundary}
2081
2082    \item \indexedbold{smoothing} is this really needed?
2083
2084    \item \indexedbold{stage}
2085
2086%    \item \indexedbold{try this}
2087
2088    \item \indexedbold{swollen} - visualisation tool
2089
2090    \item \indexedbold{time boundary} - defined in the manual (flog from there)
2091
2092    \item \indexedbold{transmissive boundary} - defined in the manual (flog from there)
2093
2094    \item \indexedbold{xmomentum} - conserved quantity (note, two-dimensional SWW equations say only x and y and NOT z)
2095
2096    \item \indexedbold{ymomentum}  - conserved quantity
2097
2098    \item \indexedbold{resolution} -  The maximal area of a triangular cell in a mesh
2099
2100    \item \indexedbold{polygon} - A sequence of points in the plane. (Arbitrary polygons can be created
2101    in this way.)
2102    \anuga represents a polygon in one of two ways. One way is to represent it as a
2103    list whose members are either Python tuples
2104    or Python lists of length 2. The unit square, for example, would be represented by the
2105    list
2106    [ [0,0], [1,0], [1,1], [0,1] ]. The alternative is to represent it as an
2107    $N \times 2$ Numeric array, where $N$ is the number of points.
2108
2109    NOTE: More can be read in the module utilities/polygon.py ....
2110
2111    \item \indexedbold{easting} - A rectangular (x,y) coordinate measurement of distance east from a north-south reference line,
2112usually a meridian used as the axis of origin within a map zone or projection. Easting is a UTM (Universal Transverse Mercator) Coordinate.
2113
2114    \item \indexedbold{northing} - A rectangular (x,y) coordinate measurement of distance north from a north-south reference line,
2115usually a meridian used as the axis of origin within a map zone or projection. Northing is a UTM (Universal Transverse Mercator) Coordinate.
2116
2117
2118    \item \indexedbold{latitude} - The angular distance on a mericlear north and south of the equator, expressed in degrees and minutes.
2119
2120    \item \indexedbold{longitude} - The angular distance east or west, between the meridian of a particular place on Earth and that of the
2121Prime Meridian (located in Greenwich, England) expressed in degrees or time.
2122
2123    \item \indexedbold{edge} - A triangulare cell within the computational mesh can be depicted as a set of vertices joined by lines (the edges).
2124
2125    \item \indexedbold{vertex} - A point at which edges meet.
2126
2127    \item \indexedbold{finite volume} - The method evaluates the terms in the shallow water wave equationas fluxes at the surfaces of each
2128finite volume. Because the flux entering a given volume is identical to that leaving the adjacent volume, these methods are conservative.
2129Another advantage of the finite volume method is that it is easily formulated to allow for unstructured meshes.
2130The method is used in many computational fluid dynamics packages.
2131
2132
2133    \item \indexedbold{flux} - the amount of flow through the volume per unit time
2134
2135    \item \indexedbold{Digital Elevation Model (DEM)} - DEMs are digital files consisting of points of elevations,
2136sampled systematically at equally spaced intervals.
2137
2138
2139\end{itemize}
2140
2141The \code{\e appendix} markup need not be repeated for additional
2142appendices.
2143
2144
2145%
2146%  The ugly "%begin{latexonly}" pseudo-environments are really just to
2147%  keep LaTeX2HTML quiet during the \renewcommand{} macros; they're
2148%  not really valuable.
2149%
2150%  If you don't want the Module Index, you can remove all of this up
2151%  until the second \input line.
2152%
2153
2154%begin{latexonly}
2155%\renewcommand{\indexname}{Module Index}
2156%end{latexonly}
2157%\input{mod\jobname.ind}        % Module Index
2158%
2159%begin{latexonly}
2160%\renewcommand{\indexname}{Index}
2161%end{latexonly}
2162%\input{\jobname.ind}            % Index
2163
2164
2165
2166\end{document}
Note: See TracBrowser for help on using the repository browser.