Changeset 7985


Ignore:
Timestamp:
Sep 2, 2010, 9:51:03 AM (8 years ago)
Author:
habili
Message:

deals with manning

File:
1 edited

Legend:

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

    r7984 r7985  
    1414    Input: Two points, pipe_size (either diameter or width, height),
    1515    mannings_rougness,
    16     """ 
     16    """ 
    1717
    1818    def __init__(self,
     
    2323                 height=None,
    2424                 apron=None,
     25                 manning=0.013,
    2526                 enquiry_gap=0.2,
    2627                 verbose=False):
     
    3940        self.height = height
    4041        self.apron  = apron
     42        self.manning = manning
    4143        self.enquiry_gap = enquiry_gap
    4244        self.verbose = verbose
     
    4749                                        self.height,
    4850                                        self.apron,
     51                                        self.manning,
    4952                                        self.enquiry_gap,
    5053                                        self.verbose)
     
    7073
    7174        old_inflow_height = inflow.get_average_height()
    72         old_inflow_xmom = inflow.get_average_xmom()
    73         old_inflow_ymom = inflow.get_average_ymom()
    74                
    75         if old_inflow_height > 0.0 :
    76             Qstar = Q/old_inflow_height
    77         else:
    78             Qstar = 0.0
    79 
    80         factor = 1.0/(1.0 + Qstar*timestep/inflow.get_area())
    81 
    82                
    83                
    84         new_inflow_height = old_inflow_height*factor
    85         new_inflow_xmom = old_inflow_xmom*factor
    86         new_inflow_ymom = old_inflow_ymom*factor
    87                
     75        old_inflow_xmom = inflow.get_average_xmom()
     76        old_inflow_ymom = inflow.get_average_ymom()
     77           
     78        if old_inflow_height > 0.0 :
     79                Qstar = Q/old_inflow_height
     80        else:
     81                Qstar = 0.0
     82
     83        factor = 1.0/(1.0 + Qstar*timestep/inflow.get_area())
     84
     85           
     86           
     87        new_inflow_height = old_inflow_height*factor
     88        new_inflow_xmom = old_inflow_xmom*factor
     89        new_inflow_ymom = old_inflow_ymom*factor
     90           
    8891
    8992        inflow.set_heights(new_inflow_height)
     
    99102        loss = (old_inflow_height - new_inflow_height)*inflow.get_area()
    100103
    101                
    102         # set outflow
    103         if old_inflow_height > 0.0 :
    104             timestep_star = timestep*new_inflow_height/old_inflow_height
    105         else:
     104           
     105        # set outflow
     106        if old_inflow_height > 0.0 :
     107                timestep_star = timestep*new_inflow_height/old_inflow_height
     108        else:
    106109            timestep_star = 0.0
    107110
    108                
    109         outflow_extra_height = Q*timestep_star/outflow.get_area()
    110         outflow_direction = - outflow.outward_culvert_vector
    111         outflow_extra_momentum = outflow_extra_height*barrel_speed*outflow_direction
    112                
    113 
    114         gain = outflow_extra_height*outflow.get_area()
    115        
    116         #print Q, Q*timestep, barrel_speed, outlet_depth, Qstar, factor, timestep_star
    117         #print '  ', loss, gain
    118 
    119 
    120         new_outflow_height = outflow.get_average_height() + outflow_extra_height
    121         new_outflow_xmom = outflow.get_average_xmom() + outflow_extra_momentum[0]
    122         new_outflow_ymom = outflow.get_average_ymom() + outflow_extra_momentum[1]
    123 
    124         outflow.set_heights(new_outflow_height)
    125 
    126         outflow.set_xmoms(barrel_speed*new_outflow_height*outflow_direction[0])
    127         outflow.set_ymoms(barrel_speed*new_outflow_height*outflow_direction[1])
    128 
    129         #outflow.set_xmoms(new_outflow_xmom)
    130         #outflow.set_ymoms(new_outflow_ymom)
    131        
    132         #print '   outflow volume ',outflow.get_total_water_volume()
     111           
     112            outflow_extra_height = Q*timestep_star/outflow.get_area()
     113            outflow_direction = - outflow.outward_culvert_vector
     114            outflow_extra_momentum = outflow_extra_height*barrel_speed*outflow_direction
     115           
     116
     117            gain = outflow_extra_height*outflow.get_area()
     118           
     119            #print Q, Q*timestep, barrel_speed, outlet_depth, Qstar, factor, timestep_star
     120            #print '  ', loss, gain
     121
     122
     123            new_outflow_height = outflow.get_average_height() + outflow_extra_height
     124            new_outflow_xmom = outflow.get_average_xmom() + outflow_extra_momentum[0]
     125            new_outflow_ymom = outflow.get_average_ymom() + outflow_extra_momentum[1]
     126
     127            outflow.set_heights(new_outflow_height)
     128
     129            outflow.set_xmoms(barrel_speed*new_outflow_height*outflow_direction[0])
     130            outflow.set_ymoms(barrel_speed*new_outflow_height*outflow_direction[1])
     131
     132            #outflow.set_xmoms(new_outflow_xmom)
     133            #outflow.set_ymoms(new_outflow_ymom)
     134           
     135            #print '   outflow volume ',outflow.get_total_water_volume()
    133136
    134137    def print_stats(self):
Note: See TracChangeset for help on using the changeset viewer.