Index: /trunk/anuga_core/demos/channel1.py
===================================================================
--- /trunk/anuga_core/demos/channel1.py	(revision 8973)
+++ /trunk/anuga_core/demos/channel1.py	(revision 8974)
@@ -7,16 +7,13 @@
 # Import necessary modules
 #------------------------------------------------------------------------------
-
-# Import standard shallow water domain and standard boundaries.
 import anuga
-
 
 #------------------------------------------------------------------------------
 # Setup computational domain
 #------------------------------------------------------------------------------
-points, vertices, boundary = anuga.rectangular_cross(10, 5,
-                                               len1=10.0, len2=5.0) # Mesh
+# Create a domain with named boundaries "left", "right", "top" and "bottom"
+domain = anuga.rectangular_cross_domain(10, 5, len1=10.0, len2=5.0) # Create domain
 
-domain = anuga.Domain(points, vertices, boundary)  # Create domain
+
 domain.set_name('channel1')                  # Output name
 
@@ -44,4 +41,4 @@
 #------------------------------------------------------------------------------
 for t in domain.evolve(yieldstep=0.2, finaltime=40.0):
-    print domain.timestepping_statistics()
+    domain.print_timestepping_statistics()
 
Index: /trunk/anuga_core/source/anuga/__init__.py
===================================================================
--- /trunk/anuga_core/source/anuga/__init__.py	(revision 8973)
+++ /trunk/anuga_core/source/anuga/__init__.py	(revision 8974)
@@ -66,5 +66,5 @@
 
 #-----------------------------
-# Standard Boundaries
+# SwW Standard Boundaries
 #-----------------------------
 from anuga.shallow_water.boundaries import File_boundary
@@ -82,5 +82,5 @@
 
 #-----------------------------
-# SWW-specific Boundaries
+# General Boundaries
 #-----------------------------
 from anuga.abstract_2d_finite_volumes.generic_boundary_conditions \
@@ -96,5 +96,5 @@
 
 #-----------------------------
-# Shalow Water Tsunamis
+# Shallow Water Tsunamis
 #-----------------------------
 
@@ -106,4 +106,6 @@
 #-----------------------------
 from anuga.shallow_water.forcing import Inflow, Rainfall, Wind_stress
+
+
 
 #-----------------------------
@@ -140,4 +142,6 @@
 from anuga.operators.base_operator import Operator
 from anuga.operators.kinematic_viscosity_operator import Kinematic_viscosity_operator
+from anuga.operators.rate_operators import Rate_operator
+from anuga.operators.set_friction_operators import Depth_friction_operator 
 
 #---------------------------
@@ -371,9 +375,5 @@
 import time
 from os.path import join
-from scipy import interpolate
+
 from anuga import indent
 from anuga.utilities.model_tools import read_polygon_dir, read_hole_dir, read_multi_poly_file, read_multi_poly_file_value
-from anuga.operators.rate_operators import Rate_operator, Polygonal_rate_operator
-from anuga.operators.set_friction_operators import Depth_friction_operator 
-from anuga.structures.boyd_box_operator import Boyd_box_operator
-from anuga.structures.boyd_pipe_operator import Boyd_pipe_operator
Index: /trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/file_function.py
===================================================================
--- /trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/file_function.py	(revision 8973)
+++ /trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/file_function.py	(revision 8974)
@@ -179,15 +179,21 @@
                'First argument to File_function must be a string'
 
-    try:
-        fid = open(filename)
-    except IOError, e:
-        msg = 'File "%s" could not be opened: Error="%s"' % (filename, e)
-        raise IOError(msg)
-
+    #try:
+    #    fid = open(filename)
+    #except IOError, e:
+    #    msg = 'File "%s" could not be opened: Error="%s"' % (filename, e)
+    #    raise IOError(msg)
+    
     # read first line of file, guess file type
-    line = fid.readline()
-    fid.close()
-
-    if line[:3] == 'CDF':
+    #line = fid.readline()
+    #fid.close()
+        
+    import os
+    ext = os.path.splitext(filename)[1]
+    msg = 'Extension should be csv  sww, tms or sts '
+    assert ext in [".csv",  ".sww", ".tms", ".sts"], msg
+
+
+    if ext in [".sww", ".tms", ".sts"]:
         return get_netcdf_file_function(filename,
                                         quantities,
@@ -199,8 +205,11 @@
                                         boundary_polygon=boundary_polygon,
                                         output_centroids=output_centroids)
-    else:
+    elif ext in [".csv"]:
         # FIXME (Ole): Could add csv file here to address Ted Rigby's
         # suggestion about reading hydrographs.
-        # This may also deal with the gist of ticket:289 
+        # This may also deal with the gist of ticket:289
+        raise Exception('Must be a NetCDF File') 
+    else:
+
         raise Exception('Must be a NetCDF File')
 
Index: /trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/quantity.py
===================================================================
--- /trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/quantity.py	(revision 8973)
+++ /trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/quantity.py	(revision 8974)
@@ -1257,13 +1257,13 @@
         points = ensure_absolute(points, geo_reference=self.domain.geo_reference)
             
