Changeset 2672
- Timestamp:
- Apr 6, 2006, 3:34:42 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
documentation/user_manual/anuga_user_manual.tex
r2671 r2672 150 150 \subsection{Overview} 151 151 152 What follows is a discussion of the structure and operation of the file153 \code{bedslopephysical.py}, with just enough detail to allow the reader 154 t o appreciate what's involved in setting up a scenario like the155 one it depicts.152 What follows is a discussion of the structure and operation of the 153 file \file{bedslopephysical.py}, with just enough detail to allow 154 the reader to appreciate what's involved in setting up a scenario 155 like the one it depicts. 156 156 157 157 This example carries out the solution of the shallow-water wave … … 188 188 \subsection{Outline of the Program} 189 189 190 In outline, \ code{bedslopephysical.py} performs the following steps:190 In outline, \file{bedslopephysical.py} performs the following steps: 191 191 192 192 \begin{enumerate} … … 213 213 %This should be used wherever possible 214 214 For reference we include below the complete code listing for 215 \code{bedslopephysical.py}. Subsequent paragraphs provide a `commentary' 216 that describes each step of the program and explains it significance. 215 \file{bedslopephysical.py}. Subsequent paragraphs provide a 216 `commentary' that describes each step of the program and explains it 217 significance. 217 218 218 219 %\verbatiminput{examples/bedslopephysical.py} … … 228 229 \end{verbatim}} 229 230 230 The function \ code{rectangular} is imported from a module231 \ code{mesh\_factory} defined elsewhere. (\anuga also contains231 The function \function{rectangular} is imported from a module 232 \module{mesh\_factory} defined elsewhere. (\anuga also contains 232 233 several other schemes that can be used for setting up meshes, but we 233 234 shall not discuss these now.) The above assignment sets up a $10 … … 267 268 \end{verbatim}} 268 269 269 This uses a Python class \c ode{Domain}, imported from270 \ code{shallow\_water}, which is an extension of a more generic271 class of the same name in the module \ code{domain}, and inherits270 This uses a Python class \class{Domain}, imported from 271 \module{shallow\_water}, which is an extension of a more generic 272 class of the same name in the module \module{domain}, and inherits 272 273 some methods from the generic class but has others specific to the 273 shallow-water scenarios in which it is used. Specific options for domain 274 are set at this point. One of them is to set the basename for the output file: 274 shallow-water scenarios in which it is used. Specific options for 275 domain are set at this point. One of them is to set the basename for 276 the output file: 275 277 276 278 {\small \begin{verbatim} … … 281 283 \subsection{Specifying the Quantities} 282 284 283 The next task is to specify a number of quantities that we wish to set284 for each mesh point. The class \code{Domain} has a method285 \ code{set\_quantity}, used to specify these quantities. It is a286 particularly flexible method that allows the user to set quantities in287 a variety of ways---using constants, functions, numeric arrays or285 The next task is to specify a number of quantities that we wish to 286 set for each mesh point. The class \class{Domain} has a method 287 \method{set\_quantity}, used to specify these quantities. It is a 288 particularly flexible method that allows the user to set quantities 289 in a variety of ways---using constants, functions, numeric arrays or 288 290 expressions involving other quantities, arbitrary data points with 289 291 associated values, all of which can be passed as arguments. All 290 quantities can be initialised using \ code{set\_quantity}. For292 quantities can be initialised using \method{set\_quantity}. For 291 293 conserved quantities (\code{stage, xmomentum, ymomentum}) this is 292 called the \emph{initial condition}, for other quantities that aren't293 updated by the equation, the same interface is used to assign their 294 values. The code in the present example demonstrates a number of forms 295 in which we can invoke \code{set\_quantity}.294 called the \emph{initial condition}, for other quantities that 295 aren't updated by the equation, the same interface is used to assign 296 their values. The code in the present example demonstrates a number 297 of forms in which we can invoke \method{set\_quantity}. 296 298 297 299 … … 313 315 the \code{y} direction. %[screen shot?] 314 316 315 Once the function \ code{f} is specified, the quantity317 Once the function \function{f} is specified, the quantity 316 318 \code{elevation} is assigned through the simple statement: 317 319 … … 485 487 \begin{figure}[hbt] 486 488 487 %\centerline{ \includegraphics[width=75mm, height=75mm]{examples/bedslopestart.eps}}489 \centerline{ \includegraphics[width=75mm, height=75mm]{examples/bedslopestart.eps}} 488 490 489 491 \caption{Bedslope example viewed with Swollen} … … 495 497 496 498 \centerline{ 497 %\includegraphics[width=75mm, height=75mm]{examples/bedslopeduring.eps}498 %\includegraphics[width=75mm, height=75mm]{examples/bedslopeend.eps}499 \includegraphics[width=75mm, height=75mm]{examples/bedslopeduring.eps} 500 \includegraphics[width=75mm, height=75mm]{examples/bedslopeend.eps} 499 501 } 500 502 … … 864 866 \end{center} 865 867 868 Each listing details the full set of parameters for the class or 869 function; however, the description is generally limited to the most 870 important parameters and the reader is again referred to the code 871 for more details. 872 873 The following parameters are common to many functions and classes 874 and are omitted from the descriptions given below: 875 876 \begin{tabular}{|l|l|} \hline 877 \textbf{Name } & \textbf{Description}\\ 878 \hline 879 \code{usecache} & Specifies whether caching is to be used\\ 880 \code{verbose} & If \code{True}, provides detailed terminal output 881 to the user\\ \hline 882 \end{tabular} 883 866 884 867 885 \section{Mesh Generation} 868 886 \refmodindex[pmesh.meshinterface]{pmesh.mesh\_interface} 869 887 \begin{funcdesc} {create\_mesh\_from\_regions}{bounding_polygon, 870 888 boundary_tags, … … 877 895 Module: \code{pmesh.mesh\_interface} 878 896 897 879 898 % Translate following into layman's language 880 899 This function is used to create a triangular mesh suitable for use with … … 886 905 the user specifies a list of boundary tags, one for each edge of the bounding 887 906 polygon. 907 908 This function is used to create a triangular mesh within a specified 909 region, suitable for use with \anuga. The user specifies a polygon 910 (the \code{bounding polygon}) that serves as the boundary for the 911 region as well as an upper bound (\code{maximum\_triangle\_area}, 912 also referred to as the \emph{resolution}) for the areas of the 913 inscribed triangles. The function uses a random process to compute a 914 mesh within the bounding polygon and returns a meshfile, in the form 915 of a 888 916 \end{funcdesc} 889 917 … … 912 940 Module: \code{pyvolution.domain} 913 941 914 Assigns the name \code{name} to the domain 942 Assigns the name \code{name} to the domain. 915 943 \end{funcdesc} 916 944 … … 925 953 Module: \code{pyvolution.domain} 926 954 927 S ets the directory used for data to the value \code{name}. The default value, before928 \code{set\_datadir} isrun, is the value \code{default_datadir}955 Specifies the directory used for data, assigning it to the pathname \code{name}. The default value, before 956 \code{set\_datadir} has been run, is the value \code{default_datadir} 929 957 specified in \code{config.py}. 958 959 Since different operating systems use different formats for specifying pathnames, 960 it is necessary to specify path separators using the Python code \code{os.sep}, rather than 961 the operating-specific ones such as `$\slash$' or `$\backslash$'. 962 For this to work you will need to include the statement \code{import os} 963 in your code, before the first appearance of \code{set\_datadir}. 964 965 For example, if you wished to set the data directory to a subdirectory 966 \code{data} of the directory \code{project}, you might use 967 statements of the following type: 968 969 {\small \begin{verbatim} 970 import os 971 domain.set_datadir{'project' + os.sep + 'data'} 972 \end{verbatim}} 930 973 \end{funcdesc} 931 974 … … 938 981 \end{funcdesc} 939 982 940 \begin{funcdesc} {set_time}{??} 983 \begin{funcdesc} {set_time}{time=0.0} 984 Module: \code{pyvolution.domain} 985 986 Sets the initial time, in seconds, for the simulation. The 987 default is 0.0. 941 988 \end{funcdesc} 942 989 … … 1072 1119 point \code{(x, y)} within a mesh region. 1073 1120 1074 The actual time series at which data is available is specified by means 1075 of an array \code{time} of monotonically increasing times. 1076 The quantities containing the values to be interpolated are specified in 1077 an array---or dictionary of arrays (used in conjunction with the optional argument 1078 \code{quantitity\_names}) --- called \code{quantities}. 1079 The optional arguments \code{vertex_coordinates} and \code{triangles} represent 1080 the spatial mesh associated with the quantity arrays. If omitted the function created 1081 by \code{Interpolation\_function} will be a function of \code{t} only. 1082 1083 1084 Since, in practice, values need to be computed at specified 1085 points, the syntax allows the user to specify, once and for all, a list 1086 \code{interpolation\_points} of points at which values are required. In this case, 1087 the function may be called using the form \code{f(t, id)}, where \code{id} is an 1088 index identifying a member of \code{interpolation\_points}. 1089 1090 1091 1092 1121 The actual time series at which data is available is specified by 1122 means of an array \code{time} of monotonically increasing times. The 1123 quantities containing the values to be interpolated are specified in 1124 an array---or dictionary of arrays (used in conjunction with the 1125 optional argument \code{quantity\_names}) --- called 1126 \code{quantities}. The optional arguments \code{vertex_coordinates} 1127 and \code{triangles} represent the spatial mesh associated with the 1128 quantity arrays. If omitted the function created by 1129 \code{Interpolation\_function} will be a function of \code{t} only. 1130 1131 Since, in practice, values need to be computed at specified points, 1132 the syntax allows the user to specify, once and for all, a list 1133 \code{interpolation\_points} of points at which values are required. 1134 In this case, the function may be called using the form \code{f(t, 1135 id)}, where \code{id} is an index for the list 1136 \code{interpolation\_points}. 1093 1137 1094 1138 \end{classdesc} … … 1690 1734 \subsubsection{Can I start the simulation at an arbitrary time?} 1691 1735 Yes, using \code{domain.set_time()} you can specify an arbitrary starting time. 1692 This 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. 1736 This 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. 1693 1737 1694 1738 \subsubsection{Why does a file\_function return a list of numbers when evaluated?} … … 1701 1745 1702 1746 \subsubsection{How do I know which boundary tags are available?} 1703 The method \code{domain.get_boundary_tags()} will return a list of 1747 The method \code{domain.get_boundary_tags()} will return a list of 1704 1748 available tags for use with \code{domain.set_boundary_condition()}. 1705 1749
Note: See TracChangeset
for help on using the changeset viewer.