Ignore:
Timestamp:
Sep 4, 2010, 9:37:37 PM (14 years ago)
Author:
habili
Message:

using "import anuga"

File:
1 edited

Legend:

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

    r7997 r8001  
    1 from anuga.geometry.polygon import inside_polygon, polygon_area
    2 from anuga.config import g, velocity_protection
    3 import anuga.utilities.log as log
     1import anuga
    42import math
    53import types
    64
    7 import structure_operator
    8 
    9 class Boyd_box_operator(structure_operator.Structure_operator):
     5class Boyd_box_operator(anuga.Structure_operator):
    106    """Culvert flow - transfer water from one rectangular box to another.
    117    Sets up the geometry of problem
     
    3329                 verbose=False):
    3430                     
    35         structure_operator.Structure_operator.__init__(self,
    36                                                        domain,
    37                                                        end_point0,
    38                                                        end_point1,
    39                                                        width,
    40                                                        height,
    41                                                        apron,
    42                                                        manning,
    43                                                        enquiry_gap,                                                       
    44                                                        description,
    45                                                        verbose)           
     31        anuga.Structure_operator.__init__(self,
     32                                          domain,
     33                                          end_point0,
     34                                          end_point1,
     35                                          width,
     36                                          height,
     37                                          apron,
     38                                          manning,
     39                                          enquiry_gap,                                                       
     40                                          description,
     41                                          verbose)           
    4642       
    4743       
     
    4945            self.sum_loss = sum(losses.values())
    5046        elif type(losses) == types.ListType:
    51             self.sum_losses = sum(losses)
    52         else:
    53             self.sum_losses = losses
     47            self.sum_loss = sum(losses)
     48        else:
     49            self.sum_loss = losses
    5450       
    5551        self.use_momentum_jet = use_momentum_jet
     
    7975       
    8076        Q, barrel_speed, outlet_depth = self.__discharge_routine()
    81 
    82         #inflow  = self.routine.get_inflow()
    83         #outflow = self.routine.get_outflow()
    8477
    8578        old_inflow_height = self.inflow.get_average_height()
     
    181174        if self.inflow.get_enquiry_height() > 0.01: #this value was 0.01:
    182175            if local_debug =='true':
    183                 log.critical('Specific E & Deltat Tot E = %s, %s'
     176                anuga.log.critical('Specific E & Deltat Tot E = %s, %s'
    184177                             % (str(self.inflow.get_enquiry_specific_energy()),
    185178                                str(self.delta_total_energy)))
    186                 log.critical('culvert type = %s' % str(culvert_type))
     179                anuga.log.critical('culvert type = %s' % str(culvert_type))
    187180            # Water has risen above inlet
    188181
     
    205198            # check unsubmerged and submerged condition and use Min Q
    206199            # but ensure the correct flow area and wetted perimeter are used
    207             Q_inlet_unsubmerged = 0.544*g**0.5*width*self.driving_energy**1.50 # Flow based on Inlet Ctrl Inlet Unsubmerged
    208             Q_inlet_submerged = 0.702*g**0.5*width*height**0.89*self.driving_energy**0.61  # Flow based on Inlet Ctrl Inlet Submerged
     200            Q_inlet_unsubmerged = 0.544*anuga.g**0.5*width*self.driving_energy**1.50 # Flow based on Inlet Ctrl Inlet Unsubmerged
     201            Q_inlet_submerged = 0.702*anuga.g**0.5*width*height**0.89*self.driving_energy**0.61  # Flow based on Inlet Ctrl Inlet Submerged
    209202
    210203            # FIXME(Ole): Are these functions really for inlet control?
    211204            if Q_inlet_unsubmerged < Q_inlet_submerged:
    212205                Q = Q_inlet_unsubmerged
    213                 dcrit = (Q**2/g/width**2)**0.333333
     206                dcrit = (Q**2/anuga.g/width**2)**0.333333
    214207                if dcrit > height:
    215208                    dcrit = height
     
    223216            else: # Inlet Submerged but check internal culvert flow depth
    224217                Q = Q_inlet_submerged
    225                 dcrit = (Q**2/g/width**2)**0.333333
     218                dcrit = (Q**2/anuga.g/width**2)**0.333333
    226219                if dcrit > height:
    227220                    dcrit = height
     
    234227                case = 'Inlet submerged Box Acts as Orifice'
    235228
    236             dcrit = (Q**2/g/width**2)**0.333333
     229            dcrit = (Q**2/anuga.g/width**2)**0.333333
    237230            # May not need this .... check if same is done above
    238231            outlet_culvert_depth = dcrit
     
    249242            #( may need to include Culvert Bed Slope Comparison)
    250243            hyd_rad = flow_area/perimeter
    251             culvert_velocity = math.sqrt(self.delta_total_energy/((self.sum_loss/2/g)+(self.manning**2*self.culvert_length)/hyd_rad**1.33333))
     244            culvert_velocity = math.sqrt(self.delta_total_energy/((self.sum_loss/2/anuga.g)+(self.manning**2*self.culvert_length)/hyd_rad**1.33333))
    252245            Q_outlet_tailwater = flow_area * culvert_velocity
    253246           
     
    263256                    case = 'Outlet submerged'
    264257                else:   # Here really should use the Culvert Slope to calculate Actual Culvert Depth & Velocity
    265                     dcrit = (Q**2/g/width**2)**0.333333
     258                    dcrit = (Q**2/anuga.g/width**2)**0.333333
    266259                    outlet_culvert_depth=dcrit   # For purpose of calculation assume the outlet depth = Critical Depth
    267260                    if outlet_culvert_depth > height:
     
    282275
    283276                # Final Outlet control velocity using tail water
    284                 culvert_velocity = math.sqrt(self.delta_total_energy/((self.sum_loss/2/g)+(self.manning**2*self.culvert_length)/hyd_rad**1.33333))
     277                culvert_velocity = math.sqrt(self.delta_total_energy/((self.sum_loss/2/anuga.g)+(self.manning**2*self.culvert_length)/hyd_rad**1.33333))
    285278                Q_outlet_tailwater = flow_area * culvert_velocity
    286279
     
    293286                #FIXME(Ole): What about inlet control?
    294287
    295             culv_froude=math.sqrt(Q**2*flow_width/(g*flow_area**3))
     288            culv_froude=math.sqrt(Q**2*flow_width/(anuga.g*flow_area**3))
    296289            if local_debug =='true':
    297                 log.critical('FLOW AREA = %s' % str(flow_area))
    298                 log.critical('PERIMETER = %s' % str(perimeter))
    299                 log.critical('Q final = %s' % str(Q))
    300                 log.critical('FROUDE = %s' % str(culv_froude))
     290                anuga.log.critical('FLOW AREA = %s' % str(flow_area))
     291                anuga.log.critical('PERIMETER = %s' % str(perimeter))
     292                anuga.log.critical('Q final = %s' % str(Q))
     293                anuga.log.critical('FROUDE = %s' % str(culv_froude))
    301294
    302295            # Determine momentum at the outlet
    303             barrel_velocity = Q/(flow_area + velocity_protection/flow_area)
     296            barrel_velocity = Q/(flow_area + anuga.velocity_protection/flow_area)
    304297
    305298        # END CODE BLOCK for DEPTH  > Required depth for CULVERT Flow
Note: See TracChangeset for help on using the changeset viewer.