-        print numpy.max(points[:,0])
-        print numpy.min(points[:,0])
-        print numpy.max(points[:,1])
-        print numpy.min(points[:,1])
-        
-        print numpy.max(x)
-        print numpy.min(x)
-        print numpy.max(y)
-        print numpy.min(y)
+#         print numpy.max(points[:,0])
+#         print numpy.min(points[:,0])
+#         print numpy.max(points[:,1])
+#         print numpy.min(points[:,1])
+#         
+#         print numpy.max(x)
+#         print numpy.min(x)
+#         print numpy.max(y)
+#         print numpy.min(y)
         
         
Index: /trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/test_quantity.py
===================================================================
--- /trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/test_quantity.py	(revision 8973)
+++ /trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/test_quantity.py	(revision 8974)
@@ -1388,4 +1388,29 @@
 
     def test_set_values_from_asc_vertices(self):
+        
+        
+        
+
+
+        x0 = 0.0
+        y0 = 0.0
+
+        a = [0.0, 0.0]
+        b = [0.0, 2.0]
+        c = [2.0, 0.0]
+        d = [0.0, 4.0]
+        e = [2.0, 2.0]
+        f = [4.0, 0.0]
+
+        points = [a, b, c, d, e, f]
+
+        #bac, bce, ecf, dbe
+        elements = [ [1,0,2], [1,2,4], [4,2,5], [3,1,4] ]
+
+        mesh4 = Generic_Domain(points, elements)
+                     #  geo_reference = Geo_reference(56, x0, y0))
+        mesh4.check_integrity()
+        quantity = Quantity(mesh4)
+
         """ Format of asc file 
         ncols         11
@@ -1396,28 +1421,4 @@
         NODATA_value  -9999
         """
-
-        #x0 = 314036.58727982
-        #y0 = 6224951.2960092
-        x0 = 0.0
-        y0 = 0.0
-
-        a = [0.0, 0.0]
-        b = [0.0, 2.0]
-        c = [2.0, 0.0]
-        d = [0.0, 4.0]
-        e = [2.0, 2.0]
-        f = [4.0, 0.0]
-
-        points = [a, b, c, d, e, f]
-
-        #bac, bce, ecf, dbe
-        elements = [ [1,0,2], [1,2,4], [4,2,5], [3,1,4] ]
-
-        mesh4 = Generic_Domain(points, elements)
-                     #  geo_reference = Geo_reference(56, x0, y0))
-        mesh4.check_integrity()
-        quantity = Quantity(mesh4)
-
-
         ncols = 11  # Nx
         nrows = 12  # Ny
Index: /trunk/anuga_core/source/anuga/config.py
===================================================================
--- /trunk/anuga_core/source/anuga/config.py	(revision 8973)
+++ /trunk/anuga_core/source/anuga/config.py	(revision 8974)
@@ -223,4 +223,7 @@
 netcdf_mode_a = 'a'
 netcdf_mode_r = 'r'
+
+
+indent = '    '
 
 # Code to set the write mode depending on
Index: /trunk/anuga_core/source/anuga/operators/rate_operators.py
===================================================================
--- /trunk/anuga_core/source/anuga/operators/rate_operators.py	(revision 8973)
+++ /trunk/anuga_core/source/anuga/operators/rate_operators.py	(revision 8974)
@@ -11,5 +11,5 @@
 
 
-from anuga import indent
+from anuga.config import indent
 import numpy as num
 import anuga.utilities.log as log
Index: /trunk/anuga_core/source/anuga/operators/set_elevation.py
===================================================================
--- /trunk/anuga_core/source/anuga/operators/set_elevation.py	(revision 8973)
+++ /trunk/anuga_core/source/anuga/operators/set_elevation.py	(revision 8974)
@@ -17,6 +17,5 @@
 
 from anuga.operators.set_quantity import Set_quantity
-
-from anuga import indent
+from anuga.config import indent
 
 class Set_elevation(Set_quantity):
Index: /trunk/anuga_core/source/anuga/operators/set_elevation_operator.py
===================================================================
--- /trunk/anuga_core/source/anuga/operators/set_elevation_operator.py	(revision 8973)
+++ /trunk/anuga_core/source/anuga/operators/set_elevation_operator.py	(revision 8974)
@@ -13,5 +13,5 @@
 from anuga.operators.set_elevation import Set_elevation
 
-from anuga import indent
+from anuga.config import indent
 
 
Index: /trunk/anuga_core/source/anuga/operators/set_friction_operators.py
===================================================================
--- /trunk/anuga_core/source/anuga/operators/set_friction_operators.py	(revision 8973)
+++ /trunk/anuga_core/source/anuga/operators/set_friction_operators.py	(revision 8974)
@@ -15,7 +15,5 @@
 from anuga.operators.base_operator import Operator
 from anuga.operators.region import Region
