Changeset 2277


Ignore:
Timestamp:
Jan 25, 2006, 12:20:23 PM (19 years ago)
Author:
ole
Message:

Updated program example format

Location:
documentation
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • documentation/AnuGA_user_manual.tex

    r2274 r2277  
     1%\newcommand{\code}[1]{{\small \tt #1}} %For use with one-line code snippets
     2       
    13\documentclass{report}
     4
    25
    36\title{AnuGA User Manual}
     
    131134\verb+\\+\emph{s at the ends of lines!]}
    132135
    133 \begin{verbatim}
    134 from pyvolution.mesh_factory import rectangular \\
     136{\scriptsize \begin{verbatim}
     137from pyvolution.mesh_factory import rectangular
    135138from pyvolution.shallow_water import Domain, Reflective_boundary,
    136139     Dirichlet_boundary, Time_boundary, Transmissive_boundary
     
    139142points, vertices, boundary = rectangular(10,10)
    140143
    141 #Create shallow water domain \\
    142 domain = Domain(points, vertices,boundary) \\
     144#Create shallow water domain
     145domain = Domain(points, vertices,boundary)
    143146domain.smooth = False domain.visualise = False
    144147domain.store = True domain.filename = 'bedslope'
     
    157160
    158161
    159 # Boundary conditions \\
    160 from math import sin, pi \\
    161 Br = Reflective_boundary(domain)\\
    162 Bt = Transmissive_boundary(domain) \\
    163 Bd = Dirichlet_boundary([0.2,0.,0.])\\
     162# Boundary conditions
     163from math import sin, pi
     164Br = Reflective_boundary(domain)
     165Bt = Transmissive_boundary(domain)
     166Bd = Dirichlet_boundary([0.2,0.,0.])
    164167
    165168Bw = Time_boundary(domain=domain,
     
    167170
    168171
    169 domain.set_boundary({'left': Bd, 'right': Br, 'top': Br, 'bottom':
    170 Br}) \\
    171 #domain.set_boundary({'left': Bw, 'right': Br, 'top': Br,
    172 'bottom': Br})
    173 
    174 
    175 ###################### \\
     172domain.set_boundary({'left': Bd, 'right': Br, 'top': Br, 'bottom': Br})
     173
     174
     175######################
    176176#Evolution
    177177
     
    182182
    183183
    184 \end{verbatim}
     184\end{verbatim}}
    185185
    186186
     
    190190scenario. This is carried out through the statement:
    191191
    192 \begin{verbatim}
     192{\small \begin{verbatim}
    193193    points, vertices, boundary = rectangular(10, 10) .
    194 \end{verbatim}
     194\end{verbatim}}
    195195
    196196The function \texttt{rectangular} is imported from a module
     
    201201specific way. In general, the assignment
    202202
    203 \begin{verbatim}
     203{\small \begin{verbatim}
    204204    points, vertices, boundary = rectangular(m, n)
    205 \end{verbatim}
     205\end{verbatim}}
    206206
    207207returns:
     
    230230\texttt{domain}, through the assignment:
    231231
    232 \begin{verbatim}
     232{\small \begin{verbatim}
    233233    domain = Domain(points, vertices, boundary)
    234 \end{verbatim}
     234\end{verbatim}}
    235235
    236236This uses a Python class \texttt{Domain}, imported from
     
    242242of what these do]}
    243243
    244 \begin{verbatim}
     244{\scriptsize \begin{verbatim}
    245245    domain.smooth = False
    246246    domain.visualise = False
     
    248248    domain.filename = 'bedslope'
    249249    domain.default_order = 2
    250 \end{verbatim}
     250\end{verbatim}}
    251251
    252252
     
    271271purposes:
    272272
    273 \begin{verbatim}
     273{\small \begin{verbatim}
    274274    \# Initial conditions
    275275    def f(x,y):
    276276        return -x/2
    277 \end{verbatim}
     277\end{verbatim}}
    278278
    279279This simply associates an elevation with each point $(x, y)$ of
     
    285285\texttt{elevation} is assigned through the simple statement:
    286286
     287{\small \begin{verbatim}
    287288\begin{verbatim}
    288289    domain.set_quantity('elevation', f)
    289 \end{verbatim}
     290\end{verbatim}}
    290291
    291292
     
    296297assign them to a constant numerical value:
    297298
    298 \begin{verbatim}
     299{\small \begin{verbatim}
    299300    domain.set_quantity('friction', 0.1)
    300 \end{verbatim}
     301\end{verbatim}}
    301302
    302303This just specifies that the Manning friction coefficient is set
     
    309310quantities:
    310311
    311 \begin{verbatim}
     312{\small \begin{verbatim}
    312313    h = 0.05 \# Constant depth
    313314    domain.set_quantity('stage', expression = 'elevation + %f' %h)
    314 \end{verbatim}
     315\end{verbatim}}
    315316
    316317Here the quantity \texttt{stage} is defined by taking the quantity
     
    324325The boundary conditions are specified as follows:
    325326
    326 \begin{verbatim}
     327{\small \begin{verbatim}
    327328    Br = Reflective_boundary(domain)
    328329
     
    333334    Bw = Time_boundary(domain=domain,
    334335                f=lambda t: [(0.1*sin(t*2*pi)), 0.0, 0.0])
    335 \end{verbatim}
     336\end{verbatim}}
    336337
    337338The effect of these statements is to set up four alternative
     
    359360form
    360361
    361 \begin{verbatim}
    362     domain.set_boundary({'left': Bd, 'right': Br, 'top': Br, 'bottom':
    363 Br})
    364 \end{verbatim}
     362{\small \begin{verbatim}
     363    domain.set_boundary({'left': Bd, 'right': Br, 'top': Br, 'bottom': Br})
     364\end{verbatim}}
    365365
    366366This statement stipulates that, in the current example, the left
     
    372372
    373373The final statement \nopagebreak[3]
    374 \begin{verbatim}
     374{\small \begin{verbatim}
    375375    for t in domain.evolve(yieldstep = 0.1, finaltime = 4.0):
    376376        domain.write_time()
    377 \end{verbatim}
     377\end{verbatim}}
    378378
    379379is the key step that causes the configuration of the domain to
Note: See TracChangeset for help on using the changeset viewer.