Changeset 2717


Ignore:
Timestamp:
Apr 16, 2006, 9:52:51 PM (18 years ago)
Author:
howard
Message:

Changed more \code to \function, \file, etc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • documentation/user_manual/anuga_user_manual.tex

    r2708 r2717  
    189189
    190190In outline, \file{bedslopephysical.py} performs the following steps:
    191                                    
     191                   
    192192\begin{enumerate}
    193193
     
    328328
    329329The assignment of the friction quantity demonstrates another way
    330 we can use \code{set\_quantity} to set quantities---namely,
     330we can use \method{set\_quantity} to set quantities---namely,
    331331assign them to a constant numerical value:
    332332
     
    361361(Although it is not necessary for this example, it may be useful to digress here
    362362and mention a variant to this requirement, which allows us to illustrate
    363 another way to use \code{set\_quantity}---namely, incorporating an expression
     363another way to use \method{set\_quantity}---namely, incorporating an expression
    364364involving other quantities. Suppose, instead of setting a constant value
    365365for the stage, we wished
     
    378378
    379379The reader will probably appreciate that this capability to incorporate
    380 expressions into statements using \code{set\_quantity} greatly expands
     380expressions into statements using \method{set\_quantity} greatly expands
    381381its power.)
    382382
     
    473473
    474474\begin{itemize}
    475   \item{from a Windows command line} as in \code{python bedslopephysical.py}
     475  \item{from a Windows command line} as in \file{python bedslopephysical.py}
    476476  \item{within the Python IDLE environment}
    477477  \item{within emacs}
    478   \item{from a Linux command line} as in \code{python bedslopephysical.py}
     478  \item{from a Linux command line} as in \file{python bedslopephysical.py}
    479479\end{itemize}
    480480
     
    517517
    518518The following discussion builds on the concepts introduced through
    519 the \code{bedslopephysical.py} example and introduces a second example,
    520 \code{run\_sydney\_smf.py}, that follows the same basic outline, but
     519the \file{bedslopephysical.py} example and introduces a second example,
     520\file{run\_sydney\_smf.py}, that follows the same basic outline, but
    521521incorporates more complex features and refers to a real-life
    522522scenario, rather than the artificial illustrative one used in
    523 \code{bedslopephysical.py}. The domain of interest surrounds the Sydney region,
     523\file{bedslopephysical.py}. The domain of interest surrounds the Sydney region,
    524524and predominantly covers Sydney Harbour. A hypothetical tsunami wave is
    525525generated by a submarine mass failure situated on the edge of the
     
    527527
    528528\subsection{Overview}
    529 As in the case of \code{bedslopephysical.py}, the actions carried out by the
     529As in the case of \file{bedslopephysical.py}, the actions carried out by the
    530530program can be organised according to this outline:
    531531
     
    553553\subsection{The Code}
    554554
    555 Here is the code for \code{run\_sydney\_smf.py}:
     555Here is the code for \file{run\_sydney\_smf.py}:
    556556
    557557%\verbatiminput{"runsydneysmf.py"}
     
    564564
    565565One obvious way that the present example differs from
    566 \code{bedslopephysical.py} is in the use of a more complex method to create
     566\file{bedslopephysical.py} is in the use of a more complex method to create
    567567the mesh. Instead of imposing a mesh structure on a rectangular
    568568grid, the technique used for this example involves building mesh
     
    592592Boundary tags are not restricted to \code{`left'}, \code{`right'},
    593593\code{`bottom'} and \code{`top'}, as in the case of
    594 \code{bedslopephysical.py}. Instead the user specifies a list of tags
     594\file{bedslopephysical.py}. Instead the user specifies a list of tags
    595595appropriate to the configuration being modelled.
    596596
     
    623623
    624624The function used to implement this process is
    625 \code{create\_mesh\_from\_regions}. Its arguments include the
     625\function{create\_mesh\_from\_regions}. Its arguments include the
    626626bounding polygon and its resolution, a list of boundary tags, and a
    627627list of pairs \code{[polygon, resolution]}, specifying the interior
     
    629629
    630630In practice, the details of the polygons used are read from a
    631 separate file \code{project.py}. The resulting mesh is output to a
     631separate file \file{project.py}. The resulting mesh is output to a
    632632\emph{meshfile}\index{meshfile}. This term is used to describe a
    633633file of a specific format used to store the data specifying a mesh.
     
    639639\code{pmesh} assigns a name to the file by appending the extension
    640640\code{.msh} to the name specified in the input file
    641 \code{project.py}. This name is stored in the variable
     641\file{project.py}. This name is stored in the variable
    642642\code{meshname}.
    643643
     
    651651
    652652are used to read in the specific polygons \code{project.harbour\_polygon\_2} and
    653 \code{botanybay\_polygon\_2} from \code{project.py} and assign a
     653\code{botanybay\_polygon\_2} from \file{project.py} and assign a
    654654common resolution of 5000 to each. The statement
    655655
     
    670670
    671671is then used to create the mesh, taking the bounding polygon to be the polygon
    672 \code{diffpolygonall} specified in \code{project.py}. The
     672\code{diffpolygonall} specified in \file{project.py}. The
    673673argument \code{boundary\_tags} assigns a dictionary, whose keys are the
    674674names of the boundary tags used for the bounding polygon---\code{`bottom'},
     
    680680\subsection{Initialising the Domain}
    681681
    682 As with \code{bedslopephysical.py}, once we have created the mesh, the next
     682As with \file{bedslopephysical.py}, once we have created the mesh, the next
    683683step is to create the data structure \code{domain}. We did this for
    684 \code{bedslopephysical.py} by inputting lists of points and triangles and
     684\file{bedslopephysical.py} by inputting lists of points and triangles and
    685685specifying the boundary tags directly. However, in the present case,
    686686we use a method that works directly with the meshfile
     
    692692\end{verbatim}}
    693693
    694 The function \code{pmesh\_to\_domain\_instance} converts a meshfile
     694The function \function{pmesh\_to\_domain\_instance} converts a meshfile
    695695\code{meshname} into an instance of the data structure
    696 \code{domain}, allowing us to use methods like \code{set\_quantity}
     696\code{domain}, allowing us to use methods like \method{set\_quantity}
    697697to set quantities and to apply other operations. (In principle, the
    698 second argument of \code{pmesh\_to\_domain\_instance} can be any
    699 subclass of \code{Domain}, but for applications involving the
     698second argument of \function{pmesh\_to\_domain\_instance} can be any
     699subclass of \class{Domain}, but for applications involving the
    700700shallow-water wave equation, the second argument of
    701 \code{pmesh\_to\_domain\_instance} can always be set simply to
    702 \code{Domain}.)
     701\function{pmesh\_to\_domain\_instance} can always be set simply to
     702\class{Domain}.)
    703703
    704704The following statements specify a basename and data directory, and
    705705identify quantities to be stored. For the first two, values are
    706 taken from \code{project.py}.
     706taken from \file{project.py}.
    707707
    708708{\small \begin{verbatim}
     
    715715
    716716\subsection{Specifying the Quantities}
    717 Quantities for \code{run\_sydney\_smf.py} are set
    718 using similar methods to those in \code{bedslopephysical.py}. However,
     717Quantities for \file{run\_sydney\_smf.py} are set
     718using similar methods to those in \file{bedslopephysical.py}. However,
    719719in this case, many of the values are read from the auxiliary file
    720 \code{project.py} or, in the case of \code{elevation}, from an
     720\file{project.py} or, in the case of \code{elevation}, from an
    721721ancillary points file.
    722722
     
    727727For the scenario we are modelling in this case, we use a callable
    728728object \code{tsunami\_source}, assigned by means of a function
    729 \code{slump\_tsunami}. This is similar to how we set elevation in
    730 \code{bedslopephysical.py} using a function---however, in this case the
     729\function{slump\_tsunami}. This is similar to how we set elevation in
     730\file{bedslopephysical.py} using a function---however, in this case the
    731731function is both more complex and more interesting.
    732732
     
    739739\subsubsection{Friction}
    740740
    741 We assign the friction exactly as we did for \code{bedslopephysical.py}:
     741We assign the friction exactly as we did for \file{bedslopephysical.py}:
    742742
    743743{\small \begin{verbatim}
     
    760760are needed to prepare the file from which the data is taken. Two
    761761source files are used for this data---their names are specified in
    762 the file \code{project.py}, in the variables \code{coarsedemname}
     762the file \file{project.py}, in the variables \code{coarsedemname}
    763763and \code{finedemname}. They contain `coarse' and `fine' data,
    764764respectively---that is, data sampled at widely spaced points over a
     
    777777common to both datasets. The name to be assigned to the resulting
    778778dataset is also derived from the name stored in the variable
    779 \code{combinedname} in the file \code{project.py}.
     779\code{combinedname} in the file \file{project.py}.
    780780
    781781\subsection{Boundary Conditions}
    782782
    783783Setting boundaries follows a similar pattern to the one used for
    784 \code{bedslopephysical.py}, except that in this case we need to associate a
     784\file{bedslopephysical.py}, except that in this case we need to associate a
    785785boundary type with each of the
    786786boundary tag names introduced when we established the mesh. In place of the four
    787 boundary types introduced for \code{bedslopephysical.py}, we use the reflective
     787boundary types introduced for \file{bedslopephysical.py}, we use the reflective
    788788boundary for each of the
    789789eight tagged segments:
     
    799799
    800800With the basics established, the running of the `evolve' step is
    801 very similar to the corresponding step in \code{bedslopephysical.py}:
     801very similar to the corresponding step in \file{bedslopephysical.py}:
    802802
    803803{\small \begin{verbatim}
     
    840840Each listing also describes the location of the module in which
    841841the code for the feature being described can be found. All modules
    842 are in the folder \code{inundation} or one of its subfolders, and the
    843 location of each module is described relative to \code{inundation}. Rather
     842are in the folder \file{inundation} or one of its subfolders, and the
     843location of each module is described relative to \file{inundation}. Rather
    844844than using pathnames, whose syntax depends on the operating system,
    845845we use the format adopted for importing the function or class for
    846846use in Python code. For example, suppose we wish to specify that the
    847 function \code{create\_mesh\_from\_regions} is in a module called
    848 \code{mesh\_interface} in a subfolder of \code{inundation} called
     847function \function{create\_mesh\_from\_regions} is in a module called
     848\module{mesh\_interface} in a subfolder of \module{inundation} called
    849849\code{pmesh}. In Linux or Unix syntax, the pathname of the file
    850 containing the function, relative to \code{inundation}, would be
     850containing the function, relative to \file{inundation}, would be
    851851
    852852\begin{center}
     
    936936
    937937% Translate following into layman's language
    938 This method is used to add a region where the triagular mesh will not
     938This method is used to add a region where the triangular mesh will not
    939939be generated to a Mesh instance.  The region is
    940940described by the polygon passed in.  Additionally,
     
    950950
    951951% Translate following into layman's language
    952 This method is used to generate the triagular mesh.  The  maximal area
     952This method is used to generate the triangular mesh.  The  maximal area
    953953of any triangle in the mesh can be specified, along with the minimum
    954 angle of all triagles.
     954angle of all triangles.
    955955\end{funcdesc}
    956956
Note: See TracChangeset for help on using the changeset viewer.