-
-
-from anuga import indent
+from anuga.config import indent
 
 
Index: /trunk/anuga_core/source/anuga/operators/set_quantity.py
===================================================================
--- /trunk/anuga_core/source/anuga/operators/set_quantity.py	(revision 8973)
+++ /trunk/anuga_core/source/anuga/operators/set_quantity.py	(revision 8974)
@@ -17,5 +17,5 @@
 from anuga.utilities.function_utils import determine_function_type
 from anuga.operators.region import Region
-from anuga import indent
+from anuga.config import indent
 
 class Set_quantity(Region):
Index: /trunk/anuga_core/source/anuga/operators/set_quantity_operator.py
===================================================================
--- /trunk/anuga_core/source/anuga/operators/set_quantity_operator.py	(revision 8973)
+++ /trunk/anuga_core/source/anuga/operators/set_quantity_operator.py	(revision 8974)
@@ -13,6 +13,5 @@
 from anuga.operators.base_operator import Operator
 from anuga.operators.set_quantity import Set_quantity
-
-from anuga import indent
+from anuga.config import indent
 
 
Index: /trunk/anuga_core/source/anuga/operators/set_stage_operator.py
===================================================================
--- /trunk/anuga_core/source/anuga/operators/set_stage_operator.py	(revision 8973)
+++ /trunk/anuga_core/source/anuga/operators/set_stage_operator.py	(revision 8974)
@@ -18,7 +18,5 @@
 
 from anuga.operators.set_quantity_operator import Set_quantity_operator
-
-
-from anuga import indent
+from anuga.config import indent
 
 
Index: /trunk/anuga_core/source/anuga/operators/set_w_uh_vh_operators.py
===================================================================
--- /trunk/anuga_core/source/anuga/operators/set_w_uh_vh_operators.py	(revision 8973)
+++ /trunk/anuga_core/source/anuga/operators/set_w_uh_vh_operators.py	(revision 8974)
@@ -20,5 +20,5 @@
 from anuga.fit_interpolate.interpolate import Modeltime_too_early, \
                                               Modeltime_too_late
-from anuga import indent
+from anuga.config import indent
 
 
Index: /trunk/anuga_core/source/anuga/structures/test_inlet_operator.py
===================================================================
--- /trunk/anuga_core/source/anuga/structures/test_inlet_operator.py	(revision 8973)
+++ /trunk/anuga_core/source/anuga/structures/test_inlet_operator.py	(revision 8974)
@@ -299,5 +299,5 @@
 # =========================================================================
 if __name__ == "__main__":
-    suite = unittest.makeSuite(Test_inlet_operator, 'test_inlet_constant_Q_polygon')
+    suite = unittest.makeSuite(Test_inlet_operator, 'test')
     runner = unittest.TextTestRunner()
     runner.run(suite)
Index: /trunk/anuga_core/source/anuga/version.py
===================================================================
--- /trunk/anuga_core/source/anuga/version.py	(revision 8973)
+++ /trunk/anuga_core/source/anuga/version.py	(revision 8974)
@@ -1,11 +1,3 @@
-#! /usr/bin/python
-
-# To change this template, choose Tools | Templates
-# and open the template in the editor.
-
-__author__="steve"
-__date__ ="$18/11/2011 11:35:22 AM$"
-
-if __name__ == "__main__":
-    import anuga
-    print 'Anuga version:',anuga.__version__
+version = 8973
+status = 'Modified'
+date = '2013/09/12 15:18:38'
Index: /trunk/anuga_core/user_manual/anuga_user_manual.tex
===================================================================
--- /trunk/anuga_core/user_manual/anuga_user_manual.tex	(revision 8973)
+++ /trunk/anuga_core/user_manual/anuga_user_manual.tex	(revision 8974)
@@ -45,5 +45,5 @@
 
 \title{\anuga User Manual}
-\author{Geoscience Australia and the Australian National University}
+\author{Stephen Roberts, Ole Nielsen, Duncan Gray and Jane Sexton}
 
 % Please at least include a long-lived email address;
@@ -61,8 +61,8 @@
 % stages to make it easier to handle versions.
 
-\longdate       % Make date format long using datetime.sty
+%\longdate       % Make date format long using datetime.sty
 %\settimeformat{xxivtime} % 24 hour Format
-\settimeformat{oclock} % Verbose
-\date{\today, \ \currenttime}
+%\settimeformat{oclock} % Verbose
+\date{\today \ \currenttime}
 %\hyphenation{set\_datadir}
 
@@ -1394,6 +1394,6 @@
 \end{verbatim}
 
-All modules are in the folder \file{inundation} or one of its subfolders, and the
-location of each module is described relative to \file{inundation}. Rather
+All modules are in the folder \file{anuga} or one of its subfolders, and the
+location of each module is described relative to \file{anuga}. Rather
 than using pathnames, whose syntax depends on the operating system,
 we use the format adopted for importing the function or class for
