Changeset 9602


Ignore:
Timestamp:
Feb 4, 2015, 12:21:14 PM (9 years ago)
Author:
davies
Message:

Updates

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/anuga/structures/riverwall.py

    r9596 r9602  
    4545    #   w1' = min( max(h-h1,0.)/(h2-h1), 1.0) # Factor describing absolute submergence
    4646    #  flux_over_weir = (w1*SW + (1-w1)*ID)*( 1-w1') + (w1')*SW
     47    # where s1, s2, h1, h2 are user defined parameters
    4748    #
    4849    # The key idea is that if s<s1, h<h1, then the ideal weir solution is
  • trunk/anuga_core/anuga/structures/structure_operator.py

    r9600 r9602  
    205205        old_inflow_ymom = self.inflow.get_average_ymom()
    206206
    207         semi_implicit = True
    208         if semi_implicit:   
    209             # Implement the update of flow over a timestep by
    210             # using a semi-implict update. This ensures that
    211             # the update does not create a negative depth
    212             if old_inflow_depth > 0.0 :
    213                     Q_star = Q/old_inflow_depth
    214             else:
    215                     Q_star = 0.0
    216    
    217             factor = 1.0/(1.0 + Q_star*timestep/self.inflow.get_area())
    218  
    219             # The update is:
    220             #    new_inflow_depth*inflow_area =
    221             #    old_inflow_depth*inflow_area -
    222             #    timestep*Q*(new_inflow_depth/old_inflow_depth)
    223             # Note the last term in () is a wet-dry improvement trick
    224             new_inflow_depth = old_inflow_depth*factor
    225 
    226             # For the momentum balance, we note that Q also advects the
    227             # momentum, and we keep using the (new_inflow_depth/old_inflow_depth):
    228             # factor for consistency with above
    229             #     new_inflow_xmom*inflow_area =
    230             #     old_inflow_xmom*inflow_area -
    231             #     timestep*Q*(new_inflow_depth/old_inflow_depth)*new_inflow_xmom
    232             # and:
    233             #     new_inflow_ymom*inflow_area =
    234             #     old_inflow_ymom*inflow_area -
    235             #     timestep*Q*(new_inflow_depth/old_inflow_depth)*new_inflow_ymom
    236             # Here the choice of new_inflow_mom in the final term at the end
    237             # could presumably be replaced with old_inflow_mom
    238             #
    239             factor2 = 1.0/(1.0 + Q_star*timestep*new_inflow_depth/self.inflow.get_area())
    240             new_inflow_xmom = old_inflow_xmom*factor2
    241             new_inflow_ymom = old_inflow_ymom*factor2
    242            
    243             self.inflow.set_depths(new_inflow_depth)
    244    
    245             #inflow.set_xmoms(Q/inflow.get_area())
    246             #inflow.set_ymoms(0.0)
    247    
    248             self.inflow.set_xmoms(new_inflow_xmom)
    249             self.inflow.set_ymoms(new_inflow_ymom)
    250    
    251             loss = (old_inflow_depth - new_inflow_depth)*self.inflow.get_area()
    252             xmom_loss = (old_inflow_xmom - new_inflow_xmom)*self.inflow.get_area()
    253             ymom_loss = (old_inflow_ymom - new_inflow_ymom)*self.inflow.get_area()
    254    
    255             # set outflow
    256             if old_inflow_depth > 0.0 :
    257                 timestep_star = timestep*new_inflow_depth/old_inflow_depth
    258             else:
    259                 timestep_star = 0.0
    260    
    261             outflow_extra_depth = Q*timestep_star/self.outflow.get_area()
    262             outflow_direction = - self.outflow.outward_culvert_vector
    263             #outflow_extra_momentum = outflow_extra_depth*barrel_speed*outflow_direction
    264                
    265             gain = outflow_extra_depth*self.outflow.get_area()
    266            
    267             #print gain, loss
    268             assert num.allclose(gain-loss, 0.0)
    269                
    270             #print Q, Q*timestep, barrel_speed, outlet_depth, Qstar, factor, timestep_star
    271             #print '  ', loss, gain
    272         else:
    273 
    274    
    275             factor = Q*timestep/self.inflow.get_area()
    276    
    277             new_inflow_depth = old_inflow_depth - factor
    278             new_inflow_xmom = old_inflow_xmom/old_inflow_depth*new_inflow_depth
    279             new_inflow_ymom = old_inflow_ymom/old_inflow_depth*new_inflow_depth
    280             self.inflow.set_depths(new_inflow_depth)   
    281             self.inflow.set_xmoms(new_inflow_xmom)
    282             self.inflow.set_ymoms(new_inflow_ymom)
    283    
    284    
    285             loss = (old_inflow_depth - new_inflow_depth)*self.inflow.get_area()
    286    
    287 
    288    
    289             outflow_extra_depth = Q*timestep/self.outflow.get_area()
    290             outflow_direction = - self.outflow.outward_culvert_vector
    291             #outflow_extra_momentum = outflow_extra_depth*barrel_speed*outflow_direction
    292                
    293             gain = outflow_extra_depth*self.outflow.get_area()
    294            
    295             assert num.allclose(gain-loss, 0.0)
    296                
    297             #print Q, Q*timestep, barrel_speed, outlet_depth, Qstar, factor, timestep_star
    298             #print '  ', loss, gain
    299 
    300    
     207        #semi_implicit = True
     208        #if semi_implicit:   
     209
     210        # Implement the update of flow over a timestep by
     211        # using a semi-implict update. This ensures that
     212        # the update does not create a negative depth
     213        if old_inflow_depth > 0.0 :
     214                dt_Q_on_d = dt*Q/old_inflow_depth
     215        else:
     216                dt_Q_on_d = 0.0
     217
     218        # The depth update is:
     219        #    new_inflow_depth*inflow_area =
     220        #    old_inflow_depth*inflow_area -
     221        #    timestep*Q*(new_inflow_depth/old_inflow_depth)
     222        # Note the last term in () is a wet-dry improvement trick
     223        #
     224        factor = 1.0/(1.0 + dt_Q_on_d/self.inflow.get_area())
     225        new_inflow_depth = old_inflow_depth*factor
     226
     227        # For the momentum balance, note that Q also advects the momentum,
     228        # which has an average value of new_inflow_mom (or old_inflow_mom). For
     229        # consistency we keep using the (new_inflow_depth/old_inflow_depth)
     230        # factor for discharge:
     231        #
     232        #     new_inflow_xmom*inflow_area =
     233        #     old_inflow_xmom*inflow_area -
     234        #     timestep*Q*(new_inflow_depth/old_inflow_depth)*new_inflow_xmom
     235        # and:
     236        #     new_inflow_ymom*inflow_area =
     237        #     old_inflow_ymom*inflow_area -
     238        #     timestep*Q*(new_inflow_depth/old_inflow_depth)*new_inflow_ymom
     239        #
     240        # The choice of new_inflow_mom in the final term at the end might be
     241        # replaced with old_inflow_mom
     242        #
     243        factor2 = 1.0/(1.0 + dt_Q_on_d*new_inflow_depth/self.inflow.get_area())
     244        new_inflow_xmom = old_inflow_xmom*factor2
     245        new_inflow_ymom = old_inflow_ymom*factor2
     246       
     247        self.inflow.set_depths(new_inflow_depth)
     248
     249        #inflow.set_xmoms(Q/inflow.get_area())
     250        #inflow.set_ymoms(0.0)
     251
     252        self.inflow.set_xmoms(new_inflow_xmom)
     253        self.inflow.set_ymoms(new_inflow_ymom)
     254
     255        loss = (old_inflow_depth - new_inflow_depth)*self.inflow.get_area()
     256        xmom_loss = (old_inflow_xmom - new_inflow_xmom)*self.inflow.get_area()
     257        ymom_loss = (old_inflow_ymom - new_inflow_ymom)*self.inflow.get_area()
     258
     259        # set outflow
     260        if old_inflow_depth > 0.0 :
     261            timestep_star = timestep*new_inflow_depth/old_inflow_depth
     262        else:
     263            timestep_star = 0.0
     264
     265        outflow_extra_depth = Q*timestep_star/self.outflow.get_area()
     266        outflow_direction = - self.outflow.outward_culvert_vector
     267        #outflow_extra_momentum = outflow_extra_depth*barrel_speed*outflow_direction
     268           
     269        gain = outflow_extra_depth*self.outflow.get_area()
     270       
     271        #print gain, loss
     272        assert num.allclose(gain-loss, 0.0)
     273           
    301274        # Stats
    302275       
  • trunk/anuga_work/development/gareth/tests/ras_bridge/internal_boundary_functions.py

    r9601 r9602  
    2222              assumed constant over a cross-section, whereas substantial
    2323              cross-channel variations can occur in ANUGA, especialy near a
    24               bridge opening
    25             * Also ANUGA doesn't include side-wall friction over vertical steps
     24              bridge opening. The enquiry points used by ANUGA are a single
     25              location, so won't 'average-out' the cross-sectional variation
     26            * ANUGA doesn't include side-wall friction
    2627
    2728
Note: See TracChangeset for help on using the changeset viewer.