Changeset 2529 for documentation
- Timestamp:
- Mar 12, 2006, 11:16:03 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
documentation/user_manual/anuga_user_manual.tex
r2524 r2529 43 43 44 44 \setcounter{tocdepth}{3} 45 45 \setcounter{secnumdepth}{3} 46 46 \begin{document} 47 47 \maketitle … … 108 108 The purpose of this user manual is to introduce the new user to 109 109 the software, describe what it can do and give step-by-step 110 instructions for setting up , configuring and running the software.110 instructions for setting up and running hydrodynamic simulations. 111 111 112 112 \section{Scope} 113 113 114 114 This manual covers only what is needed to operate the software 115 after installation . It does not includes instructions for115 after installation and configuration. It does not includes instructions for 116 116 installing the software or detailed API documentation, both of 117 117 which will be covered in separate publications. … … 144 144 \anuga by working through simple examples. Two examples are discussed; 145 145 the first is a simple but artificial example that is useful to illustrate 146 many of the ideas, and the second is a real-lifeexample.146 many of the ideas, and the second is a more realistic example. 147 147 148 148 \section{A Simple Example} … … 150 150 \subsection{Overview} 151 151 152 What follows 153 is a discussion of the structure and operation of the file 154 \code{bedslope.py}, with just enough detail to allow the reader 152 What follows is a discussion of the structure and operation of the file 153 \code{bedslopephysical.py}, with just enough detail to allow the reader 155 154 to appreciate what's involved in setting up a scenario like the 156 155 one it depicts. … … 170 169 terms. The boundary is reflective on three sides and a time dependent wave on one side. 171 170 172 The present example, as it represents a simple scenario, does not 173 include any forcing term, nor is the data taken from a file as it 174 would be in many typical cases. The quantities involved in the 175 present problem are: 176 \begin{itemize} 177 \item elevation\index{elevation} 178 \item friction\index{friction} 179 \item depth\index{depth} 180 \item stage\index{stage} 181 \end{itemize} 171 The present example represents a simple scenario and does not 172 include any forcing terms, nor is the data taken from a file as it 173 would be in many typical cases. 174 175 The conserved quantities involved in the 176 problem are water depth, $x$-momentum and $y$-momentum. Other quantities 177 involved in the computation are the friction, stage (absolute height of water surface) 178 and elevation, the last two being related to 179 the depth through the equation 180 181 {\small \begin{verbatim} 182 \code{stage} = \code{elevation} + \code{depth} 183 \end{verbatim}} 182 184 183 185 %\emph{[More details of the problem background]} … … 185 187 \subsection{Outline of the Program} 186 188 187 In outline, \code{bedslope .py} performs the following steps:189 In outline, \code{bedslopephysical.py} performs the following steps: 188 190 189 191 \begin{enumerate} … … 210 212 %This should be used wherever possible 211 213 For reference we include below the complete code listing for 212 \code{bedslope .py}. Subsequent paragraphs provide a `commentary'214 \code{bedslopephysical.py}. Subsequent paragraphs provide a `commentary' 213 215 that describes each step of the program and explains it significance. 214 216 215 \verbatiminput{examples/bedslope _physical.py}217 \verbatiminput{examples/bedslopephysical.py} 216 218 217 219 \subsection{Establishing the Mesh} … … 334 336 The stage (the height of the water surface) is related to the 335 337 elevation and the depth at any time by the equation \[\code{stage} = 336 \code{elevation} + \code{depth}\] To specify a constant depth of a 337 particular value, therefore, we need to specify that \code{stage} is 338 everywhere obtained by adding that constant value to the already 339 specified \code{elevation}. Doing this allows us to illustrate 340 another way to use \code{set\_quantity}, introducing an expression 341 involving other quantities: 338 \code{elevation} + \code{depth}\] 339 340 For this example, we simply assign a constant value to \code{stage}, 341 using the statement 342 343 {\small \begin{verbatim} 344 domain.set_quantity('stage', -.4) 345 \end{verbatim}} 346 347 which specifies that the surface level is set to a height of $-0.4$, i.e. 0.4 units 348 below the zero level. 349 350 (Although it is not necessary for this example, it may be useful to digress here 351 and mention a variant to this requirement, which allows us to illustrate 352 another way to use \code{set\_quantity}---namely, incorporating an expression 353 involving other quantities. Suppose, instead of setting a constant value 354 for the stage, we wished 355 to specify a constant value for the \emph{depth}. For such a case we 356 need to specify that \code{stage} is 357 everywhere obtained by adding that value to the value already 358 specified for \code{elevation}. We would do this by means of the statements: 342 359 343 360 {\small \begin{verbatim} … … 346 363 \end{verbatim}} 347 364 348 Here we are stipulating that the quantity \code{stage} is defined by 349 taking the quantity elevation already defined and adding a constant 350 value $h = 0.05$ to it everywhere. 365 That is, the value of \code{stage} is set to $\code{h} = 0.05$ plus the 366 value of \code{elevation} already defined. 367 368 The reader will probably appreciate that this capability to incorporate 369 expressions into statements using \code{set\_quantity} greatly expands 370 its power.) 351 371 352 372 \subsubsection{Boundary Conditions} … … 369 389 assigned as needed. Each boundary condition specifies the 370 390 behaviour at a boundary in terms of the behaviour in neighbouring 371 elements. The boundary conditions may be briefly described as391 elements. The boundary conditions introduced here may be briefly described as 372 392 follows: 373 393 … … 383 403 384 404 \item[Dirichlet boundary]Specifies a fixed value at the 385 boundary .405 boundary and assigns initial values to the $x$-momentum and $y$-momentum. 386 406 387 407 \item[Time boundary.]A Dirichlet boundary whose behaviour varies with time. … … 399 419 boundary is fixed, with an elevation of 0.2, while the other 400 420 boundaries are all reflective. 421 422 The reader may wish to experiment by varying the choice of boundary types 423 for one or more of the boundaries. In the case of \code{Bd} and \code{Bw}, 424 the three arguments in each case represent the 425 426 {\small \begin{verbatim} 427 Bw = Time_boundary(domain=domain, 428 f=lambda t: [(0.1*sin(t*2*pi)), 0.0, 0.0]) 429 \end{verbatim}} 430 401 431 402 432 … … 432 462 433 463 \begin{itemize} 434 \item{from a Windows command line} as in \code{python bedslope .py}464 \item{from a Windows command line} as in \code{python bedslopephysical.py} 435 465 \item{within the Python IDLE environment} 436 466 \item{within emacs} 437 \item{from a Linux command line} as in \code{python bedslope .py}467 \item{from a Linux command line} as in \code{python bedslopephysical.py} 438 468 \end{itemize} 439 469 … … 441 471 \section{Exploring the model output} 442 472 443 blablabal Figure \ref{fig:bedslope start} shows the 473 Figure \ref{fig:bedslopestart} shows the \\ 444 474 Figure \ref{fig:bedslope2} shows later snapshots... 445 475 … … 448 478 \begin{figure}[hbt] 449 479 450 \centerline{ \includegraphics[width=75mm, height=75mm]{examples/bedslope start.eps}}451 452 \caption{Bedslope example viewed with Swollen .}453 \label{fig:bedslope 480 \centerline{ \includegraphics[width=75mm, height=75mm]{examples/bedslope_start.eps}} 481 482 \caption{Bedslope example viewed with Swollen} 483 \label{fig:bedslopestart} 454 484 \end{figure} 455 485 … … 458 488 459 489 \centerline{ 460 \includegraphics[width=75mm, height=75mm]{examples/bedslope during.eps}461 \includegraphics[width=75mm, height=75mm]{examples/bedslope end.eps}490 \includegraphics[width=75mm, height=75mm]{examples/bedslope_during.eps} 491 \includegraphics[width=75mm, height=75mm]{examples/bedslope_end.eps} 462 492 } 463 493 464 \caption{Bedslope example viewed with Swollen .}494 \caption{Bedslope example viewed with Swollen} 465 495 \label{fig:bedslope2} 466 496 \end{figure} … … 476 506 477 507 The following discussion builds on the concepts introduced through 478 the \code{bedslope .py} example and introduces a second example,508 the \code{bedslopephysical.py} example and introduces a second example, 479 509 \code{run\_sydney\_smf.py}, that follows the same basic outline, but 480 510 incorporates more complex features and refers to a real-life 481 511 scenario, rather than the artificial illustrative one used in 482 \code{bedslope.py}. [Include details of the scenario to which it 483 refers??] 512 \code{bedslopephysical.py}. The domain of interest surrounds the Sydney region, 513 and predominantly covers Sydney Harbour. A hypothetical tsunami wave is 514 generated by a submarine mass failure situated on the edge of the 515 continental shelf. 484 516 485 517 \subsection{Overview} 486 As in the case of \code{bedslope .py}, the actions carried out by the518 As in the case of \code{bedslopephysical.py}, the actions carried out by the 487 519 program can be organised according to this outline: 488 520 … … 492 524 493 525 \item Set certain parameters governing the mode of 494 operation of the model- specifying, for instance, where to store the526 operation of the model---specifying, for instance, where to store the 495 527 model output. 496 528 … … 521 553 522 554 One obvious way that the present example differs from 523 \code{bedslope .py} is in the use of a more complex method to create555 \code{bedslopephysical.py} is in the use of a more complex method to create 524 556 the mesh. Instead of imposing a mesh structure on a rectangular 525 557 grid, the technique used for this example involves building mesh … … 543 575 544 576 545 \caption{Mesh points are created inside the polygon .}577 \caption{Mesh points are created inside the polygon} 546 578 \label{fig:pentagon} 547 579 \end{figure} … … 549 581 Boundary tags are not restricted to \code{`left'}, \code{`right'}, 550 582 \code{`bottom'} and \code{`top'}, as in the case of 551 \code{bedslope .py}. Instead the user specifies a list of tags583 \code{bedslopephysical.py}. Instead the user specifies a list of tags 552 584 appropriate to the configuration being modelled. 553 585 … … 566 598 567 599 568 \caption{Interior meshes with individual resolution .}600 \caption{Interior meshes with individual resolution} 569 601 \label{fig:interior meshes} 570 602 \end{figure} … … 599 631 \code{meshname}. 600 632 633 The statements 634 635 {\small \begin{verbatim} 636 interior_res = 5000% 637 interior_regions = [[project.harbour_polygon_2, interior_res], 638 [project.botanybay_polygon_2, interior_res]] 639 \end{verbatim}} 640 641 are used to read in the specific polygons \code{project.harbour\_polygon\_2} and 642 \code{botanybay\_polygon\_2} from \code{project.py} and assign a 643 common resolution of 5000 to each. The statement 644 645 {\small \begin{verbatim} 646 create_mesh_from_regions(project.diffpolygonall,% 647 boundary_tags= {'bottom': [0],% 648 'right1': [1],% 649 'right0': [2],% 650 'right2': [3],% 651 'top': [4],% 652 'left1': [5],% 653 'left2': [6],% 654 'left3': [7]},% 655 maximum_triangle_area=100000,% 656 filename=meshname,% 657 interior_regions=interior_regions) 658 \end{verbatim}} 659 660 is then used to create the mesh, taking the bounding polygon to be the polygon 661 \code{diffpolygonall} specified in \code{project.py}. The 662 argument \code{boundary\_tags} assigns a dictionary, whose keys are the 663 names of the boundary tags used for the bounding polygon---\code{`bottom'}, 664 `right0', `right1', `right2', `top', `left1', `left2' and `left3'--- 665 and whose values identify the indices of the segments associated with each of these 666 tags. (The value associated with each boundary tag is a one-element list.) 667 601 668 602 669 \subsection{Initialising the Domain} 603 670 604 As with \code{bedslope .py}, once we have created the mesh, the next671 As with \code{bedslopephysical.py}, once we have created the mesh, the next 605 672 step is to create the data structure \code{domain}. We did this for 606 \code{bedslope .py} by inputting lists of points and triangles and673 \code{bedslopephysical.py} by inputting lists of points and triangles and 607 674 specifying the boundary tags directly. However, in the present case, 608 675 we use a method that works directly with the meshfile … … 610 677 611 678 {\small \begin{verbatim} 612 domain = pmesh_to_domain_instance(meshname,613 Domain, use_cache = True, verbose = True)679 domain = pmesh_to_domain_instance(meshname, 680 Domain, use_cache = True, verbose = True) 614 681 \end{verbatim}} 615 682 … … 624 691 \code{Domain}.) 625 692 693 The following statements specify a basename and data directory, and 694 identify quantities to be stored. For the first two, values are 695 taken from \code{project.py}. 696 697 {\small \begin{verbatim} 698 domain.set_name(project.basename)% 699 domain.set_datadir(project.outputdir)% 700 domain.set_quantities_to_be_stored(['stage', 'xmomentum', 701 'ymomentum']) 702 \end{verbatim}} 703 704 626 705 \subsection{Specifying the Quantities} 627 Setting quantities for \code{run\_sydney\_smf.py} is accomplished 628 using similar methods to those used in \code{bedslope.py}. However,706 Quantities for \code{run\_sydney\_smf.py} are set 707 using similar methods to those in \code{bedslopephysical.py}. However, 629 708 in this case, many of the values are read from the auxiliary file 630 709 \code{project.py} or, in the case of \code{elevation}, from an … … 632 711 633 712 634 \subsubsection{Fundamental Quantities}635 636 The following statements specify a basename and data directory, and637 identify quantities to be stored. For the first two, values are638 taken from \code{project.py}.639 640 {\small \begin{verbatim} domain.set_name(project.basename)641 domain.set_datadir(project.outputdir)642 domain.set_quantities_to_be_stored(['stage', 'xmomentum',643 'ymomentum'])644 \end{verbatim}}645 713 646 714 \subsubsection{Stage} … … 649 717 object \code{tsunami\_source}, assigned by means of a function 650 718 \code{slump\_tsunami}. This is similar to how we set elevation in 651 \code{bedslope.py} using a function---however, in this case the 652 function is both more complex and more interesting. 653 654 {\small \begin{verbatim} 655 #------------------------------------------------------------------------------- 656 # Set up scenario (tsunami_source is a callable object used with 657 set_quantity) 658 #------------------------------------------------------------------------------- 659 660 tsunami_source = slump_tsunami(length=30000.0, 661 depth=400.0, 662 slope=6.0, 663 thickness=176.0, 664 radius=3330, 665 dphi=0.23, 666 x0=project.slump_origin[0], 667 y0=project.slump_origin[1], 668 alpha=0.0, 669 domain=domain) 670 671 672 #------------------------------------------------------------------------------- 673 # Set up initial conditions 674 #------------------------------------------------------------------------------- 675 676 domain.set_quantity('stage', tsunami_source) 677 \end{verbatim}} 719 \code{bedslopephysical.py} using a function---however, in this case the 720 function is both more complex and more interesting. 721 722 The function returns the water displacement for all \code{x} 723 and \code{y} in the domain. The water displacement is a ?? function that depends 724 on the characteristics of the slump (length, thickness, slope, etc), its 725 location (origin) and the depth at that location. 726 678 727 679 728 \subsubsection{Friction} 680 729 681 Assigning the friction is exactly parallel to what we did for 682 \code{bedslope.py}: 683 684 {\small \begin{verbatim} 685 domain.set_quantity('friction', 0.03) 686 #supplied by Benfield 730 We assign the friction exactly as we did for \code{bedslopephysical.py}: 731 732 {\small \begin{verbatim} 733 domain.set_quantity('friction', 0.03) 687 734 \end{verbatim}} 688 735 … … 690 737 \subsubsection{Elevation} 691 738 692 In this example, the elevation is specified by reading data from a 693 file. 694 695 {\small \begin{verbatim} 696 domain.set_quantity('elevation', 697 filename = project.combineddemname + '.pts', 698 use_cache = True, 699 verbose = True) 739 The elevation is specified by reading data from a file: 740 741 {\small \begin{verbatim}% 742 domain.set_quantity('elevation',% 743 filename = project.combineddemname + '.pts',% 744 use_cache = True,% 745 verbose = True)% 700 746 \end{verbatim}} 701 747 … … 724 770 \subsection{Boundary Conditions} 725 771 726 Setting boundaries in \code{run\_sydney\_smf.py} is very similar to 727 what we did in \code{bedslope.py}, except that we now have a larger 728 number of boundary tags: 729 730 {\small \begin{verbatim} 731 Br = Reflective_boundary(domain) 732 domain.set_boundary( {'bottom': Br, 'right1': Br, 'right0': Br, 733 'right2': Br, 'top': Br, 'left1': Br, 734 'left2': Br, 'left3': Br} ) 772 Setting boundaries follows a similar pattern to the one used for 773 \code{bedslopephysical.py}, except that in this case we need to associate a 774 boundary type with each of the 775 boundary tag names introduced when we established the mesh. In place of the four 776 boundary types introduced for \code{bedslopephysical.py}, we use the reflective 777 boundary for each of the 778 eight tagged segments: 779 780 {\small \begin{verbatim} 781 Br = Reflective_boundary(domain) 782 domain.set_boundary( {'bottom': Br, 'right1': Br, 'right0': Br, 783 'right2': Br, 'top': Br, 'left1': Br, 784 'left2': Br, 'left3': Br} ) 735 785 \end{verbatim}} 736 786 … … 738 788 739 789 With the basics established, the running of the `evolve' step is 740 very similar to the corresponding step in \code{bedslope .py}:741 742 {\small \begin{verbatim} 743 import time t0 = time.time()744 745 for t in domain.evolve(yieldstep = 120, duration = 18000):746 print domain.timestepping_statistics()747 print domain.boundary_statistics(tags = 'bottom')748 749 print 'That took %.2f seconds' %(time.time()-t0)790 very similar to the corresponding step in \code{bedslopephysical.py}: 791 792 {\small \begin{verbatim} 793 import time t0 = time.time() 794 795 for t in domain.evolve(yieldstep = 120, duration = 18000): 796 print domain.timestepping_statistics() 797 print domain.boundary_statistics(tags = 'bottom') 798 799 print 'That took %.2f seconds' %(time.time() 750 800 \end{verbatim}} 751 801 … … 777 827 introducing the code, between two sets of triple quotes. 778 828 779 Each paragraphalso describes the location of the module in which829 Each listing also describes the location of the module in which 780 830 the code for the feature being described can be found. All modules 781 are in the folder \code{inundation} or its subfolders, and the782 location of each module is described relative to this folder. Rather831 are in the folder \code{inundation} or one of its subfolders, and the 832 location of each module is described relative to \code{inundation}. Rather 783 833 than using pathnames, whose syntax depends on the operating system, 784 834 we use the format adopted for importing the function or class for … … 790 840 791 841 \begin{center} 792 \code{pmesh/mesh\_interface.py}842 \code{pmesh/mesh\_interface.py} 793 843 \end{center} 794 844 … … 796 846 797 847 \begin{center} 798 \code{pmesh}$\backslash$\code{mesh\_interface.py}848 \code{pmesh}$\backslash$\code{mesh\_interface.py} 799 849 \end{center} 800 850 … … 804 854 namely: 805 855 \begin{center} 806 \code{from pmesh.mesh\_interface import create\_mesh\_from\_regions}856 \code{from pmesh.mesh\_interface import create\_mesh\_from\_regions} 807 857 \end{center} 808 858 … … 820 870 Module: \code{pmesh.mesh\_interface} 821 871 872 % Translate following into layman's language 822 873 Creates a triangular mesh based on a bounding polygon and a number 823 874 of internal polygons. For each polygon the user specifies a … … 836 887 \code{file\_name} is the name of the mesh file to be converted, 837 888 including the extension. \code{DomainClass} is the class to be 838 returned, which must be a subclass of \code{Domain} , withthe same889 returned, which must be a subclass of \code{Domain} having the same 839 890 interface as \code{Domain}---in practice, it can usually be set 840 891 simply to \code{Domain}. … … 866 917 \section{Setting Quantities} 867 918 868 \begin{funcdesc}{set\_quantity}{name, *args, **kwargs} 869 Module: \code{pyvolution.domain} -- see also 870 \code{pyvolution.quantity.set_values} 919 \begin{funcdesc}{set\_quantity}{name, numeric = None, quantity = None, function = None, 920 geospatial_data = None, filename = None, attribute_name = None, 921 alpha = None, location = 'vertices', indices = None, verbose = False, 922 use_cache = False} 923 Module: \code{pyvolution.domain} (see also 924 \code{pyvolution.quantity.set_values}) 871 925 872 926 numeric:\\ … … 921 975 922 976 923 location: Where values are to be stored.924 Permissible options are: vertices, edges, centroids925 Default is 'vertices'926 927 In case of location == 'centroids' the dimension values must928 be a list of a Numerical array of length N,929 N being the number of elements.930 Otherwise it must be of dimension Nx3931 932 933 The values will be stored in elements following their934 internal ordering.935 936 If location is not 'unique vertices' Indices is the937 set of element ids that the operation applies to.938 If location is 'unique vertices' Indices is the set939 of vertex ids that the operation applies to.940 941 If selected location is vertices, values for942 centroid and edges will be assigned interpolated943 values. In any other case, only values for the944 specified locations will be assigned and the others945 will be left undefined.946 947 verbose: True means that output to stdout is generated948 949 use_cache: True means that caching of intermediate results is950 attempted for least squares fit.977 %location: Where values are to be stored. 978 % Permissible options are: vertices, edges, centroids 979 % Default is 'vertices' 980 981 % In case of location == 'centroids' the dimension values must 982 % be a list of a Numerical array of length N, 983 % N being the number of elements. 984 % Otherwise it must be of dimension Nx3 985 986 987 % The values will be stored in elements following their 988 % internal ordering. 989 990 % If location is not 'unique vertices' Indices is the 991 % set of element ids that the operation applies to. 992 % If location is 'unique vertices' Indices is the set 993 % of vertex ids that the operation applies to. 994 995 % If selected location is vertices, values for 996 % centroid and edges will be assigned interpolated 997 % values. In any other case, only values for the 998 % specified locations will be assigned and the others 999 % will be left undefined. 1000 1001 %verbose: True means that output to stdout is generated 1002 1003 %use_cache: True means that caching of intermediate results is 1004 % attempted for least squares fit. 951 1005 952 1006 Exactly one of the arguments … … 1174 1228 \section{Other} 1175 1229 1176 \begin{funcdesc}{domain.create_quantity_from_expression}{ }1177 1178 Handy for creating derived quantities on-the-fly 1179 See Analytical\_solution_\circular\_hydraulic\_jump.pyfor an example of use.1230 \begin{funcdesc}{domain.create_quantity_from_expression}{???} 1231 1232 Handy for creating derived quantities on-the-fly. 1233 See \code{Analytical\_solution\_circular\_hydraulic\_jump.py} for an example of use. 1180 1234 \end{funcdesc} 1181 1235
Note: See TracChangeset
for help on using the changeset viewer.