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
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
33       
[7980]34        self.determine_inflow()
[7939]35
[7978]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()
[7977]38
[7978]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           
[7980]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]
[7978]56       
[7980]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
[7978]64    def get_inflow(self):
65       
66        return self.inflow
67       
68       
69    def get_outflow(self):
70   
71        return self.outflow
72   
[7977]73
[7978]74
75
76
77
78
Note: See TracBrowser for help on using the repository browser.