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

Last change on this file since 7991 was 7991, checked in by steve, 12 years ago

Finally resolved conflicts between nariman and steve

File size: 2.5 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.use_velocity_head = True
35       
36
37       
38        self.determine_inflow()
39
40        #delta_z = self.self.inflow.get_average_elevation() - self.self.outflow.get_average_elevation()
41        #culvert_slope = delta_z/self.culvert.get_self.culvert_length()
42
43        # Determine controlling energy (driving head) for culvert
44        #if self.self.inflow.get_average_specific_energy() > self.self.delta_total_energy:
45        #    # Outlet control
46        #    driving_head = self.delta_total_energy
47        #else:
48            # Inlet control
49        #    driving_head = self.inflow.get_average_specific_energy()
50           
51
52
53    def determine_inflow(self):
54        # Determine flow direction based on total energy difference
55
56        if self.use_velocity_head:
57            self.delta_total_energy = self.inlets[0].get_enquiry_total_energy() - self.inlets[1].get_enquiry_total_energy()
58        else:
59            self.delta_total_energy = self.inlets[0].get_enquiry_stage() - self.inlets[1].get_enquiry_stage()
60
61
62        self.inflow  = self.inlets[0]
63        self.outflow = self.inlets[1]
64       
65
66        if self.delta_total_energy < 0:
67            self.inflow  = self.inlets[1]
68            self.outflow = self.inlets[0]
69            self.delta_total_energy = -self.delta_total_energy
70
71
72    def get_inflow(self):
73       
74        return self.inflow
75       
76       
77    def get_outflow(self):
78   
79        return self.outflow
80   
81
82
83
84
85
86
Note: See TracBrowser for help on using the repository browser.