Changeset 2717
- Timestamp:
- Apr 16, 2006, 9:52:51 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
documentation/user_manual/anuga_user_manual.tex
r2708 r2717 189 189 190 190 In outline, \file{bedslopephysical.py} performs the following steps: 191 191 192 192 \begin{enumerate} 193 193 … … 328 328 329 329 The assignment of the friction quantity demonstrates another way 330 we can use \ code{set\_quantity} to set quantities---namely,330 we can use \method{set\_quantity} to set quantities---namely, 331 331 assign them to a constant numerical value: 332 332 … … 361 361 (Although it is not necessary for this example, it may be useful to digress here 362 362 and mention a variant to this requirement, which allows us to illustrate 363 another way to use \ code{set\_quantity}---namely, incorporating an expression363 another way to use \method{set\_quantity}---namely, incorporating an expression 364 364 involving other quantities. Suppose, instead of setting a constant value 365 365 for the stage, we wished … … 378 378 379 379 The reader will probably appreciate that this capability to incorporate 380 expressions into statements using \ code{set\_quantity} greatly expands380 expressions into statements using \method{set\_quantity} greatly expands 381 381 its power.) 382 382 … … 473 473 474 474 \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} 476 476 \item{within the Python IDLE environment} 477 477 \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} 479 479 \end{itemize} 480 480 … … 517 517 518 518 The 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, but519 the \file{bedslopephysical.py} example and introduces a second example, 520 \file{run\_sydney\_smf.py}, that follows the same basic outline, but 521 521 incorporates more complex features and refers to a real-life 522 522 scenario, 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, 524 524 and predominantly covers Sydney Harbour. A hypothetical tsunami wave is 525 525 generated by a submarine mass failure situated on the edge of the … … 527 527 528 528 \subsection{Overview} 529 As in the case of \ code{bedslopephysical.py}, the actions carried out by the529 As in the case of \file{bedslopephysical.py}, the actions carried out by the 530 530 program can be organised according to this outline: 531 531 … … 553 553 \subsection{The Code} 554 554 555 Here is the code for \ code{run\_sydney\_smf.py}:555 Here is the code for \file{run\_sydney\_smf.py}: 556 556 557 557 %\verbatiminput{"runsydneysmf.py"} … … 564 564 565 565 One obvious way that the present example differs from 566 \ code{bedslopephysical.py} is in the use of a more complex method to create566 \file{bedslopephysical.py} is in the use of a more complex method to create 567 567 the mesh. Instead of imposing a mesh structure on a rectangular 568 568 grid, the technique used for this example involves building mesh … … 592 592 Boundary tags are not restricted to \code{`left'}, \code{`right'}, 593 593 \code{`bottom'} and \code{`top'}, as in the case of 594 \ code{bedslopephysical.py}. Instead the user specifies a list of tags594 \file{bedslopephysical.py}. Instead the user specifies a list of tags 595 595 appropriate to the configuration being modelled. 596 596 … … 623 623 624 624 The function used to implement this process is 625 \ code{create\_mesh\_from\_regions}. Its arguments include the625 \function{create\_mesh\_from\_regions}. Its arguments include the 626 626 bounding polygon and its resolution, a list of boundary tags, and a 627 627 list of pairs \code{[polygon, resolution]}, specifying the interior … … 629 629 630 630 In practice, the details of the polygons used are read from a 631 separate file \ code{project.py}. The resulting mesh is output to a631 separate file \file{project.py}. The resulting mesh is output to a 632 632 \emph{meshfile}\index{meshfile}. This term is used to describe a 633 633 file of a specific format used to store the data specifying a mesh. … … 639 639 \code{pmesh} assigns a name to the file by appending the extension 640 640 \code{.msh} to the name specified in the input file 641 \ code{project.py}. This name is stored in the variable641 \file{project.py}. This name is stored in the variable 642 642 \code{meshname}. 643 643 … … 651 651 652 652 are used to read in the specific polygons \code{project.harbour\_polygon\_2} and 653 \code{botanybay\_polygon\_2} from \ code{project.py} and assign a653 \code{botanybay\_polygon\_2} from \file{project.py} and assign a 654 654 common resolution of 5000 to each. The statement 655 655 … … 670 670 671 671 is then used to create the mesh, taking the bounding polygon to be the polygon 672 \code{diffpolygonall} specified in \ code{project.py}. The672 \code{diffpolygonall} specified in \file{project.py}. The 673 673 argument \code{boundary\_tags} assigns a dictionary, whose keys are the 674 674 names of the boundary tags used for the bounding polygon---\code{`bottom'}, … … 680 680 \subsection{Initialising the Domain} 681 681 682 As with \ code{bedslopephysical.py}, once we have created the mesh, the next682 As with \file{bedslopephysical.py}, once we have created the mesh, the next 683 683 step is to create the data structure \code{domain}. We did this for 684 \ code{bedslopephysical.py} by inputting lists of points and triangles and684 \file{bedslopephysical.py} by inputting lists of points and triangles and 685 685 specifying the boundary tags directly. However, in the present case, 686 686 we use a method that works directly with the meshfile … … 692 692 \end{verbatim}} 693 693 694 The function \ code{pmesh\_to\_domain\_instance} converts a meshfile694 The function \function{pmesh\_to\_domain\_instance} converts a meshfile 695 695 \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} 697 697 to set quantities and to apply other operations. (In principle, the 698 second argument of \ code{pmesh\_to\_domain\_instance} can be any699 subclass of \c ode{Domain}, but for applications involving the698 second argument of \function{pmesh\_to\_domain\_instance} can be any 699 subclass of \class{Domain}, but for applications involving the 700 700 shallow-water wave equation, the second argument of 701 \ code{pmesh\_to\_domain\_instance} can always be set simply to702 \c ode{Domain}.)701 \function{pmesh\_to\_domain\_instance} can always be set simply to 702 \class{Domain}.) 703 703 704 704 The following statements specify a basename and data directory, and 705 705 identify quantities to be stored. For the first two, values are 706 taken from \ code{project.py}.706 taken from \file{project.py}. 707 707 708 708 {\small \begin{verbatim} … … 715 715 716 716 \subsection{Specifying the Quantities} 717 Quantities for \ code{run\_sydney\_smf.py} are set718 using similar methods to those in \ code{bedslopephysical.py}. However,717 Quantities for \file{run\_sydney\_smf.py} are set 718 using similar methods to those in \file{bedslopephysical.py}. However, 719 719 in this case, many of the values are read from the auxiliary file 720 \ code{project.py} or, in the case of \code{elevation}, from an720 \file{project.py} or, in the case of \code{elevation}, from an 721 721 ancillary points file. 722 722 … … 727 727 For the scenario we are modelling in this case, we use a callable 728 728 object \code{tsunami\_source}, assigned by means of a function 729 \ code{slump\_tsunami}. This is similar to how we set elevation in730 \ code{bedslopephysical.py} using a function---however, in this case the729 \function{slump\_tsunami}. This is similar to how we set elevation in 730 \file{bedslopephysical.py} using a function---however, in this case the 731 731 function is both more complex and more interesting. 732 732 … … 739 739 \subsubsection{Friction} 740 740 741 We assign the friction exactly as we did for \ code{bedslopephysical.py}:741 We assign the friction exactly as we did for \file{bedslopephysical.py}: 742 742 743 743 {\small \begin{verbatim} … … 760 760 are needed to prepare the file from which the data is taken. Two 761 761 source files are used for this data---their names are specified in 762 the file \ code{project.py}, in the variables \code{coarsedemname}762 the file \file{project.py}, in the variables \code{coarsedemname} 763 763 and \code{finedemname}. They contain `coarse' and `fine' data, 764 764 respectively---that is, data sampled at widely spaced points over a … … 777 777 common to both datasets. The name to be assigned to the resulting 778 778 dataset 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}. 780 780 781 781 \subsection{Boundary Conditions} 782 782 783 783 Setting boundaries follows a similar pattern to the one used for 784 \ code{bedslopephysical.py}, except that in this case we need to associate a784 \file{bedslopephysical.py}, except that in this case we need to associate a 785 785 boundary type with each of the 786 786 boundary tag names introduced when we established the mesh. In place of the four 787 boundary types introduced for \ code{bedslopephysical.py}, we use the reflective787 boundary types introduced for \file{bedslopephysical.py}, we use the reflective 788 788 boundary for each of the 789 789 eight tagged segments: … … 799 799 800 800 With the basics established, the running of the `evolve' step is 801 very similar to the corresponding step in \ code{bedslopephysical.py}:801 very similar to the corresponding step in \file{bedslopephysical.py}: 802 802 803 803 {\small \begin{verbatim} … … 840 840 Each listing also describes the location of the module in which 841 841 the code for the feature being described can be found. All modules 842 are in the folder \ code{inundation} or one of its subfolders, and the843 location of each module is described relative to \ code{inundation}. Rather842 are in the folder \file{inundation} or one of its subfolders, and the 843 location of each module is described relative to \file{inundation}. Rather 844 844 than using pathnames, whose syntax depends on the operating system, 845 845 we use the format adopted for importing the function or class for 846 846 use in Python code. For example, suppose we wish to specify that the 847 function \ code{create\_mesh\_from\_regions} is in a module called848 \ code{mesh\_interface} in a subfolder of \code{inundation} called847 function \function{create\_mesh\_from\_regions} is in a module called 848 \module{mesh\_interface} in a subfolder of \module{inundation} called 849 849 \code{pmesh}. In Linux or Unix syntax, the pathname of the file 850 containing the function, relative to \ code{inundation}, would be850 containing the function, relative to \file{inundation}, would be 851 851 852 852 \begin{center} … … 936 936 937 937 % Translate following into layman's language 938 This method is used to add a region where the tria gular mesh will not938 This method is used to add a region where the triangular mesh will not 939 939 be generated to a Mesh instance. The region is 940 940 described by the polygon passed in. Additionally, … … 950 950 951 951 % Translate following into layman's language 952 This method is used to generate the tria gular mesh. The maximal area952 This method is used to generate the triangular mesh. The maximal area 953 953 of any triangle in the mesh can be specified, along with the minimum 954 angle of all tria gles.954 angle of all triangles. 955 955 \end{funcdesc} 956 956
Note: See TracChangeset
for help on using the changeset viewer.