source: trunk/anuga_core/source/anuga/structures/culvert_routine.py @ 7980

Last change on this file since 7980 was 7980, checked in by steve, 14 years ago

Added new tests

File size: 2.3 KB
Line 
1from anuga.config import velocity_protection
2from anuga.utilities.numerical_tools import safe_acos as acos
3
4from math import pi, sqrt, sin, cos
5from anuga.config import g
6
7class Culvert_routine:
8    """Collection of culvert routines for use with Culvert_operator
9
10    This module holds various routines to determine FLOW through CULVERTS and SIMPLE BRIDGES
11
12    Usage:
13
14    NOTE:
15     Inlet control:  self.delta_total_energy > self.inflow.get_average_specific_energy()
16     Outlet control: self.delta_total_energy < self.inflow.get_average_specific_energy()
17     where total energy is (w + 0.5*v^2/g) and
18     specific energy is (h + 0.5*v^2/g)
19    """
20
21    def __init__(self, culvert, manning=0.0):
22       
23        self.inlets = culvert.inlets
24       
25       
26        self.culvert_length = culvert.get_culvert_length()
27        self.culvert_width = culvert.get_culvert_width()
28        self.culvert_height = culvert.get_culvert_height()
29        self.sum_loss = 0.0
30        self.max_velocity = 10.0
31        self.manning = manning
32        self.log_filename = None
33       
34        self.determine_inflow()
35
36        #delta_z = self.self.inflow.get_average_elevation() - self.self.outflow.get_average_elevation()
37        #culvert_slope = delta_z/self.culvert.get_self.culvert_length()
38
39        # Determine controlling energy (driving head) for culvert
40        #if self.self.inflow.get_average_specific_energy() > self.self.delta_total_energy:
41        #    # Outlet control
42        #    driving_head = self.delta_total_energy
43        #else:
44            # Inlet control
45        #    driving_head = self.inflow.get_average_specific_energy()
46           
47
48
49    def determine_inflow(self):
50        # Determine flow direction based on total energy difference
51
52        self.delta_total_energy = self.inlets[0].get_average_total_energy() - self.inlets[1].get_average_total_energy()
53
54        self.inflow  = self.inlets[0]
55        self.outflow = self.inlets[1]
56       
57
58        if self.delta_total_energy < 0:
59            self.inflow  = self.inlets[1]
60            self.outflow = self.inlets[0]
61            self.delta_total_energy = -self.delta_total_energy
62
63
64    def get_inflow(self):
65       
66        return self.inflow
67       
68       
69    def get_outflow(self):
70   
71        return self.outflow
72   
73
74
75
76
77
78
Note: See TracBrowser for help on using the repository browser.