Ignore:
Timestamp:
Sep 12, 2013, 9:32:39 PM (12 years ago)
Author:
steve
Message:

Cleaning up import anuga

Location:
trunk/anuga_core/user_manual
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/user_manual/anuga_user_manual.tex

    r8973 r8974  
    4545
    4646\title{\anuga User Manual}
    47 \author{Geoscience Australia and the Australian National University}
     47\author{Stephen Roberts, Ole Nielsen, Duncan Gray and Jane Sexton}
    4848
    4949% Please at least include a long-lived email address;
     
    6161% stages to make it easier to handle versions.
    6262
    63 \longdate       % Make date format long using datetime.sty
     63%\longdate       % Make date format long using datetime.sty
    6464%\settimeformat{xxivtime} % 24 hour Format
    65 \settimeformat{oclock} % Verbose
    66 \date{\today, \ \currenttime}
     65%\settimeformat{oclock} % Verbose
     66\date{\today \ \currenttime}
    6767%\hyphenation{set\_datadir}
    6868
     
    13941394\end{verbatim}
    13951395
    1396 All modules are in the folder \file{inundation} or one of its subfolders, and the
    1397 location of each module is described relative to \file{inundation}. Rather
     1396All modules are in the folder \file{anuga} or one of its subfolders, and the
     1397location of each module is described relative to \file{anuga}. Rather
    13981398than using pathnames, whose syntax depends on the operating system,
    13991399we use the format adopted for importing the function or class for
     
    25662566
    25672567
    2568 \section{Forcing Terms}\index{Forcing terms}
    2569 \label{sec:forcing terms}
    2570 
    2571 \anuga provides a number of predefined forcing functions to be used with simulations.
    2572 Gravity and friction are always calculated using the elevation and friction quantities,
    2573 but the user may additionally add forcing terms to the list
    2574 \code{domain.forcing_terms} and have them affect the model.
    2575 
    2576 Currently, predefined forcing terms are: \\
    2577 \begin{classdesc}{General_forcing}{domain,
    2578                                   quantity_name,
    2579                                   rate=0.0,
    2580                                   center=None,
    2581                                   radius=None,
    2582                                   polygon=None,
    2583                                   default_rate=None,
    2584                                   verbose=False}
    2585 Module: \module{shallow_water.shallow_water_domain}
    2586 
    2587 This is a general class to modify any quantity according to a given rate of change.
    2588 Other specific forcing terms are based on this class but it can be used by itself as well (e.g.\ to modify momentum).
    2589 
    2590 \code{domain} is the domain being evolved.
    2591 
    2592 \code{quantity_name} is the name of the quantity that will be affected by this forcing term.
    2593 
    2594 \code{rate} is the rate at which the quantity should change. This can be either a constant or a
    2595 function of time. Positive values indicate increases, negative values indicate decreases.
    2596 The parameter \code{rate} can be \code{None} at initialisation but must be specified
    2597 before a forcing term is applied (i.e.\ simulation has started).
    2598 The default value is 0.0 -- i.e.\ no forcing.
    2599 
    2600 \code{center} and \code{ radius} optionally restrict forcing to a circle with given center and radius.
    2601 
    2602 \code{polygon} optionally restricts forcing to an area enclosed by the given polygon.
    2603 
    2604 Note: specifying \code{center}, \code{radius} and \code{polygon} will cause an exception to be thrown.
    2605 Moreover, if the specified polygon or circle does not lie fully within the mesh boundary an Exception will be thrown.
    2606 
    2607 Example:
    2608 
    2609 \begin{verbatim}
    2610 P = [[x0, y0], [x1, y0], [x1, y1], [x0, y1]]    # Square polygon
    2611 
    2612 xmom = General_forcing(domain, 'xmomentum', polygon=P)
    2613 ymom = General_forcing(domain, 'ymomentum', polygon=P)
    2614 
    2615 xmom.rate = f
    2616 ymom.rate = g
    2617 
    2618 domain.forcing_terms.append(xmom)
    2619 domain.forcing_terms.append(ymom)
    2620 \end{verbatim}
    2621 
    2622 Here, \code{f} and \code{g} are assumed to be defined as functions of time providing
    2623 a time dependent rate of change for xmomentum and ymomentum respectively.
    2624 \code{P} is assumed to be the polygon, specified as a list of points.
    2625 \end{classdesc}
    2626 
    2627 \begin{classdesc}{Inflow}{domain,
    2628                          rate=0.0,
    2629                          center=None, radius=None,
    2630                          polygon=None,
    2631                          default_rate=None,
    2632                          verbose=False}
    2633 Module: \module{shallow_water.shallow_water_domain}
    2634 
    2635 This is a general class for inflow and abstraction of water according to a given rate of change.
    2636 This class will always modify the \code{stage} quantity.
    2637 
    2638 Inflow is based on the \code{General_forcing} class so the functionality is similar.
    2639 
    2640 \code{domain} is the domain being evolved.
    2641 
    2642 \code{rate} is the flow rate ($m^3/s$) at which the quantity should change. This can be either a constant or a
    2643 function of time. Positive values indicate inflow, negative values indicate outflow.
    2644 Note: The specified flow will be divided by the area of the inflow region and then applied to update the
    2645 stage quantity.
    2646 
    2647 \code{center} and \code{ radius} optionally restrict forcing to a circle with given center and radius.
    2648 
    2649 \code{polygon} optionally restricts forcing to an area enclosed by the given polygon.
    2650 
    2651 Example:
    2652 
    2653 \begin{verbatim}
    2654 hydrograph = Inflow(center=(320, 300), radius=10,
    2655                     rate=file_function('QPMF_Rot_Sub13.tms'))
    2656 
    2657 domain.forcing_terms.append(hydrograph)
    2658 \end{verbatim}
    2659 
    2660 Here, \code{'QPMF_Rot_Sub13.tms'} is assumed to be a NetCDF file in the TMS format defining a timeseries for a hydrograph.
    2661 \end{classdesc}
    2662 
    2663 \begin{classdesc}{Rainfall}{domain,
    2664                            rate=0.0,
    2665                            center=None,
    2666                            radius=None,
    2667                            polygon=None,
    2668                            default_rate=None,
    2669                            verbose=False}
    2670 Module: \module{shallow_water.shallow_water_domain}
    2671 
    2672 This is a general class for implementing rainfall over the domain, possibly restricted to a given circle or polygon.
    2673 This class will always modify the \code{stage} quantity.
    2674 
    2675 Rainfall is based on the \code{General_forcing} class so the functionality is similar.
    2676 
    2677 \code{domain} is the domain being evolved.
    2678 
    2679 \code{rate} is the total rain rate over the specified domain.
    2680 Note: Raingauge Data needs to reflect the time step.
    2681 For example, if rain gauge is \code{mm} read every \code{dt} seconds, then the input
    2682 here is as \code{mm/dt} so 10 mm in 5 minutes becomes
    2683 10/(5x60) = 0.0333mm/s.  This parameter can be either a constant or a
    2684 function of time. Positive values indicate rain being added (or be used for general infiltration),
    2685 negative values indicate outflow at the specified rate (presumably this could model evaporation or abstraction).
    2686 
    2687 \code{center} and \code{ radius} optionally restrict forcing to a circle with given center and radius.
    2688 
    2689 \code{polygon} optionally restricts forcing to an area enclosed by the given polygon.
    2690 
    2691 Example:
    2692 
    2693 \begin{verbatim}
    2694 catchmentrainfall = Rainfall(rate=file_function('Q100_2hr_Rain.tms'))
    2695 domain.forcing_terms.append(catchmentrainfall)
    2696 \end{verbatim}
    2697 
    2698 Here, \code{'Q100_2hr_Rain.tms'} is assumed to be a NetCDF file in the TMS format defining a timeseries for the rainfall.
    2699 \end{classdesc}
    2700 
    2701 \begin{classdesc}{Culvert_flow}{domain,
    2702                  culvert_description_filename=None,
    2703                  culvert_routine=None,
    2704                  end_point0=None,
    2705                  end_point1=None,
    2706                  enquiry_point0=None,
    2707                  enquiry_point1=None,
    2708                  type='box',
    2709                  width=None,
    2710                  height=None,
    2711                  length=None,
    2712                  number_of_barrels=1,
    2713                  trigger_depth=0.01,
    2714                  manning=None,
    2715                  sum_loss=None,
    2716                  use_velocity_head=False,
    2717                  use_momentum_jet=False,
    2718                  label=None,
    2719                  description=None,
    2720                  update_interval=None,
    2721                  log_file=False,
    2722                  discharge_hydrograph=False,
    2723                  verbose=False}
    2724 Module: \module{culvert_flows.culvert_class}
    2725 
    2726 This is a general class for implementing flow through a culvert.
    2727 This class modifies the quantities \code{stage}, \code{xmomentum} and \code{ymomentum} in areas at both ends of the culvert.
    2728 
    2729 The \code{Culvert_flow} forcing term uses \code{Inflow} and \code{General_forcing} to update the quantities.
    2730 The flow direction is determined on-the-fly so openings are referenced simple as opening0 and opening1
    2731 with either being able to take the role as Inflow or Outflow.
    2732 
    2733 The \code{Culvert_flow} class takes as input:
    2734 
    2735  \code{domain}: a reference to the domain being evolved
    2736 
    2737 \code{culvert_description_filename}:
    2738 
    2739 \code{culvert_routine}:
    2740 
    2741   \code{end_point0}: Coordinates of one opening
    2742 
    2743   \code{end_point1}: Coordinates of other opening
    2744 
    2745   \code{enquiry_point0}:
    2746 
    2747  \code{enquiry_point1}:
    2748 
    2749  \code{type}: (default is 'box')
    2750 
    2751  \code{width}:
    2752 
    2753   \code{height}:
    2754 
    2755  \code{length}:
    2756 
    2757   \code{number_of_barrels}: Number of identical pipes in the culvert (default is 1)
    2758 
    2759  \code{trigger_depth}: (default is 0.01)
    2760 
    2761   \code{manning}: Mannings Roughness for Culvert
    2762 
    2763  \code{sum_loss}:
    2764 
    2765  \code{use_velocity_head}:
    2766 
    2767   \code{use_momentum_jet}:
    2768 
    2769    \code{label}: Short text naming the culvert
    2770 
    2771   \code{description}: Text describing the culvert
    2772 
    2773     \code{update_interval}:
    2774 
    2775  \code{log_file}:
    2776 
    2777   \code{discharge_hydrograph}:
    2778 
    2779 
    2780 The user can specify different culvert routines. However, \anuga currently provides only one, namely the
    2781 \code{boyd_generalised_culvert_model} as used in the example below:
    2782 
    2783 \begin{verbatim}
    2784 from anuga.culvert_flows.culvert_class import Culvert_flow
    2785 from anuga.culvert_flows.culvert_routines import boyd_generalised_culvert_model
    2786 
    2787 culvert1 = Culvert_flow(domain,
    2788                         label='Culvert No. 1',
    2789                         description='This culvert is a test unit 1.2m Wide by 0.75m High',
    2790                         end_point0=[9.0, 2.5],
    2791                         end_point1=[13.0, 2.5],
    2792                         width=1.20,
    2793                         height=0.75,
    2794                         culvert_routine=boyd_generalised_culvert_model,
    2795                         number_of_barrels=1,
    2796                         verbose=True)
    2797 
    2798 culvert2 = Culvert_flow(domain,
    2799                         label='Culvert No. 2',
    2800                         description='This culvert is a circular test with d=1.2m',
    2801                         end_point0=[9.0, 1.5],
    2802                         end_point1=[30.0, 3.5],
    2803                         diameter=1.20,
    2804                         invert_level0=7,
    2805                         culvert_routine=boyd_generalised_culvert_model,
    2806                         number_of_barrels=1,
    2807                         verbose=True)
    2808 
    2809 domain.forcing_terms.append(culvert1)
    2810 domain.forcing_terms.append(culvert2)
    2811 \end{verbatim}
    2812 \end{classdesc}
    2813 
     2568%\section{Forcing Terms}\index{Forcing terms}
     2569%\label{sec:forcing terms}
     2570%
     2571%\anuga provides a number of predefined forcing functions to be used with simulations.
     2572%Gravity and friction are always calculated using the elevation and friction quantities,
     2573%but the user may additionally add forcing terms to the list
     2574%\code{domain.forcing_terms} and have them affect the model.
     2575%
     2576%Currently, predefined forcing terms are: \\
     2577%\begin{classdesc}{General_forcing}{domain,
     2578%                                  quantity_name,
     2579%                                  rate=0.0,
     2580%                                  center=None,
     2581%                                  radius=None,
     2582%                                  polygon=None,
     2583%                                  default_rate=None,
     2584%                                  verbose=False}
     2585%Module: \module{shallow_water.shallow_water_domain}
     2586%
     2587%This is a general class to modify any quantity according to a given rate of change.
     2588%Other specific forcing terms are based on this class but it can be used by itself as well (e.g.\ to modify momentum).
     2589%
     2590%\code{domain} is the domain being evolved.
     2591%
     2592%\code{quantity_name} is the name of the quantity that will be affected by this forcing term.
     2593%
     2594%\code{rate} is the rate at which the quantity should change. This can be either a constant or a
     2595%function of time. Positive values indicate increases, negative values indicate decreases.
     2596%The parameter \code{rate} can be \code{None} at initialisation but must be specified
     2597%before a forcing term is applied (i.e.\ simulation has started).
     2598%The default value is 0.0 -- i.e.\ no forcing.
     2599%
     2600%\code{center} and \code{ radius} optionally restrict forcing to a circle with given center and radius.
     2601%
     2602%\code{polygon} optionally restricts forcing to an area enclosed by the given polygon.
     2603%
     2604%Note: specifying \code{center}, \code{radius} and \code{polygon} will cause an exception to be thrown.
     2605%Moreover, if the specified polygon or circle does not lie fully within the mesh boundary an Exception will be thrown.
     2606%
     2607%Example:
     2608%
     2609%\begin{verbatim}
     2610%P = [[x0, y0], [x1, y0], [x1, y1], [x0, y1]]    # Square polygon
     2611%
     2612%xmom = General_forcing(domain, 'xmomentum', polygon=P)
     2613%ymom = General_forcing(domain, 'ymomentum', polygon=P)
     2614%
     2615%xmom.rate = f
     2616%ymom.rate = g
     2617%
     2618%domain.forcing_terms.append(xmom)
     2619%domain.forcing_terms.append(ymom)
     2620%\end{verbatim}
     2621%
     2622%Here, \code{f} and \code{g} are assumed to be defined as functions of time providing
     2623%a time dependent rate of change for xmomentum and ymomentum respectively.
     2624%\code{P} is assumed to be the polygon, specified as a list of points.
     2625%\end{classdesc}
     2626%
     2627%\begin{classdesc}{Inflow}{domain,
     2628%                         rate=0.0,
     2629%                         center=None, radius=None,
     2630%                         polygon=None,
     2631%                         default_rate=None,
     2632%                         verbose=False}
     2633%Module: \module{shallow_water.shallow_water_domain}
     2634%
     2635%This is a general class for inflow and abstraction of water according to a given rate of change.
     2636%This class will always modify the \code{stage} quantity.
     2637%
     2638%Inflow is based on the \code{General_forcing} class so the functionality is similar.
     2639%
     2640%\code{domain} is the domain being evolved.
     2641%
     2642%\code{rate} is the flow rate ($m^3/s$) at which the quantity should change. This can be either a constant or a
     2643%function of time. Positive values indicate inflow, negative values indicate outflow.
     2644%Note: The specified flow will be divided by the area of the inflow region and then applied to update the
     2645%stage quantity.
     2646%
     2647%\code{center} and \code{ radius} optionally restrict forcing to a circle with given center and radius.
     2648%
     2649%\code{polygon} optionally restricts forcing to an area enclosed by the given polygon.
     2650%
     2651%Example:
     2652%
     2653%\begin{verbatim}
     2654%hydrograph = Inflow(center=(320, 300), radius=10,
     2655%                    rate=file_function('QPMF_Rot_Sub13.tms'))
     2656%
     2657%domain.forcing_terms.append(hydrograph)
     2658%\end{verbatim}
     2659%
     2660%Here, \code{'QPMF_Rot_Sub13.tms'} is assumed to be a NetCDF file in the TMS format defining a timeseries for a hydrograph.
     2661%\end{classdesc}
     2662%
     2663%\begin{classdesc}{Rainfall}{domain,
     2664%                           rate=0.0,
     2665%                           center=None,
     2666%                           radius=None,
     2667%                           polygon=None,
     2668%                           default_rate=None,
     2669%                           verbose=False}
     2670%Module: \module{shallow_water.shallow_water_domain}
     2671%
     2672%This is a general class for implementing rainfall over the domain, possibly restricted to a given circle or polygon.
     2673%This class will always modify the \code{stage} quantity.
     2674%
     2675%Rainfall is based on the \code{General_forcing} class so the functionality is similar.
     2676%
     2677%\code{domain} is the domain being evolved.
     2678%
     2679%\code{rate} is the total rain rate over the specified domain.
     2680%Note: Raingauge Data needs to reflect the time step.
     2681%For example, if rain gauge is \code{mm} read every \code{dt} seconds, then the input
     2682%here is as \code{mm/dt} so 10 mm in 5 minutes becomes
     2683%10/(5x60) = 0.0333mm/s.  This parameter can be either a constant or a
     2684%function of time. Positive values indicate rain being added (or be used for general infiltration),
     2685%negative values indicate outflow at the specified rate (presumably this could model evaporation or abstraction).
     2686%
     2687%\code{center} and \code{ radius} optionally restrict forcing to a circle with given center and radius.
     2688%
     2689%\code{polygon} optionally restricts forcing to an area enclosed by the given polygon.
     2690%
     2691%Example:
     2692%
     2693%\begin{verbatim}
     2694%catchmentrainfall = Rainfall(rate=file_function('Q100_2hr_Rain.tms'))
     2695%domain.forcing_terms.append(catchmentrainfall)
     2696%\end{verbatim}
     2697%
     2698%Here, \code{'Q100_2hr_Rain.tms'} is assumed to be a NetCDF file in the TMS format defining a timeseries for the rainfall.
     2699%\end{classdesc}
     2700%
     2701%\begin{classdesc}{Culvert_flow}{domain,
     2702%                 culvert_description_filename=None,
     2703%                 culvert_routine=None,
     2704%                 end_point0=None,
     2705%                 end_point1=None,
     2706%                 enquiry_point0=None,
     2707%                 enquiry_point1=None,
     2708%                 type='box',
     2709%                 width=None,
     2710%                 height=None,
     2711%                 length=None,
     2712%                 number_of_barrels=1,
     2713%                 trigger_depth=0.01,
     2714%                 manning=None,
     2715%                 sum_loss=None,
     2716%                 use_velocity_head=False,
     2717%                 use_momentum_jet=False,
     2718%                 label=None,
     2719%                 description=None,
     2720%                 update_interval=None,
     2721%                 log_file=False,
     2722%                 discharge_hydrograph=False,
     2723%                 verbose=False}
     2724%Module: \module{culvert_flows.culvert_class}
     2725%
     2726%This is a general class for implementing flow through a culvert.
     2727%This class modifies the quantities \code{stage}, \code{xmomentum} and \code{ymomentum} in areas at both ends of the culvert.
     2728%
     2729%The \code{Culvert_flow} forcing term uses \code{Inflow} and \code{General_forcing} to update the quantities.
     2730%The flow direction is determined on-the-fly so openings are referenced simple as opening0 and opening1
     2731%with either being able to take the role as Inflow or Outflow.
     2732%
     2733%The \code{Culvert_flow} class takes as input:
     2734%
     2735% \code{domain}: a reference to the domain being evolved
     2736%
     2737%\code{culvert_description_filename}:
     2738%
     2739%\code{culvert_routine}:
     2740%
     2741%  \code{end_point0}: Coordinates of one opening
     2742%
     2743%  \code{end_point1}: Coordinates of other opening
     2744%
     2745%  \code{enquiry_point0}:
     2746%
     2747% \code{enquiry_point1}:
     2748%
     2749% \code{type}: (default is 'box')
     2750%
     2751% \code{width}:
     2752%
     2753%  \code{height}:
     2754%
     2755% \code{length}:
     2756%
     2757%  \code{number_of_barrels}: Number of identical pipes in the culvert (default is 1)
     2758%
     2759% \code{trigger_depth}: (default is 0.01)
     2760%
     2761%  \code{manning}: Mannings Roughness for Culvert
     2762%
     2763% \code{sum_loss}:
     2764%
     2765% \code{use_velocity_head}:
     2766%
     2767%  \code{use_momentum_jet}:
     2768%
     2769%   \code{label}: Short text naming the culvert
     2770%
     2771%  \code{description}: Text describing the culvert
     2772%
     2773%    \code{update_interval}:
     2774%
     2775% \code{log_file}:
     2776%
     2777%  \code{discharge_hydrograph}:
     2778%
     2779%
     2780%The user can specify different culvert routines. However, \anuga currently provides only one, namely the
     2781%\code{boyd_generalised_culvert_model} as used in the example below:
     2782%
     2783%\begin{verbatim}
     2784%from anuga.culvert_flows.culvert_class import Culvert_flow
     2785%from anuga.culvert_flows.culvert_routines import boyd_generalised_culvert_model
     2786%
     2787%culvert1 = Culvert_flow(domain,
     2788%                        label='Culvert No. 1',
     2789%                        description='This culvert is a test unit 1.2m Wide by 0.75m High',
     2790%                        end_point0=[9.0, 2.5],
     2791%                        end_point1=[13.0, 2.5],
     2792%                        width=1.20,
     2793%                        height=0.75,
     2794%                        culvert_routine=boyd_generalised_culvert_model,
     2795%                        number_of_barrels=1,
     2796%                        verbose=True)
     2797%
     2798%culvert2 = Culvert_flow(domain,
     2799%                        label='Culvert No. 2',
     2800%                        description='This culvert is a circular test with d=1.2m',
     2801%                        end_point0=[9.0, 1.5],
     2802%                        end_point1=[30.0, 3.5],
     2803%                        diameter=1.20,
     2804%                        invert_level0=7,
     2805%                        culvert_routine=boyd_generalised_culvert_model,
     2806%                        number_of_barrels=1,
     2807%                        verbose=True)
     2808%
     2809%domain.forcing_terms.append(culvert1)
     2810%domain.forcing_terms.append(culvert2)
     2811%\end{verbatim}
     2812%\end{classdesc}
     2813%
    28142814
    28152815%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    2816 \section{Fractional Step Operators}\index{fractional step operators}
    2817 
    2818 An alternative way to effect the evolution is via fractional step operators.  The idea is that at each inner timestep we can use
    2819 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.
    2820 
    2821 We are tending to move away from forcing terms and towards fractpional step operators as they are easier to parallelize.
    2822 
    2823 
    2824 Currently predefined fractional step operators:
     2816\section{Operators}\index{operators}
     2817
     2818A way to effect the evolution is via fractional step \code{operators}.  The idea is that at each inner timestep we can use
     2819an \code{operator} to change the centroid values of quantities such as the stage and the xmomentum and the ymomentum. T
     2820
     2821The 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.
     2822
     2823Currently predefined operators:
    28252824
    28262825
     
    28372836Module: \module{anuga.operators.set_elevation_operator}
    28382837
    2839 Set the elevation in a region (careful to maintain continuitiy of elevation)
     2838Set the elevation in a region (careful to maintain continuity of elevation)
    28402839
    28412840
     
    28542853\code{description} is a description of this operator.
    28552854
    2856 \code{label} is the lable used when reporting on the operator.
     2855\code{label} is the label used when reporting on the operator.
    28572856
    28582857\code{logging} is the boolean flag to set logging to a file.
     
    28632862
    28642863\begin{verbatim}
    2865 from anuga.operators.set_elevation_operator import Set_elevation_operator
    2866 
    2867 op0 =Set_elevation_operator(domain, elevation = lambda t : 0.01*t)
     2864op0 = anuga.Set_elevation_operator(domain, elevation = lambda t : 0.01*t)
    28682865\end{verbatim}
    28692866would setup an operator which raises the elevation over the whole domain 1 cm per second.
     
    28722869While
    28732870\begin{verbatim}
    2874 from anuga.operators.set_elevation_operator import Set_elevation_operator
    28752871P = [[x0, y0], [x1, y0], [x1, y1], [x0, y1]]
    28762872
    2877 op0 =Set_elevation_operator(domain, elevation = lambda t : 0.01*t, polygon=P)
     2873op0 = anuga.Set_elevation_operator(domain, \
     2874                       elevation = lambda t : 0.01*t, polygon=P)
    28782875\end{verbatim}
    28792876would setup an operator which raises the elevation over the polygon \code{P} 1 cm per second.
     
    28812878\end{classdesc}
    28822879
    2883 
    2884 
    2885 \subsection{User developed fractional step operator}
     2880%--------------------------------------------
     2881\subsection{Culvert operators}
     2882
     2883A 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.
     2884
     2885Only 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).
     2886
     2887Usage
     2888
     2889In \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.
     2890
     2891The 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).
     2892
     2893The 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.
     2894
     2895Culvert hydraulics information can be logged by switching logging on or off.
     2896
     2897To 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.
     2898\begin{verbatim}
     2899#------------------------------------- -----------------
     2900# Box Culvert modelled along two lines
     2901#------------------------------------- -----------------
     2902losses = {'inlet':0.5, 'outlet':1.0, 'bend':0.0, 'grate':0.0, 'pier': 0.0, 'other': 0.0}
     2903el0 = numpy.array([[297750.2,6181379.1], [297753.5,6181380.9]])
     2904el1 = numpy.array([[297731.8,6181416.4], [297735.1,6181418.3]]) 
     2905culvert = anuga.Boyd_box_operator(domain,
     2906    losses=losses,
     2907    width=1.5,
     2908    height=1.5,
     2909    end_points=[ep0, ep1],
     2910    use_momentum_jet=True, #False to switch it off
     2911    use_velocity_head=True, #False to switch it off
     2912    manning=0.013, #culvert manning's n
     2913    logging=True, #False to switch it off
     2914    label='culvert_log_file',
     2915    verbose=False) 
     2916\end{verbatim}
     2917
     2918\begin{verbatim}
     2919#------------------------------------- ------------------
     2920# Pipe Culvert modelled with a single point
     2921#------------------------------------- ------------------
     2922losses = {'inlet':0.5, 'outlet':1.0, 'bend':0.0, 'grate':0.0, 'pier': 0.0, 'other': 0.0}
     2923ep0 = numpy.array([296653.0,6180014.9])
     2924ep1 = numpy.array([296642.5,6180036.3])     
     2925culvert = anuga.Boyd_pipe_operator(domain,
     2926    losses=losses,
     2927    diameter=1.5,
     2928    end_points=[ep0, ep1],
     2929    use_momentum_jet=True, #False to switch it off
     2930    use_velocity_head=True, #False to switch it off
     2931    manning=0.013, #culvert manning's n
     2932    logging=True, #False to switch it off
     2933    label='culvert_log_file',
     2934    verbose=False)
     2935\end{verbatim}
     2936
     2937\subsection{User developed operators}
    28862938
    28872939Suppose 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.
     
    28892941Here is some code to do this:
    28902942\begin{verbatim}
    2891 from anuga.operators.base_operator import Operator
     2943from anuga import Operator
    28922944
    28932945class My_operator(Operator):
    28942946    """
    2895     Add water to the domain at a given rate (m/sec)
     2947   An operator which adds water to the domain at a given rate (m/sec)
    28962948    """
    28972949
     
    32933345If no inundation is found (within the \code{polygon} and \code{time_interval}, if specified)
    32943346the return value is \code{None}. This indicates "No Runup" or "Everything is dry".
    3295 is \code{None}. This indicates "No Runup" or "Everything is dry".
    32963347\end{funcdesc}
    32973348
Note: See TracChangeset for help on using the changeset viewer.