Changeset 4128


Ignore:
Timestamp:
Dec 31, 2006, 1:50:19 PM (16 years ago)
Author:
steve
Message:

Changed to code a few python commands

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/publications/linuxconf_2006/paper_ole_nielsen.tex

    r4124 r4128  
    6868communities.  Geoscience Australia and the Australian National
    6969University have developed a hydrodynamic inundation modelling tool
    70 called \AnuGA{} to help simulate the impact of these hazards. 
     70called \AnuGA{} to help simulate the impact of these hazards.
    7171The core of \AnuGA{} is a \Python{} implementation of a finite-volume method
    7272for solving the conservative form of the Shallow Water Wave equation.
     
    238238The flux $\HH_{ij}$ is evaluated using a numerical flux function
    239239$\HH(\cdot, \cdot ; \ \cdot)$ which is consistent with the shallow
    240 water flux in the sense that for all vectors $\UU$ and $\nn$
     240water flux in the sense that for all conservation vectors $\UU$ and normal vectors $\nn$
    241241$$
    242242H(\UU,\UU;\ \nn) = \EE(\UU) n_1 + \GG(\UU) n_2 .
     
    245245Then
    246246$$
    247 \HH_{ij}  = \HH(\overline{\UU}_i(m_{ij})),
    248 \overline{\UU}_i(m_{ij})), \mathbf{n}_{ij})
     247\HH_{ij}  = \HH(\UU_i(m_{ij}),
     248\UU_j(m_{ij}); \mathbf{n}_{ij})
    249249$$
    250250where $m_{ij}$ is the midpoint of the \textit{ij}th edge and
    251 $\mathbf{n}_{ij}$ is the outward pointing normal on the
    252 \textit{ij}th edge. The function $\overline{\UU}_i(x)$ for $x \in
    253 T_i$ is obtained from the average values, $\UU_i$, of the $i$th and
     251$\mathbf{n}_{ij}$ is the outward pointing normal, with respect to the $i$th cell, on the
     252\textit{ij}th edge. The function $\UU_i(x)$ for $x \in
     253T_i$ is obtained from the vector $\UU_k$ of conserved average values for the $i$th and
    254254neighbouring  cells.
    255255
     
    285285\label{sec:software}
    286286
    287 \AnuGA{} is mostly written in the object-oriented programming 
    288 language \Python{} with computationally intensive parts implemented 
    289 as highly optimised shared objects written in C. 
     287\AnuGA{} is mostly written in the object-oriented programming
     288language \Python{} with computationally intensive parts implemented
     289as highly optimised shared objects written in C.
    290290
    291291\Python{} is known for its clarity, elegance, efficiency and
     
    297297changing requirements throughout its lifetime.
    298298
    299 The fundamental object in \AnuGA{} is the \code{Domain} which 
    300 inherits functionality from a hierarchy of increasingly specialised 
    301 classes starting with a basic structural Mesh to classes implementing 
    302 the finite-volume scheme described in section \ref{sec:fvm}. Other classes 
    303 are \code{Quantity} which represents values of one variable across the mesh 
    304 along with their associated operations, \code{Geospatial_data} which 
    305 represents georeferenced elevation data and a collection of \code{Boundary} 
    306 classes which allows for a 'pluggable' way of driving the model. 
    307 The conserved quantities updated automatically by the numerical scheme 
    308 are stage (water level) $w$, $x$-momentum $uh$ and $y$-momentum 
    309 $vh$. The quanitites elevation $z$ and friction $\eta$ are 
    310 quantities that are not updated automaticall but can be changed explicitly
    311 during run-time if the user wishes to do so. 
    312 
    313 To set up a scenario the user specifies the study area along with any internal 
    314 regions where increased mesh resolution is required. External edges may 
    315 be labelled using symbolic tags which are subsequently used to bind 
    316 boundary condition objects to tagged segments of the mesh boundary. 
    317 The mesh is then generated using \AnuGA{}'s built-in mesh generator and 
    318 converted into the \code{Domain} object which provides all methods used to 
     299The fundamental object in \AnuGA{} is the \code{Domain} which
     300inherits functionality from a hierarchy of increasingly specialised
     301classes starting with a basic structural Mesh to classes implementing
     302the finite-volume scheme described in section \ref{sec:fvm}. Other classes
     303are \code{Quantity} which represents values of one variable across the mesh
     304along with their associated operations, \code{Geospatial_data} which
     305represents georeferenced elevation data and a collection of \code{Boundary}
     306classes which allows for a 'pluggable' way of driving the model.
     307The conserved quantities updated automatically by the numerical scheme
     308are stage (water level) $w$, $x$-momentum $uh$ and $y$-momentum
     309$vh$. The quanitites elevation $z$ and friction $\eta$ are
     310quantities that are not updated automatically but can be changed explicitly
     311during run-time if the user wishes to do so.
     312
     313To set up a scenario the user specifies the study area along with any internal
     314regions where increased mesh resolution is required. External edges may
     315be labelled using symbolic tags which are subsequently used to bind
     316boundary condition objects to tagged segments of the mesh boundary.
     317The mesh is then generated using \AnuGA{}'s built-in mesh generator and
     318converted into the \code{Domain} object which provides all methods used to
    319319setup and run the flow simulation. Figure \ref{fig:anuga mesh} shows an example of a mesh generated by \AnuGA{}.
    320320\begin{figure}
     
    322322\includegraphics[width=4in,keepaspectratio=true]{tsunami-fig-1}
    323323\caption{Triangular mesh used in our finite volume method. Conserved
    324 quantities $h$, $uh$ and $vh$ are associated with each triangular cell.} 
     324quantities $h$, $uh$ and $vh$ are associated with each triangular cell.}
    325325\label{fig:anuga mesh}
    326326\end{center}
     
    338338one of the following forms:
    339339
    340 \begin{itemize} 
    341 \item A constant value as in domain.set_quantity('stage', 1) which
     340\begin{itemize}
     341\item A constant value as in \code{domain.set_quantity('stage', 1)} which
    342342will set the initial water level to 1 m everywhere.
    343 \item Another quantity or a linear combination of quantities.  If q1
    344 and q2 are two arbitrary quantities defined within the same domain,
    345 the expression set_quantity('stage', q1*(3*q2 + 5)) will set the stage
     343\item Another quantity or a linear combination of quantities.  If \code{q1}
     344and \code{q2} are two arbitrary quantities defined within the same domain,
     345the expression \code{domain.set_quantity('stage', q1*(3*q2 + 5))} will set the stage
    346346quantity accordingly.  One common application of this would be to
    347347assign the stage as a constant depth above the bed elevation.
    348 \item An arbitrary function (or a callable object), f(x, y), where x
    349 and y are assumed to be vectors. The quantity will be assigned values by
    350 evaluating f at each location within the mesh.
     348\item An arbitrary function (or a callable object), \code{f(x, y)}, where \code{x}
     349and \code{y} are assumed to be vectors. The quantity will be assigned values by
     350evaluating \code{f} at each location within the mesh.
    351351\item An arbitrary set of points and associated values (wrapped into a
    352352Geospatial_data object). The points need not coincide with triangle
     
    361361\item A Numerical Python array (or a list of numbers) ordered
    362362according to the internal data structure.
    363 \end{itemize} 
    364 The parameter location determines whether the values should be
    365 assigned to triangle edge midpoints or vertices and region allows the
     363\end{itemize}
     364The parameter \code{location} determines whether the values should be
     365assigned to triangle edge, midpoints or vertices and \code{region} allows the
    366366operation to be restricted to a region specified by a symbolic tag or
    367 a set of indices. 
     367a set of indices.
    368368
    369369Boundary conditions are bound to symbolic tags through the method
    370370\code{domain.set_boundary} which takes as input a lookup table (implemented
    371 as a Python dictionary) of the form \code{\{tag:~boundary_object\}}. 
     371as a Python dictionary) of the form \code{\{tag:~boundary_object\}}.
    372372The boundary objects are all assumed to be callable functions of vectors x
    373373and y.  Several predefined standard boundary objects are available and
     
    377377boundaries.
    378378
    379 Forcing terms can be written according to a fixed protocol and added 
    380 to the model using the idiom \code{domain.forcing_terms.append(F)} where F is
     379Forcing terms can be written according to a fixed protocol and added
     380to the model using the idiom \code{domain.forcing_terms.append(F)} where \code{F} is
    381381assumed to be a user-defined callable object.
    382382
     
    387387large speeds and small triangles, time steps can become very small.
    388388In order to access the state of the simulation at regular time
    389 intervals, \AnuGA{} uses the method evolve: 
    390 \begin{verbatim} 
    391 For t in domain.evolve(yieldstep, duration): 
     389intervals, \AnuGA{} uses the method evolve:
     390\begin{verbatim}
     391For t in domain.evolve(yieldstep, duration):
    392392    <model interrogation and modification>
    393 \end{verbatim}     
     393\end{verbatim}
    394394The parameter \code{duration} specifies the time period over which
    395395evolve operates, and control is passed to the body of the for-loop at
     
    402402Python generator hence the reference to 'yield' in the parameter name.
    403403
    404 Figure \ref{fig:beach runup} shows a simulation of water flowing onto a 
    405 hypothetical beach with obstacles. 
     404Figure \ref{fig:beach runup} shows a simulation of water flowing onto a
     405hypothetical beach with obstacles.
    406406A number of complex patterns are captured in this example including a shock where water reflected off the wall far (at the right hand side) meets the main flow. Other physical features are the standing waves and interference patterns.
    407407See the \AnuGA{} User Manual at \url{http://sourceforge.net/projects/anuga} for more details and examples.
     
    475475
    476476\section{Conclusions}
    477 \label{sec:6} 
     477\label{sec:6}
    478478\AnuGA{} is a flexible and robust modelling system
    479479that simulates hydrodynamics by solving the shallow water wave
     
    484484\AnuGA{} can take as input bathymetric and topographic datasets and
    485485simulate the behaviour of riverine flooding, storm surge,
    486 tsunami or even dam breaks. 
     486tsunami or even dam breaks.
    487487Initial validation using wave tank data supports \AnuGA{}'s
    488488ability to model complex scenarios. Further validation will be
     
    493493understand the potential impact from natural hazards in order to
    494494reduce their impact on Australian communities (see \cite{Nielsen2006}).
    495 The \AnuGA{} source code is available 
     495The \AnuGA{} source code is available
    496496at \url{http://sourceforge.net/projects/anuga}.
    497497
Note: See TracChangeset for help on using the changeset viewer.