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

Deleting unnecessary structure test scripts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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       
Note: See TracChangeset for help on using the changeset viewer.