@@ -2566,261 +2566,260 @@
 
 
-\section{Forcing Terms}\index{Forcing terms}
-\label{sec:forcing terms}
-
-\anuga provides a number of predefined forcing functions to be used with simulations.
-Gravity and friction are always calculated using the elevation and friction quantities,
-but the user may additionally add forcing terms to the list
-\code{domain.forcing_terms} and have them affect the model.
-
-Currently, predefined forcing terms are: \\
-\begin{classdesc}{General_forcing}{domain,
-                                  quantity_name,
-                                  rate=0.0,
-                                  center=None,
-                                  radius=None,
-                                  polygon=None,
-                                  default_rate=None,
-                                  verbose=False}
-Module: \module{shallow_water.shallow_water_domain}
-
-This is a general class to modify any quantity according to a given rate of change.
-Other specific forcing terms are based on this class but it can be used by itself as well (e.g.\ to modify momentum).
-
-\code{domain} is the domain being evolved.
-
-\code{quantity_name} is the name of the quantity that will be affected by this forcing term.
-
-\code{rate} is the rate at which the quantity should change. This can be either a constant or a
-function of time. Positive values indicate increases, negative values indicate decreases.
-The parameter \code{rate} can be \code{None} at initialisation but must be specified
-before a forcing term is applied (i.e.\ simulation has started).
-The default value is 0.0 -- i.e.\ no forcing.
-
-\code{center} and \code{ radius} optionally restrict forcing to a circle with given center and radius.
-
-\code{polygon} optionally restricts forcing to an area enclosed by the given polygon.
-
-Note: specifying \code{center}, \code{radius} and \code{polygon} will cause an exception to be thrown.
-Moreover, if the specified polygon or circle does not lie fully within the mesh boundary an Exception will be thrown.
-
-Example:
-
-\begin{verbatim}
-P = [[x0, y0], [x1, y0], [x1, y1], [x0, y1]]    # Square polygon
-
-xmom = General_forcing(domain, 'xmomentum', polygon=P)
-ymom = General_forcing(domain, 'ymomentum', polygon=P)
-
-xmom.rate = f
-ymom.rate = g
-
-domain.forcing_terms.append(xmom)
-domain.forcing_terms.append(ymom)
-\end{verbatim}
-
-Here, \code{f} and \code{g} are assumed to be defined as functions of time providing
-a time dependent rate of change for xmomentum and ymomentum respectively.
-\code{P} is assumed to be the polygon, specified as a list of points.
-\end{classdesc}
-
-\begin{classdesc}{Inflow}{domain,
-                         rate=0.0,
-                         center=None, radius=None,
-                         polygon=None,
-                         default_rate=None,
-                         verbose=False}
-Module: \module{shallow_water.shallow_water_domain}
-
-This is a general class for inflow and abstraction of water according to a given rate of change.
-This class will always modify the \code{stage} quantity.
-
-Inflow is based on the \code{General_forcing} class so the functionality is similar.
-
-\code{domain} is the domain being evolved.
-
-\code{rate} is the flow rate ($m^3/s$) at which the quantity should change. This can be either a constant or a
-function of time. Positive values indicate inflow, negative values indicate outflow.
-Note: The specified flow will be divided by the area of the inflow region and then applied to update the
-stage quantity.
-
-\code{center} and \code{ radius} optionally restrict forcing to a circle with given center and radius.
-
-\code{polygon} optionally restricts forcing to an area enclosed by the given polygon.
-
-Example:
-
-\begin{verbatim}
-hydrograph = Inflow(center=(320, 300), radius=10,
-                    rate=file_function('QPMF_Rot_Sub13.tms'))
-
-domain.forcing_terms.append(hydrograph)
-\end{verbatim}
-
-Here, \code{'QPMF_Rot_Sub13.tms'} is assumed to be a NetCDF file in the TMS format defining a timeseries for a hydrograph.
-\end{classdesc}
-
-\begin{classdesc}{Rainfall}{domain,
-                           rate=0.0,
-                           center=None,
-                           radius=None,
-                           polygon=None,
-                           default_rate=None,
-                           verbose=False}
-Module: \module{shallow_water.shallow_water_domain}
-
-This is a general class for implementing rainfall over the domain, possibly restricted to a given circle or polygon.
-This class will always modify the \code{stage} quantity.
-
-Rainfall is based on the \code{General_forcing} class so the functionality is similar.
-
-\code{domain} is the domain being evolved.
-
-\code{rate} is the total rain rate over the specified domain.
-Note: Raingauge Data needs to reflect the time step.
-For example, if rain gauge is \code{mm} read every \code{dt} seconds, then the input
-here is as \code{mm/dt} so 10 mm in 5 minutes becomes
-10/(5x60) = 0.0333mm/s.  This parameter can be either a constant or a
-function of time. Positive values indicate rain being added (or be used for general infiltration),
-negative values indicate outflow at the specified rate (presumably this could model evaporation or abstraction).
-
-\code{center} and \code{ radius} optionally restrict forcing to a circle with given center and radius.
-
-\code{polygon} optionally restricts forcing to an area enclosed by the given polygon.
-
-Example:
-
-\begin{verbatim}
-catchmentrainfall = Rainfall(rate=file_function('Q100_2hr_Rain.tms'))
-domain.forcing_terms.append(catchmentrainfall)
-\end{verbatim}
-
-Here, \code{'Q100_2hr_Rain.tms'} is assumed to be a NetCDF file in the TMS format defining a timeseries for the rainfall.
-\end{classdesc}
-
-\begin{classdesc}{Culvert_flow}{domain,
-                 culvert_description_filename=None,
-                 culvert_routine=None,
-                 end_point0=None,
-                 end_point1=None,
-                 enquiry_point0=None,
-                 enquiry_point1=None,
-                 type='box',
-                 width=None,
-                 height=None,
-                 length=None,
-                 number_of_barrels=1,
-                 trigger_depth=0.01,
-                 manning=None,
-                 sum_loss=None,
-                 use_velocity_head=False,
-                 use_momentum_jet=False,
-                 label=None,
-                 description=None,
-                 update_interval=None,
-                 log_file=False,
-                 discharge_hydrograph=False,
-                 verbose=False}
-Module: \module{culvert_flows.culvert_class}
-
-This is a general class for implementing flow through a culvert.
-This class modifies the quantities \code{stage}, \code{xmomentum} and \code{ymomentum} in areas at both ends of the culvert.
-
-The \code{Culvert_flow} forcing term uses \code{Inflow} and \code{General_forcing} to update the quantities.
-The flow direction is determined on-the-fly so openings are referenced simple as opening0 and opening1
-with either being able to take the role as Inflow or Outflow.
-
-The \code{Culvert_flow} class takes as input:
-
- \code{domain}: a reference to the domain being evolved
-
-\code{culvert_description_filename}:
-
-\code{culvert_routine}:
-
-  \code{end_point0}: Coordinates of one opening
-
-  \code{end_point1}: Coordinates of other opening
-
-  \code{enquiry_point0}:
-
- \code{enquiry_point1}:
- 
- \code{type}: (default is 'box')
- 
- \code{width}:
-
-  \code{height}:
- 
- \code{length}:
-
-  \code{number_of_barrels}: Number of identical pipes in the culvert (default is 1)
- 
- \code{trigger_depth}: (default is 0.01)
-
-  \code{manning}: Mannings Roughness for Culvert
- 
- \code{sum_loss}:
- 
- \code{use_velocity_head}:
-
-  \code{use_momentum_jet}:
- 
-   \code{label}: Short text naming the culvert
-
-  \code{description}: Text describing the culvert
-
-    \code{update_interval}:
- 
- \code{log_file}:
-
-  \code{discharge_hydrograph}:
-
-
-The user can specify different culvert routines. However, \anuga currently provides only one, namely the
-\code{boyd_generalised_culvert_model} as used in the example below:
-
-\begin{verbatim}
-from anuga.culvert_flows.culvert_class import Culvert_flow
-from anuga.culvert_flows.culvert_routines import boyd_generalised_culvert_model
-
-culvert1 = Culvert_flow(domain,
-                        label='Culvert No. 1',
-                        description='This culvert is a test unit 1.2m Wide by 0.75m High',
-                        end_point0=[9.0, 2.5],
-                        end_point1=[13.0, 2.5],
-                        width=1.20,
-                        height=0.75,
-                        culvert_routine=boyd_generalised_culvert_model,
-                        number_of_barrels=1,
-                        verbose=True)
-
-culvert2 = Culvert_flow(domain,
-                        label='Culvert No. 2',
-                        description='This culvert is a circular test with d=1.2m',
-                        end_point0=[9.0, 1.5],
-                        end_point1=[30.0, 3.5],
-                        diameter=1.20,
-                        invert_level0=7,
-                        culvert_routine=boyd_generalised_culvert_model,
-                        number_of_barrels=1,
-                        verbose=True)
-
-domain.forcing_terms.append(culvert1)
-domain.forcing_terms.append(culvert2)
-\end{verbatim}
-\end{classdesc}
-
+%\section{Forcing Terms}\index{Forcing terms}
+%\label{sec:forcing terms}
+%
+%\anuga provides a number of predefined forcing functions to be used with simulations.
+%Gravity and friction are always calculated using the elevation and friction quantities,
+%but the user may additionally add forcing terms to the list
+%\code{domain.forcing_terms} and have them affect the model.
+%
+%Currently, predefined forcing terms are: \\
+%\begin{classdesc}{General_forcing}{domain,
+%                                  quantity_name,
+%                                  rate=0.0,
+%                                  center=None,
+%                                  radius=None,
+%                                  polygon=None,
+%                                  default_rate=None,
+%                                  verbose=False}
+%Module: \module{shallow_water.shallow_water_domain}
+%
+%This is a general class to modify any quantity according to a given rate of change.
+%Other specific forcing terms are based on this class but it can be used by itself as well (e.g.\ to modify momentum).
+%
+%\code{domain} is the domain being evolved.
+%
+%\code{quantity_name} is the name of the quantity that will be affected by this forcing term.
+%
+%\code{rate} is the rate at which the quantity should change. This can be either a constant or a
+%function of time. Positive values indicate increases, negative values indicate decreases.
+%The parameter \code{rate} can be \code{None} at initialisation but must be specified
+%before a forcing term is applied (i.e.\ simulation has started).
+%The default value is 0.0 -- i.e.\ no forcing.
+%
+%\code{center} and \code{ radius} optionally restrict forcing to a circle with given center and radius.
+%
+%\code{polygon} optionally restricts forcing to an area enclosed by the given polygon.
+%
+%Note: specifying \code{center}, \code{radius} and \code{polygon} will cause an exception to be thrown.
+%Moreover, if the specified polygon or circle does not lie fully within the mesh boundary an Exception will be thrown.
+%
+%Example:
+%
+%\begin{verbatim}
+%P = [[x0, y0], [x1, y0], [x1, y1], [x0, y1]]    # Square polygon
+%
+%xmom = General_forcing(domain, 'xmomentum', polygon=P)
+%ymom = General_forcing(domain, 'ymomentum', polygon=P)
+%
+%xmom.rate = f
+%ymom.rate = g
+%
+%domain.forcing_terms.append(xmom)
+%domain.forcing_terms.append(ymom)
+%\end{verbatim}
+%
+%Here, \code{f} and \code{g} are assumed to be defined as functions of time providing
+%a time dependent rate of change for xmomentum and ymomentum respectively.
+%\code{P} is assumed to be the polygon, specified as a list of points.
+%\end{classdesc}
+%
+%\begin{classdesc}{Inflow}{domain,
+%                         rate=0.0,
+%                         center=None, radius=None,
+%                         polygon=None,
+%                         default_rate=None,
+%                         verbose=False}
+%Module: \module{shallow_water.shallow_water_domain}
+%
+%This is a general class for inflow and abstraction of water according to a given rate of change.
+%This class will always modify the \code{stage} quantity.
+%
+%Inflow is based on the \code{General_forcing} class so the functionality is similar.
+%
+%\code{domain} is the domain being evolved.
+%
+%\code{rate} is the flow rate ($m^3/s$) at which the quantity should change. This can be either a constant or a
+%function of time. Positive values indicate inflow, negative values indicate outflow.
+%Note: The specified flow will be divided by the area of the inflow region and then applied to update the
+%stage quantity.
+%
+%\code{center} and \code{ radius} optionally restrict forcing to a circle with given center and radius.
+%
+%\code{polygon} optionally restricts forcing to an area enclosed by the given polygon.
+%
+%Example:
+%
+%\begin{verbatim}
+%hydrograph = Inflow(center=(320, 300), radius=10,
+%                    rate=file_function('QPMF_Rot_Sub13.tms'))
+%
+%domain.forcing_terms.append(hydrograph)
+%\end{verbatim}
+%
+%Here, \code{'QPMF_Rot_Sub13.tms'} is assumed to be a NetCDF file in the TMS format defining a timeseries for a hydrograph.
+%\end{classdesc}
+%
+%\begin{classdesc}{Rainfall}{domain,
+%                           rate=0.0,
+%                           center=None,
+%                           radius=None,
+%                           polygon=None,
+%                           default_rate=None,
+%                           verbose=False}
+%Module: \module{shallow_water.shallow_water_domain}
+%
+%This is a general class for implementing rainfall over the domain, possibly restricted to a given circle or polygon.
+%This class will always modify the \code{stage} quantity.
+%
+%Rainfall is based on the \code{General_forcing} class so the functionality is similar.
+%
+%\code{domain} is the domain being evolved.
+%
+%\code{rate} is the total rain rate over the specified domain.
+%Note: Raingauge Data needs to reflect the time step.
+%For example, if rain gauge is \code{mm} read every \code{dt} seconds, then the input
+%here is as \code{mm/dt} so 10 mm in 5 minutes becomes
+%10/(5x60) = 0.0333mm/s.  This parameter can be either a constant or a
+%function of time. Positive values indicate rain being added (or be used for general infiltration),
+%negative values indicate outflow at the specified rate (presumably this could model evaporation or abstraction).
+%
+%\code{center} and \code{ radius} optionally restrict forcing to a circle with given center and radius.
+%
+%\code{polygon} optionally restricts forcing to an area enclosed by the given polygon.
+%
+%Example:
+%
+%\begin{verbatim}
+%catchmentrainfall = Rainfall(rate=file_function('Q100_2hr_Rain.tms'))
+%domain.forcing_terms.append(catchmentrainfall)
+%\end{verbatim}
+%
+%Here, \code{'Q100_2hr_Rain.tms'} is assumed to be a NetCDF file in the TMS format defining a timeseries for the rainfall.
+%\end{classdesc}
+%
+%\begin{classdesc}{Culvert_flow}{domain,
+%                 culvert_description_filename=None,
+%                 culvert_routine=None,
+%                 end_point0=None,
+%                 end_point1=None,
+%                 enquiry_point0=None,
+%                 enquiry_point1=None,
+%                 type='box',
+%                 width=None,
+%                 height=None,
+%                 length=None,
+%                 number_of_barrels=1,
+%                 trigger_depth=0.01,
+%                 manning=None,
+%                 sum_loss=None,
+%                 use_velocity_head=False,
+%                 use_momentum_jet=False,
+%                 label=None,
+%                 description=None,
+%                 update_interval=None,
+%                 log_file=False,
+%                 discharge_hydrograph=False,
+%                 verbose=False}
+%Module: \module{culvert_flows.culvert_class}
+%
+%This is a general class for implementing flow through a culvert.
+%This class modifies the quantities \code{stage}, \code{xmomentum} and \code{ymomentum} in areas at both ends of the culvert.
+%
+%The \code{Culvert_flow} forcing term uses \code{Inflow} and \code{General_forcing} to update the quantities.
+%The flow direction is determined on-the-fly so openings are referenced simple as opening0 and opening1
+%with either being able to take the role as Inflow or Outflow.
+%
+%The \code{Culvert_flow} class takes as input:
+%
+% \code{domain}: a reference to the domain being evolved
+%
+%\code{culvert_description_filename}:
+%
+%\code{culvert_routine}:
+%
+%  \code{end_point0}: Coordinates of one opening
+%
+%  \code{end_point1}: Coordinates of other opening
+%
+%  \code{enquiry_point0}:
+%
+% \code{enquiry_point1}:
+% 
+% \code{type}: (default is 'box')
+% 
+% \code{width}:
+%
+%  \code{height}:
+% 
+% \code{length}:
+%
+%  \code{number_of_barrels}: Number of identical pipes in the culvert (default is 1)
+% 
+% \code{trigger_depth}: (default is 0.01)
+%
+%  \code{manning}: Mannings Roughness for Culvert
+% 
+% \code{sum_loss}:
+% 
+% \code{use_velocity_head}:
+%
+%  \code{use_momentum_jet}:
+% 
+%   \code{label}: Short text naming the culvert
+%
+%  \code{description}: Text describing the culvert
+%
+%    \code{update_interval}:
+% 
+% \code{log_file}:
+%
+%  \code{discharge_hydrograph}:
+%
+%
+%The user can specify different culvert routines. However, \anuga currently provides only one, namely the
+%\code{boyd_generalised_culvert_model} as used in the example below:
+%
+%\begin{verbatim}
+%from anuga.culvert_flows.culvert_class import Culvert_flow
+%from anuga.culvert_flows.culvert_routines import boyd_generalised_culvert_model
+%
+%culvert1 = Culvert_flow(domain,
+%                        label='Culvert No. 1',
+%                        description='This culvert is a test unit 1.2m Wide by 0.75m High',
+%                        end_point0=[9.0, 2.5],
+%                        end_point1=[13.0, 2.5],
+%                        width=1.20,
+%                        height=0.75,
+%                        culvert_routine=boyd_generalised_culvert_model,
+%                        number_of_barrels=1,
+%                        verbose=True)
+%
+%culvert2 = Culvert_flow(domain,
+%                        label='Culvert No. 2',
+%                        description='This culvert is a circular test with d=1.2m',
+%                        end_point0=[9.0, 1.5],
+%                        end_point1=[30.0, 3.5],
+%                        diameter=1.20,
+%                        invert_level0=7,
+%                        culvert_routine=boyd_generalised_culvert_model,
+%                        number_of_barrels=1,
+%                        verbose=True)
+%
+%domain.forcing_terms.append(culvert1)
+%domain.forcing_terms.append(culvert2)
+%\end{verbatim}
+%\end{classdesc}
+%
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\section{Fractional Step Operators}\index{fractional step operators}
-
-An alternative way to effect the evolution is via fractional step operators.  The idea is that at each inner timestep we can use 
-a fractional step operator to change the centroid values of our conserved quantities, the stage and the xmomentum and the ymomentum. The elevation can also be changed but more care needs to be applied as the \code{elevation} quantity needs to remain continuous. The moral, play with \code{elevation} at your peril. 
-
-We are tending to move away from forcing terms and towards fractpional step operators as they are easier to parallelize. 
-
-
-Currently predefined fractional step operators:
+\section{Operators}\index{operators}
+
+A way to effect the evolution is via fractional step \code{operators}.  The idea is that at each inner timestep we can use 
+an \code{operator} to change the centroid values of quantities such as the stage and the xmomentum and the ymomentum. T
+
+The elevation can also be changed but more care needs to be applied as the \code{elevation} quantity needs to remain continuous. The moral, play with \code{elevation} at your peril. 
+
+Currently predefined operators:
 
 
@@ -2837,5 +2836,5 @@
 Module: \module{anuga.operators.set_elevation_operator}
 
