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
RevLine 
[7977]1from anuga.config import velocity_protection
2from anuga.utilities.numerical_tools import safe_acos as acos
[7939]3
4from math import pi, sqrt, sin, cos
[7977]5from anuga.config import g
[7939]6
[7980]7class Culvert_routine:
[7978]8    """Collection of culvert routines for use with Culvert_operator
[7939]9
[7978]10    This module holds various routines to determine FLOW through CULVERTS and SIMPLE BRIDGES
[7939]11
[7978]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)
[7939]19    """
20
[7978]21    def __init__(self, culvert, manning=0.0):
[7939]22       
[7978]23        self.inlets = culvert.inlets
[7939]24       
[7980]25       
[7978]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
[7991]33
34        self.use_velocity_head = True
[7978]35       
[7991]36
37       
[7980]38        self.determine_inflow()
[7939]39
[7978]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()
[7977]42
[7978]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           
[7980]51
52
53    def determine_inflow(self):
54        # Determine flow direction based on total energy difference
55
[7991]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()
[7980]60
[7991]61
[7980]62        self.inflow  = self.inlets[0]
63        self.outflow = self.inlets[1]
[7978]64       
[7980]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
[7978]72    def get_inflow(self):
73       
74        return self.inflow
75       
76       
77    def get_outflow(self):
78   
79        return self.outflow
80   
[7977]81
[7978]82
83
84
85
86
Note: See TracBrowser for help on using the repository browser.