Changeset 8008


Ignore:
Timestamp:
Sep 7, 2010, 9:17:12 PM (14 years ago)
Author:
habili
Message:

Deleting unnecessary structure test scripts

Location:
trunk/anuga_core/source/anuga/structures
Files:
8 deleted
4 edited

Legend:

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

    r8001 r8008  
    6666        self.discharge = 0.0
    6767        self.velocity = 0.0
    68        
    69        
    70     def __call__(self):
    71        
    72         timestep = self.domain.get_timestep()
    73        
    74         self.__determine_inflow_outflow()
    75        
    76         Q, barrel_speed, outlet_depth = self.__discharge_routine()
    77 
    78         old_inflow_height = self.inflow.get_average_height()
    79         old_inflow_xmom = self.inflow.get_average_xmom()
    80         old_inflow_ymom = self.inflow.get_average_ymom()
    81            
    82         if old_inflow_height > 0.0 :
    83                 Qstar = Q/old_inflow_height
    84         else:
    85                 Qstar = 0.0
    86 
    87         factor = 1.0/(1.0 + Qstar*timestep/self.inflow.get_area())
    88 
    89         new_inflow_height = old_inflow_height*factor
    90         new_inflow_xmom = old_inflow_xmom*factor
    91         new_inflow_ymom = old_inflow_ymom*factor
    92            
    93 
    94         self.inflow.set_heights(new_inflow_height)
    95 
    96         #inflow.set_xmoms(Q/inflow.get_area())
    97         #inflow.set_ymoms(0.0)
    98 
    99 
    100         self.inflow.set_xmoms(new_inflow_xmom)
    101         self.inflow.set_ymoms(new_inflow_ymom)
    102 
    103 
    104         loss = (old_inflow_height - new_inflow_height)*self.inflow.get_area()
    105 
    106            
    107         # set outflow
    108         if old_inflow_height > 0.0 :
    109                 timestep_star = timestep*new_inflow_height/old_inflow_height
    110         else:
    111             timestep_star = 0.0
    112 
    113            
    114         outflow_extra_height = Q*timestep_star/self.outflow.get_area()
    115         outflow_direction = - self.outflow.outward_culvert_vector
    116         outflow_extra_momentum = outflow_extra_height*barrel_speed*outflow_direction
    117            
    118 
    119         gain = outflow_extra_height*self.outflow.get_area()
    120            
    121         #print Q, Q*timestep, barrel_speed, outlet_depth, Qstar, factor, timestep_star
    122         #print '  ', loss, gain
    123 
    124         # Stats
    125         self.discharge  = Q#outflow_extra_height*self.outflow.get_area()/timestep
    126         self.velocity = barrel_speed#self.discharge/outlet_depth/self.width
    127 
    128         new_outflow_height = self.outflow.get_average_height() + outflow_extra_height
    129 
    130         if self.use_momentum_jet :
    131             # FIXME (SR) Review momentum to account for possible hydraulic jumps at outlet
    132             #new_outflow_xmom = outflow.get_average_xmom() + outflow_extra_momentum[0]
    133             #new_outflow_ymom = outflow.get_average_ymom() + outflow_extra_momentum[1]
    134 
    135             new_outflow_xmom = barrel_speed*new_outflow_height*outflow_direction[0]
    136             new_outflow_ymom = barrel_speed*new_outflow_height*outflow_direction[1]
    137 
    138         else:
    139             #new_outflow_xmom = outflow.get_average_xmom()
    140             #new_outflow_ymom = outflow.get_average_ymom()
    141 
    142             new_outflow_xmom = 0.0
    143             new_outflow_ymom = 0.0
    144 
    145 
    146         self.outflow.set_heights(new_outflow_height)
    147         self.outflow.set_xmoms(new_outflow_xmom)
    148         self.outflow.set_ymoms(new_outflow_ymom)
    149 
    150 
    151     def __determine_inflow_outflow(self):
    152         # Determine flow direction based on total energy difference
    153 
    154         if self.use_velocity_head:
    155             self.delta_total_energy = self.inlets[0].get_enquiry_total_energy() - self.inlets[1].get_enquiry_total_energy()
    156         else:
    157             self.delta_total_energy = self.inlets[0].get_enquiry_stage() - self.inlets[1].get_enquiry_stage()
    158 
    159 
    160         self.inflow  = self.inlets[0]
    161         self.outflow = self.inlets[1]
    162        
    163 
    164         if self.delta_total_energy < 0:
    165             self.inflow  = self.inlets[1]
    166             self.outflow = self.inlets[0]
    167             self.delta_total_energy = -self.delta_total_energy
    16868
    16969   
    170     def __discharge_routine(self):
     70    def discharge_routine(self):
    17171
    17272        local_debug ='false'
  • trunk/anuga_core/source/anuga/structures/boyd_pipe_operator.py

    r8002 r8008  
    5959        self.inlets = self.get_inlets()
    6060
    61 
    6261        # Stats
    6362       
     
    6564        self.velocity = 0.0
    6665       
    67        
    68     def __call__(self):
    69        
    70         timestep = self.domain.get_timestep()
    71        
    72         self.__determine_inflow_outflow()
    73        
    74         Q, barrel_speed, outlet_depth = self.__discharge_routine()
    75 
    76         #inflow  = self.routine.get_inflow()
    77         #outflow = self.routine.get_outflow()
    78 
    79         old_inflow_height = self.inflow.get_average_height()
    80         old_inflow_xmom = self.inflow.get_average_xmom()
    81         old_inflow_ymom = self.inflow.get_average_ymom()
    82            
    83         if old_inflow_height > 0.0 :
    84                 Qstar = Q/old_inflow_height
    85         else:
    86                 Qstar = 0.0
    87 
    88         factor = 1.0/(1.0 + Qstar*timestep/self.inflow.get_area())
    89 
    90         new_inflow_height = old_inflow_height*factor
    91         new_inflow_xmom = old_inflow_xmom*factor
    92         new_inflow_ymom = old_inflow_ymom*factor
    93            
    94 
    95         self.inflow.set_heights(new_inflow_height)
    96 
    97         #inflow.set_xmoms(Q/inflow.get_area())
    98         #inflow.set_ymoms(0.0)
    99 
    100 
    101         self.inflow.set_xmoms(new_inflow_xmom)
    102         self.inflow.set_ymoms(new_inflow_ymom)
    103 
    104 
    105         loss = (old_inflow_height - new_inflow_height)*self.inflow.get_area()
    106 
    107            
    108         # set outflow
    109         if old_inflow_height > 0.0 :
    110                 timestep_star = timestep*new_inflow_height/old_inflow_height
    111         else:
    112             timestep_star = 0.0
    113 
    114            
    115         outflow_extra_height = Q*timestep_star/self.outflow.get_area()
    116         outflow_direction = - self.outflow.outward_culvert_vector
    117         outflow_extra_momentum = outflow_extra_height*barrel_speed*outflow_direction
    118            
    119 
    120         gain = outflow_extra_height*self.outflow.get_area()
    121            
    122         #print Q, Q*timestep, barrel_speed, outlet_depth, Qstar, factor, timestep_star
    123         #print '  ', loss, gain
    124 
    125         # Stats
    126         self.discharge  = Q#outflow_extra_height*self.outflow.get_area()/timestep
    127         self.velocity = barrel_speed#self.discharge/outlet_depth/self.width
    128 
    129         new_outflow_height = self.outflow.get_average_height() + outflow_extra_height
    130 
    131         if self.use_momentum_jet :
    132             # FIXME (SR) Review momentum to account for possible hydraulic jumps at outlet
    133             #new_outflow_xmom = outflow.get_average_xmom() + outflow_extra_momentum[0]
    134             #new_outflow_ymom = outflow.get_average_ymom() + outflow_extra_momentum[1]
    135 
    136             new_outflow_xmom = barrel_speed*new_outflow_height*outflow_direction[0]
    137             new_outflow_ymom = barrel_speed*new_outflow_height*outflow_direction[1]
    138 
    139         else:
    140             #new_outflow_xmom = outflow.get_average_xmom()
    141             #new_outflow_ymom = outflow.get_average_ymom()
    142 
    143             new_outflow_xmom = 0.0
    144             new_outflow_ymom = 0.0
    145 
    146 
    147         self.outflow.set_heights(new_outflow_height)
    148         self.outflow.set_xmoms(new_outflow_xmom)
    149         self.outflow.set_ymoms(new_outflow_ymom)
    150 
    151 
    152     def __determine_inflow_outflow(self):
    153         # Determine flow direction based on total energy difference
    154 
    155         if self.use_velocity_head:
    156             self.delta_total_energy = self.inlets[0].get_enquiry_total_energy() - self.inlets[1].get_enquiry_total_energy()
    157         else:
    158             self.delta_total_energy = self.inlets[0].get_enquiry_stage() - self.inlets[1].get_enquiry_stage()
    159 
    160 
    161         self.inflow  = self.inlets[0]
    162         self.outflow = self.inlets[1]
    163        
    164 
    165         if self.delta_total_energy < 0:
    166             self.inflow  = self.inlets[1]
    167             self.outflow = self.inlets[0]
    168             self.delta_total_energy = -self.delta_total_energy
    169 
    17066   
    171     def __discharge_routine(self):
     67    def discharge_routine(self):
    17268
    17369        local_debug ='false'
  • trunk/anuga_core/source/anuga/structures/structure_operator.py

    r8004 r8008  
    88    Sets up the geometry of problem
    99   
    10     This is the base class for culverts. Inherit from this class (and overwrite
    11     compute_discharge method for specific subclasses)
     10    This is the base class for structures (culverts, pipes, bridges etc). Inherit from this class (and overwrite
     11    discharge_routine method for specific subclasses)
    1212   
    1313    Input: Two points, pipe_size (either diameter or width, height),
     
    6363        self.inlets.append(inlet.Inlet(self.domain, polygon1, exchange_polygon1, outward_vector1))
    6464
     65
    6566    def __call__(self):
    6667
    67         pass
     68        timestep = self.domain.get_timestep()
     69       
     70        self.__determine_inflow_outflow()
     71       
     72        Q, barrel_speed, outlet_depth = self.discharge_routine()
     73
     74        old_inflow_height = self.inflow.get_average_height()
     75        old_inflow_xmom = self.inflow.get_average_xmom()
     76        old_inflow_ymom = self.inflow.get_average_ymom()
     77           
     78        if old_inflow_height > 0.0 :
     79                Q_star = Q/old_inflow_height
     80        else:
     81                Q_star = 0.0
     82
     83        factor = 1.0/(1.0 + Q_star*timestep/self.inflow.get_area())
     84
     85        new_inflow_height = old_inflow_height*factor
     86        new_inflow_xmom = old_inflow_xmom*factor
     87        new_inflow_ymom = old_inflow_ymom*factor
     88           
     89        self.inflow.set_heights(new_inflow_height)
     90
     91        #inflow.set_xmoms(Q/inflow.get_area())
     92        #inflow.set_ymoms(0.0)
     93
     94        self.inflow.set_xmoms(new_inflow_xmom)
     95        self.inflow.set_ymoms(new_inflow_ymom)
     96
     97        loss = (old_inflow_height - new_inflow_height)*self.inflow.get_area()
     98
     99        # set outflow
     100        if old_inflow_height > 0.0 :
     101                timestep_star = timestep*new_inflow_height/old_inflow_height
     102        else:
     103            timestep_star = 0.0
     104
     105        outflow_extra_height = Q*timestep_star/self.outflow.get_area()
     106        outflow_direction = - self.outflow.outward_culvert_vector
     107        outflow_extra_momentum = outflow_extra_height*barrel_speed*outflow_direction
     108           
     109        gain = outflow_extra_height*self.outflow.get_area()
     110           
     111        #print Q, Q*timestep, barrel_speed, outlet_depth, Qstar, factor, timestep_star
     112        #print '  ', loss, gain
     113
     114        # Stats
     115        self.discharge  = Q#outflow_extra_height*self.outflow.get_area()/timestep
     116        self.velocity = barrel_speed#self.discharge/outlet_depth/self.width
     117
     118        new_outflow_height = self.outflow.get_average_height() + outflow_extra_height
     119
     120        if self.use_momentum_jet :
     121            # FIXME (SR) Review momentum to account for possible hydraulic jumps at outlet
     122            #new_outflow_xmom = outflow.get_average_xmom() + outflow_extra_momentum[0]
     123            #new_outflow_ymom = outflow.get_average_ymom() + outflow_extra_momentum[1]
     124
     125            new_outflow_xmom = barrel_speed*new_outflow_height*outflow_direction[0]
     126            new_outflow_ymom = barrel_speed*new_outflow_height*outflow_direction[1]
     127
     128        else:
     129            #new_outflow_xmom = outflow.get_average_xmom()
     130            #new_outflow_ymom = outflow.get_average_ymom()
     131
     132            new_outflow_xmom = 0.0
     133            new_outflow_ymom = 0.0
     134
     135        self.outflow.set_heights(new_outflow_height)
     136        self.outflow.set_xmoms(new_outflow_xmom)
     137        self.outflow.set_ymoms(new_outflow_ymom)
     138
     139
     140    def __determine_inflow_outflow(self):
     141        # Determine flow direction based on total energy difference
     142
     143        if self.use_velocity_head:
     144            self.delta_total_energy = self.inlets[0].get_enquiry_total_energy() - self.inlets[1].get_enquiry_total_energy()
     145        else:
     146            self.delta_total_energy = self.inlets[0].get_enquiry_stage() - self.inlets[1].get_enquiry_stage()
     147
     148
     149        self.inflow  = self.inlets[0]
     150        self.outflow = self.inlets[1]
     151       
     152
     153        if self.delta_total_energy < 0:
     154            self.inflow  = self.inlets[1]
     155            self.outflow = self.inlets[0]
     156            self.delta_total_energy = -self.delta_total_energy
     157
    68158
    69159    def __create_exchange_polygons(self):
     
    124214            msg = 'Enquiry point falls inside an exchange polygon.'
    125215            assert not anuga.inside_polygon(ep, polygon), msg
    126    
    127            
    128         #print '   outflow volume ',outflow.get_total_water_volume()
    129        
     216           
     217   
     218    def discharge_routine(self):
     219       
     220        pass
     221           
    130222
    131223    def print_stats(self):
     
    165257        message += 'Inlet Driving Energy %.2f\n' % self.driving_energy
    166258        message += 'delta total energy %.2f\n' % self.delta_total_energy
    167 #        message += 'Net boundary flow by tags [m^3/s]\n'
    168 #        for tag in boundary_flows:
    169 #            message += '    %s [m^3/s]: %.2f\n' % (tag, boundary_flows[tag])
    170 #
    171 #        message += 'Total net boundary flow [m^3/s]: %.2f\n' % \
    172 #                    (total_boundary_inflow + total_boundary_outflow)
    173 #        message += 'Total volume in domain [m^3]: %.2f\n' % \
    174 #                    self.compute_total_volume()
    175 #
    176 #        # The go through explicit forcing update and record the rate of change
    177 #        # for stage and
    178 #        # record into forcing_inflow and forcing_outflow. Finally compute
    179 #        # integral of depth to obtain total volume of domain.
    180 #
    181         # FIXME(Ole): This part is not yet done.
    182259
    183260        return message
    184261
     262
    185263    def get_inlets(self):
    186264       
  • trunk/anuga_core/source/anuga/structures/testing_wide_bridge.py

    r8005 r8008  
    255255#------------------------------------------------------------------------------
    256256
    257 for t in domain.evolve(yieldstep = 1, finaltime = 10):
     257for t in domain.evolve(yieldstep = 1, finaltime = 100):
    258258    print domain.timestepping_statistics()
    259259    print domain.volumetric_balance_statistics()
Note: See TracChangeset for help on using the changeset viewer.