-Set the elevation in a region (careful to maintain continuitiy of elevation)
+Set the elevation in a region (careful to maintain continuity of elevation)
 
 
@@ -2854,5 +2853,5 @@
 \code{description} is a description of this operator.
 
-\code{label} is the lable used when reporting on the operator.
+\code{label} is the label used when reporting on the operator.
 
 \code{logging} is the boolean flag to set logging to a file. 
@@ -2863,7 +2862,5 @@
 
 \begin{verbatim}
-from anuga.operators.set_elevation_operator import Set_elevation_operator
-
-op0 =Set_elevation_operator(domain, elevation = lambda t : 0.01*t)
+op0 = anuga.Set_elevation_operator(domain, elevation = lambda t : 0.01*t)
 \end{verbatim}
 would setup an operator which raises the elevation over the whole domain 1 cm per second.
@@ -2872,8 +2869,8 @@
 While 
 \begin{verbatim}
-from anuga.operators.set_elevation_operator import Set_elevation_operator
 P = [[x0, y0], [x1, y0], [x1, y1], [x0, y1]] 
 
-op0 =Set_elevation_operator(domain, elevation = lambda t : 0.01*t, polygon=P)
+op0 = anuga.Set_elevation_operator(domain, \
+                       elevation = lambda t : 0.01*t, polygon=P)
 \end{verbatim}
 would setup an operator which raises the elevation over the polygon \code{P} 1 cm per second.
