Ignore:
Timestamp:
Nov 19, 2010, 2:53:46 PM (13 years ago)
Author:
steve
Message:

Added in a unit test for inlet operator

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/structures/boyd_pipe_operator.py

    r8056 r8073  
    3838                                          enquiry_points,
    3939                                          width=diameter,
    40                                           height=None,
     40                                          depth=None,
    4141                                          apron=apron,
    4242                                          manning=manning,
     
    7373        self.case = 'N/A'
    7474       
    75    
     75
     76    def __determine_inflow_outflow(self):
     77        # Determine flow direction based on total energy difference
     78
     79        if self.use_velocity_head:
     80            self.delta_total_energy = self.inlets[0].get_enquiry_total_energy() - self.inlets[1].get_enquiry_total_energy()
     81        else:
     82            self.delta_total_energy = self.inlets[0].get_enquiry_stage() - self.inlets[1].get_enquiry_stage()
     83
     84        self.inflow  = self.inlets[0]
     85        self.outflow = self.inlets[1]
     86
     87        if self.delta_total_energy < 0:
     88            self.inflow  = self.inlets[1]
     89            self.outflow = self.inlets[0]
     90            self.delta_total_energy = -self.delta_total_energy
     91
    7692    def discharge_routine(self):
     93
     94        self.__determine_inflow_outflow()
    7795
    7896        local_debug ='false'
     
    8199        #pdb.set_trace()
    82100       
    83         if self.inflow.get_enquiry_height() > 0.01: #this value was 0.01: Remember this needs to be compared to the Invert Lvl
     101        if self.inflow.get_enquiry_depth() > 0.01: #this value was 0.01: Remember this needs to be compared to the Invert Lvl
    84102            if local_debug =='true':
    85103                anuga.log.critical('Specific E & Deltat Tot E = %s, %s'
     
    96114                self.driving_energy = self.inflow.get_enquiry_specific_energy()
    97115            else:
    98                 self.driving_energy = self.inflow.get_enquiry_height()
     116                self.driving_energy = self.inflow.get_enquiry_depth()
    99117                """
    100118        For a circular pipe the Boyd method reviews 3 conditions
     
    109127
    110128        local_debug ='false'
    111         if self.inflow.get_average_height() > 0.01: #this should test against invert
     129        if self.inflow.get_average_depth() > 0.01: #this should test against invert
    112130            if local_debug =='true':
    113131                anuga.log.critical('Specific E & Deltat Tot E = %s, %s'
     
    167185
    168186                # Determine the depth at the outlet relative to the depth of flow in the Culvert
    169                 if self.outflow.get_average_height() > diameter:       # Outlet is submerged Assume the end of the Pipe is flowing FULL
     187                if self.outflow.get_average_depth() > diameter:       # Outlet is submerged Assume the end of the Pipe is flowing FULL
    170188                    outlet_culvert_depth=diameter
    171189                    flow_area = (diameter/2)**2 * math.pi  # Cross sectional area of flow in the culvert
     
    176194                        anuga.log.critical('Outlet submerged')
    177195                else:   # Culvert running PART FULL for PART OF ITS LENGTH   Here really should use the Culvert Slope to calculate Actual Culvert Depth & Velocity
    178                     # IF  self.outflow.get_average_height() < diameter
     196                    # IF  self.outflow.get_average_depth() < diameter
    179197                    dcrit1 = diameter/1.26*(Q/anuga.g**0.5*diameter**2.5)**(1/3.75)
    180198                    dcrit2 = diameter/0.95*(Q/anuga.g**0.5*diameter**2.5)**(1/1.95)
     
    243261            barrel_velocity = Q/(flow_area + anuga.velocity_protection/flow_area)
    244262
    245         else: # self.inflow.get_average_height() < 0.01:
     263        else: # self.inflow.get_average_depth() < 0.01:
    246264            Q = barrel_velocity = outlet_culvert_depth = 0.0
    247265
Note: See TracChangeset for help on using the changeset viewer.