Changeset 2474
- Timestamp:
- Mar 3, 2006, 10:57:05 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
documentation/user_manual/anuga_user_manual.tex
r2467 r2474 703 703 \chapter{\anuga Public Interface} 704 704 705 This chapter describes the features of \anuga that are available to 706 the user at the public interface. 705 This chapter gives an overview of the features of \anuga available 706 to the user at the public interface. These are grouped under the 707 following headings: 708 709 \begin{itemize} 710 \item Functions and Classes 711 \item Diagnostics 712 \item Boundary Conditions 713 \item Initial Conditions 714 \item Forcing Functions. 715 \end{itemize} 716 717 The listings do not give full specifications of the features, for 718 which the reader may consult the docstrings provided in the code. 719 They are intended merely to give the reader an idea of what each 720 feature is and how it can be used. 707 721 708 722 \section{Functions and Classes} 709 723 710 \indexedcodeheader{create\_mesh\_from\_regions}\label{codehdr:createmeshfromregions}711 712 Creates a triangular mesh based on a bounding polygon and713 a number of internal polygons. For each polygon the user specifies a resolution---that is, the maximal area714 of triangles in the mesh. The bounding polygon also has symbolic \code{tags} associated with it.715 716 \textbf{Arguments:}717 718 \begin{itemize}719 \item the bounding polygon, %do we need to spell out how a polygon is specified?720 \item a dictionary of boundary tags, for all segments of the bounding polygon,721 \emph{[not clear what the keys and values of this dictionary are]}722 \item the resolution for the bounding polygon,723 \item (optional) a filename, \emph{[what is the file for?]}724 \item a list of 2-tuples \code{(polygon, resolution)}, specifying the interior polygons and725 their associated resolutions.726 \end{itemize}727 728 *********************************************************************************************729 730 \emph{\textbf{[The following is how the description of731 \emph{\code{create\_mesh\_from\_regions}} would be presented using732 the Python documentation system's \emph{\code{funcdesc}} environment733 for describing a module-level function.]}}724 %\indexedcodeheader{create\_mesh\_from\_regions}\label{codehdr:createmeshfromregions} 725 726 % Creates a triangular mesh based on a bounding polygon and 727 % a number of internal polygons. For each polygon the user specifies a resolution---that is, the maximal area 728 % of triangles in the mesh. The bounding polygon also has symbolic \code{tags} associated with it. 729 730 % \textbf{Arguments:} 731 732 % \begin{itemize} 733 % \item the bounding polygon, %do we need to spell out how a polygon is specified? 734 % \item a dictionary of boundary tags, for all segments of the bounding polygon, 735 % \emph{[not clear what the keys and values of this dictionary are]} 736 % \item the resolution for the bounding polygon, 737 % \item (optional) a filename, \emph{[what is the file for?]} 738 % \item a list of 2-tuples \code{(polygon, resolution)}, specifying the interior polygons and 739 % their associated resolutions. 740 % \end{itemize} 741 742 %********************************************************************************************* 743 744 %\emph{\textbf{[The following is how the description of 745 %\emph{\code{create\_mesh\_from\_regions}} would be presented using 746 %the Python documentation system's \emph{\code{funcdesc}} environment 747 %for describing a module-level function.]}} 734 748 735 749 \begin{funcdesc} {create\_mesh\_from\_regions}{bounding_polygon, … … 747 761 \end{funcdesc} 748 762 749 *********************************************************************************************750 751 \indexedcodeheader{pmesh\_to\_domain\_instance} \nopagebreak752 753 Converts a generated mesh file to a domain object.754 755 \textbf{Arguments:}756 757 \begin{itemize}758 \item \code{file\_name} is the name of the mesh file to convert, including the extension759 \item \code{DomainClass} is the Class that will be returned.760 It must be a subclass of \code{Domain}, with the same interface as761 domain. In practice, it can usually be set simply to762 \code{Domain}.763 \item \code{use\_cache}: \code{True} means that caching is attempted for the computed domain.764 \end{itemize}765 766 767 \begin{itemize}768 \item Mesh file name769 \item Class name, specifying the domain class to be instantiated.770 \end{itemize}771 772 *********************************************************************************************763 %********************************************************************************************* 764 765 %\indexedcodeheader{pmesh\_to\_domain\_instance} \nopagebreak 766 767 % Converts a generated mesh file to a domain object. 768 769 % \textbf{Arguments:} 770 771 % \begin{itemize} 772 % \item \code{file\_name} is the name of the mesh file to convert, including the extension 773 % \item \code{DomainClass} is the Class that will be returned. 774 % It must be a subclass of \code{Domain}, with the same interface as 775 % domain. In practice, it can usually be set simply to 776 % \code{Domain}. 777 % \item \code{use\_cache}: \code{True} means that caching is attempted for the computed domain. 778 % \end{itemize} 779 780 781 % \begin{itemize} 782 % \item Mesh file name 783 % \item Class name, specifying the domain class to be instantiated. 784 % \end{itemize} 785 % 786 %********************************************************************************************* 773 787 774 788 \begin{funcdesc} {pmesh\_to\_domain\_instance}{file_name, DomainClass, use_cache = False, verbose = False} 775 789 Converts a generated mesh file to a domain object. 776 790 777 \begin{itemize} 778 \item \code{file\_name} is the name of the mesh file to convert, including the extension 779 \item \code{DomainClass} is the Class that will be returned. 780 It must be a subclass of \code{Domain}, with the same interface as 781 domain. In practice, it can usually be set simply to 782 \code{Domain}. 783 \item \code{use\_cache}: \code{True} means that caching is attempted for the computed domain. 784 \end{itemize} 791 \code{file\_name} is the name of the mesh file to convert, including 792 the extension. \code{DomainClass} is the class to be returned, which 793 must be a subclass of \code{Domain}, with the same interface as 794 \code{Domain}---in practice, it can usually be set simply to 795 \code{Domain}. 796 785 797 \end{funcdesc} 786 *********************************************************************************************798 %********************************************************************************************* 787 799 788 800 789 801 %\indexedcodeheader{file\_function} %in util.py "High priority" 790 802 791 Reads the time history of spatial data from NetCDF file and returns a callable object.792 793 \textbf{Arguments:}794 795 \code{filename} -- Name of \code{sww} or \code{tms} file (see796 Section \ref{sec:file formats} on page \pageref{sec:file formats}797 for details about file formats).798 799 \begin{quote}800 If the file has extension \code{sww} then it is assumed to be spatio-temporal801 or temporal and the callable object will have the form \code{f(t,x,y)} or \code{f(t)}802 depending on whether the file contains spatial data.803 804 If the file has extension \code{tms} then it is assumed to be temporal only805 and the callable object will have the form \code{f(t)}.806 807 Either form will return interpolated values based on the input file808 using the underlying \code{interpolation\_function}.809 \end{quote}810 811 \code{domain} -- Associated domain object812 If domain is specified, model time (\code{domain.starttime})813 will be checked and possibly modified.814 815 \begin{quote}816 All times are assumed to be in UTC.817 818 All spatial information is assumed to be in absolute UTM coordinates.819 \end{quote}820 821 \code{quantities} -- the name of the quantity to be interpolated or a822 list of quantity names. The resulting function will return823 a tuple of values -- one for each quantity.824 825 \code{interpolation\_points} -- list of absolute UTM coordinates for points at826 which values are sought827 828 \code{use\_cache}: \code{True} means that caching of intermediate result of829 \code{Interpolation\_function} is attempted803 % Reads the time history of spatial data from NetCDF file and returns a callable object. 804 805 % \textbf{Arguments:} 806 807 % \code{filename} -- Name of \code{sww} or \code{tms} file (see 808 % Section \ref{sec:file formats} on page \pageref{sec:file formats} 809 % for details about file formats). 810 811 % \begin{quote} 812 % If the file has extension \code{sww} then it is assumed to be spatio-temporal 813 % or temporal and the callable object will have the form \code{f(t,x,y)} or \code{f(t)} 814 % depending on whether the file contains spatial data. 815 816 % If the file has extension \code{tms} then it is assumed to be temporal only 817 % and the callable object will have the form \code{f(t)}. 818 819 % Either form will return interpolated values based on the input file 820 % using the underlying \code{interpolation\_function}. 821 % \end{quote} 822 823 % \code{domain} -- Associated domain object 824 % If domain is specified, model time (\code{domain.starttime}) 825 % will be checked and possibly modified. 826 827 % \begin{quote} 828 % All times are assumed to be in UTC. 829 830 % All spatial information is assumed to be in absolute UTM coordinates. 831 % \end{quote} 832 833 % \code{quantities} -- the name of the quantity to be interpolated or a 834 % list of quantity names. The resulting function will return 835 % a tuple of values -- one for each quantity. 836 837 % \code{interpolation\_points} -- list of absolute UTM coordinates for points at 838 % which values are sought 839 840 % \code{use\_cache}: \code{True} means that caching of intermediate result of 841 % \code{Interpolation\_function} is attempted 830 842 831 843 … … 839 851 Reads the time history of spatial data from NetCDF file and returns a callable object. Returns 840 852 interpolated values based on the input file 841 using the underlying \code{interpolation\_function}. 842 843 \code{quantities} -- the name of the quantity to be interpolated or a 844 list of quantity names. The resulting function will return 845 a tuple of values -- one for each quantity. 846 847 \code{interpolation\_points} -- list of absolute UTM coordinates for points at 848 which values are sought 849 850 \code{use\_cache}: \code{True} means that caching of intermediate result of 851 \code{Interpolation\_function} is attempted 853 using the underlying \code{interpolation\_function}. 854 855 \code{quantities} is either the name of a single quantity to be interpolated or a 856 list of such quantity names. The resulting function will return 857 a tuple of values---one for each quantity. 858 859 \code{interpolation\_points} is a list of absolute UTM coordinates for points at 860 which values are sought. 861 852 862 \end{funcdesc} 853 863 854 864 855 865 % See Interpolation function for further documentation 856 \indexedcodeheader{Interpolation\_function} 857 Creates a callable object \code{f(t, id)} or \code{f(t,x,y)} 858 which is interpolated from time series defined at vertices of 859 triangular mesh (such as those stored in \code{sww} files). 860 861 Let $m$ be the number of vertices, $n$ the number of triangles 862 and $p$ the number of time steps. 863 864 \textbf{Mandatory Arguments:} 865 866 \begin{tabular}{ll} 867 \code{time}: & $p \times 1$ array of monotonously increasing times (Float)\\ 868 869 \code{quantities}: & Dictionary of arrays or one array (Float). The arrays must \\ 870 & have dimensions either $p \times m$ or $m \times 1$. The resulting function \\ 871 & will be time dependent in the former case and constant with respect to time \\ 872 & in the latter case.\\ 873 \end{tabular} 874 875 876 \textbf{Optional Arguments:} 877 878 \begin{tabular}{ll} 879 \code{quantity\_names}: & List of keys into the quantities dictionary\\ 880 881 \code{vertex\_coordinates}: & $m \times 2$ array of coordinates (Float)\\ 882 883 \code{triangles}: & $n \times 3$ array of indices into \code{vertex\_coordinates} (Int)\\ 884 885 \code{interpolation\_points}: & $N \times 2$ array of coordinates to be interpolated to \\ 886 887 \code{verbose}: & Level of reporting\\ 888 \end{tabular} 889 890 The quantities returned by the callable object are specified by 891 the list quantities which must contain the names of the 892 quantities to be returned and also reflect the order, e.g. for 893 the shallow water wave equation, one would have 894 \code{quantities = ['stage', 'xmomentum', 'ymomentum']}. 895 896 The parameter \code{interpolation_points} decides at which points interpolated 866 %\indexedcodeheader{Interpolation\_function} 867 % Creates a callable object \code{f(t, id)} or \code{f(t,x,y)} 868 % interpolated from a time series defined at the vertices of 869 % a triangular mesh (such as those stored in \code{sww} files). 870 871 % Let $m$ be the number of vertices, $n$ the number of triangles 872 % and $p$ the number of time steps. 873 874 % \textbf{Mandatory Arguments:} 875 876 % \begin{tabular}{ll} 877 % \code{time}: & $p \times 1$ array of monotonously increasing times (Float)\\ 878 879 880 % \code{quantities}: & Dictionary of arrays or one array (Float). The arrays must \\ 881 % & have dimensions either $p \times m$ or $m \times 1$. The resulting function \\ 882 % & will be time dependent in the former case and constant with respect to time \\ 883 % & in the latter case.\\ 884 % \end{tabular} 885 886 887 % \textbf{Optional Arguments:} 888 889 % \begin{tabular}{ll} 890 % \code{quantity\_names}: & List of keys into the quantities dictionary\\ 891 892 % \code{vertex\_coordinates}: & $m \times 2$ array of coordinates (Float)\\ 893 894 % \code{triangles}: & $n \times 3$ array of indices into \code{vertex\_coordinates} (Int)\\ 895 896 % \code{interpolation\_points}: & $N \times 2$ array of coordinates to be interpolated to \\ 897 898 % \code{verbose}: & Level of reporting\\ 899 % \end{tabular} 900 901 % The quantities returned by the callable object are specified by 902 % the list \code{quantities} which must contain the names of the 903 % quantities to be returned and also reflect the order, e.g. for 904 % the shallow water wave equation, one would have 905 % \code{quantities = ['stage', 'xmomentum', 'ymomentum']}. 906 907 % The parameter \code{interpolation_points} decides at which points interpolated 908 % quantities are to be computed whenever the object is called. 909 % If \code{None}, returns average value. 910 911 \begin{classdesc}{Interpolation_function}{self, 912 time, 913 quantities, 914 quantity_names = None, 915 vertex_coordinates = None, 916 triangles = None, 917 interpolation_points = None, 918 verbose = False} 919 Creates a callable object \code{f(t, id)} or \code{f(t,x,y)} 920 interpolated from a time series defined at the vertices of a 921 triangular mesh (such as those stored in \code{sww} files). 922 923 \code{time} is an array of monotonically increasing times and 924 \code{quantities} is an array, or dictionary of arrays, of values to 925 be interpolated. The parameter \code{interpolation_points} may be 926 used to specify at which points interpolated 897 927 quantities are to be computed whenever the object is called. 898 If \code{None}, returns average value. 899 900 901 \indexedcodeheader{set\_region} ``Low priority. Will be merged into 902 set\_quantity'' 903 904 \indexedcodeheader{set\_quantity} ``Pretty mature'' 905 906 \indexedcodeheader{set\_boundary} ``Pretty mature'' 907 928 If the default value \code{None} is used, returns average value. 929 \end{classdesc} 930 931 932 \begin{funcdesc}{set\_region}{???} 933 [Low priority. Will be merged into set\_quantity] 934 \end{funcdesc} 935 936 \begin{funcdesc}{set\_quantity}{???} 937 [Pretty mature] 938 \end{funcdesc} 939 940 \begin{funcdesc}{set\_boundary}{???} 941 [Pretty mature] 942 \end{funcdesc} 908 943 909 944 910 945 911 946 \section{Diagnostics} 912 \begin{itemize} 913 \item \indexedcode{write\_time} 914 \item \indexedcode{write\_boundary\_statistics} 915 916 917 \end{itemize} 947 948 \begin{funcdesc}{write\_time}{???} 949 950 \end{funcdesc} 951 952 953 \begin{funcdesc}{write\_boundary\_statistics}{???} 954 955 \end{funcdesc} 956 918 957 919 958 … … 921 960 922 961 \anuga provides a large number of predefined boundary conditions to 923 be used with \code{set\_boundary} 924 925 What do they do 926 How are they used 927 928 \begin{itemize} 929 \item \indexedcode{Reflective_boundary} 930 function, arguments 931 932 \item \indexedcode{Transmissive_boundary} 933 function, arguments, CAVEATS 934 935 \item \indexedcode{Dirichlet_boundary} 936 937 \item \indexedcode{Time_boundary} 938 939 \item \indexedcode{File_boundary} 940 Based on File\_function 941 942 \item \indexedcode{} 943 944 \item \indexedcode{} 945 946 \item \indexedcode{User defined boundary conditions.} 947 How to roll your own 948 \end{itemize} 962 be used with \code{set\_boundary}. 963 964 \subsection{Predefined boundary conditions} 965 966 \begin{classdesc}{Reflective_boundary}{Boundary} 967 Reflective boundary returns same conserved quantities as those present in 968 the neighbouring volume but reflected. 969 970 This class is specific to the shallow water equation as it works with the 971 momentum quantities assumed to be the second and third conserved quantities. 972 \end{classdesc} 973 974 975 \begin{classdesc}{Transmissive_boundary}{domain = None} 976 A transmissive boundary returns the same conserved quantities as 977 those present in the neighbouring volume. 978 979 The underlying domain must be specified when the boundary is instantiated. 980 \end{classdesc} 981 982 983 \begin{classdesc}{Dirichlet_boundary}{conserved_quantities=None} 984 A Dirichlet boundary returns constant values for the conserved 985 quantities. 986 \end{classdesc} 987 988 989 \begin{classdesc}{Time_boundary}{domain = None, f = None} 990 A time-dependent boundary returns values for the conserved quantities as a 991 function \code{f(t)} of time. The user must specify the domain to get access to the model 992 time. 993 \end{classdesc} 994 995 996 \begin{classdesc}{File_boundary}{Boundary} 997 The boundary values are obtained from a file and interpolated. The file is 998 assumed to contain a time series and possibly also spatial information. 999 The conserved quantities are given as a function of time. 1000 \end{classdesc} 1001 1002 1003 \subsection{User-defined boundary conditions} 1004 [How to roll your own] 949 1005 950 1006 … … 955 1011 \code{set_quantity}. 956 1012 957 \begin{itemize} 958 959 960 \item \indexedcode{tsunami_slump} 961 function, arguments 962 963 \item \indexedcode{} 964 965 \end{itemize} 966 1013 \begin{funcdesc}{tsunami_slump}{length, depth, slope, width=None, thickness=None, \ 1014 x0=0.0, y0=0.0, alpha=0.0, \ 1015 gravity=9.8, gamma=1.85, \ 1016 massco=1, dragco=1, frictionco=0, psi=0, \ 1017 dx=None, kappa=3.0, kappad=0.8, zsmall=0.01, \ 1018 domain=None, 1019 verbose=False} 1020 This function returns a callable object representing an initial water 1021 displacement generated by a submarine sediment slide. 1022 1023 The arguments include the downslope slide length, the water depth to the slide centre of mass, 1024 and the bathymetric slope. 1025 \end{funcdesc} 967 1026 968 1027 \section{Forcing Functions} … … 970 1029 \anuga provides a number of predefined forcing functions to be used with ..... 971 1030 972 \begin{itemize} 973 974 975 \item \indexedcode{} 976 function, arguments 977 978 \item \indexedcode{} 979 980 \end{itemize} 981 982 983 1031 %\begin{itemize} 1032 1033 1034 % \item \indexedcode{} 1035 % [function, arguments] 1036 1037 % \item \indexedcode{} 1038 1039 %\end{itemize} 1040 1041 1042 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1043 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 984 1044 985 1045 \chapter{\anuga System Architecture} … … 1307 1367 \chapter{Glossary} 1308 1368 1309 \indexplacer{try it} \indexascode{try it out again}1310 1311 1369 \begin{itemize} 1312 1370 \item \indexedbold{\anuga} Name of software (joint development between ANU and GA)
Note: See TracChangeset
for help on using the changeset viewer.