@@ -2881,7 +2878,62 @@
 \end{classdesc}
 
-
-
-\subsection{User developed fractional step operator}
+%--------------------------------------------
+\subsection{Culvert operators}
+
+A culvert is a structure that allows water to flow under a road, rail road, trail, or similar obstruction that would otherwise build up behind the embankment. But culverts are also used to drain basins, dams or lakes. \anuga now has the ability to model a culvert by transferring flows from one point in the 2D domain to another. It should be noted that flow from the culvert inlet to the outlet occurs instantaneously with no lagging of the flows.
+
+Only box culverts and pipe culverts can be modelled at present using the Boyd Method (Generalised head-discharge equations for culverts, Proceedings of the fourth national local government engineering conference pp. 161-165, Perth, August, 1987).
+
+Usage
+
+In \anuga, a culvert can be modelled as two points (an inlet point and an outlet point) or along two lines (and inlet line and an outlet line) to account for skew.
+
+The user needs to nominate the location of the culvert inlet and outlet, any culvert losses (i.e. inlet, outlet, bends etc) and the culvert dimensions (in metres). 
+
+The user can also model the effects of momentum jetting at the outlet of the culvert and also account for velocity head of the flow at the inlet for more realistic results.
+
+Culvert hydraulics information can be logged by switching logging on or off.
+
+To use the Boyd Method in \anuga, the user can just copy the code below into their script. So if your model run has 10 pipe culverts, copy the pipe culvert routine five times into your run script and fill in the details for each of your five culverts.
+\begin{verbatim}
+#------------------------------------- -----------------
+# Box Culvert modelled along two lines 
+#------------------------------------- -----------------
+losses = {'inlet':0.5, 'outlet':1.0, 'bend':0.0, 'grate':0.0, 'pier': 0.0, 'other': 0.0} 
+el0 = numpy.array([[297750.2,6181379.1], [297753.5,6181380.9]]) 
+el1 = numpy.array([[297731.8,6181416.4], [297735.1,6181418.3]])  
+culvert = anuga.Boyd_box_operator(domain, 
+    losses=losses, 
+    width=1.5, 
+    height=1.5, 
+    end_points=[ep0, ep1], 
+    use_momentum_jet=True, #False to switch it off
+    use_velocity_head=True, #False to switch it off
+    manning=0.013, #culvert manning's n
+    logging=True, #False to switch it off
+    label='culvert_log_file', 
+    verbose=False)  
+\end{verbatim}
+
+\begin{verbatim}
+#------------------------------------- ------------------
+# Pipe Culvert modelled with a single point 
+#------------------------------------- ------------------
+losses = {'inlet':0.5, 'outlet':1.0, 'bend':0.0, 'grate':0.0, 'pier': 0.0, 'other': 0.0} 
+ep0 = numpy.array([296653.0,6180014.9]) 
+ep1 = numpy.array([296642.5,6180036.3])      
+culvert = anuga.Boyd_pipe_operator(domain, 
+    losses=losses, 
+    diameter=1.5, 
+    end_points=[ep0, ep1], 
+    use_momentum_jet=True, #False to switch it off
+    use_velocity_head=True, #False to switch it off
+    manning=0.013, #culvert manning's n
+    logging=True, #False to switch it off
+    label='culvert_log_file', 
+    verbose=False) 
+\end{verbatim}
+
+\subsection{User developed operators}
 
 Suppose we want to add water to our domain at a steady rate. we can create a class based on the \code{Operator} class which has a \code{__call__} function to do the required update to the centroid values of the stage variable.
@@ -2889,9 +2941,9 @@
 Here is some code to do this:
 \begin{verbatim}
-from anuga.operators.base_operator import Operator
+from anuga import Operator
 
 class My_operator(Operator):
     """
-    Add water to the domain at a given rate (m/sec)
+   An operator which adds water to the domain at a given rate (m/sec)
     """
 
@@ -3293,5 +3345,4 @@
 If no inundation is found (within the \code{polygon} and \code{time_interval}, if specified)
 the return value is \code{None}. This indicates "No Runup" or "Everything is dry".
-is \code{None}. This indicates "No Runup" or "Everything is dry".
 \end{funcdesc}
 
