Ignore:
Timestamp:
Sep 1, 2010, 6:11:25 PM (9 years ago)
Author:
steve
Message:

Added enquiry points to culverts

File:
1 edited

Legend:

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

    r7981 r7984  
    2222                 width,
    2323                 height=None,
     24                 apron=None,
     25                 enquiry_gap=0.2,
    2426                 verbose=False):
    2527       
    2628        self.domain = domain
    2729        self.domain.set_fractional_step_operator(self)
    28         end_points = [end_point0, end_point1]
     30        self.end_points = [end_point0, end_point1]
    2931       
    3032        if height is None:
    3133            height = width
    3234
    33         self.width = width
     35        if apron is None:
     36            apron = width
     37
     38        self.width  = width
    3439        self.height = height
     40        self.apron  = apron
     41        self.enquiry_gap = enquiry_gap
     42        self.verbose = verbose
    3543       
    36         self.culvert = Boyd_box_culvert(self.domain, end_points, self.width, self.height)
    37         print self.culvert
     44        self.culvert = Boyd_box_culvert(self.domain,
     45                                        self.end_points,
     46                                        self.width,
     47                                        self.height,
     48                                        self.apron,
     49                                        self.enquiry_gap,
     50                                        self.verbose)
     51       
    3852        self.routine = self.culvert.routine
    39         print self.routine
    40         self.inlets = self.culvert.get_inlets()
    41    
    42         self.print_stats()
     53
     54        self.inlets  = self.culvert.get_inlets()
     55
     56        if self.verbose:
     57            self.print_stats()
    4358
    4459
     
    4863       
    4964        Q, barrel_speed, outlet_depth = self.routine()
     65
    5066
    5167        inflow  = self.routine.get_inflow()
     
    5470
    5571        old_inflow_height = inflow.get_average_height()
    56                 old_inflow_xmom = inflow.get_average_xmom()
    57                 old_inflow_ymom = inflow.get_average_ymom()
    58                
    59                 if old_inflow_height > 0.0 :
    60                         Qstar = Q/old_inflow_height/inflow.get_area()
    61                 else:
    62                         Qstar = 0.0
    63 
    64                 factor = 1.0/(1.0 + Qstar*timestep)
    65 
    66                
    67                
    68                 new_inflow_height = old_inflow_height*factor
    69                 new_inflow_xmom = old_inflow_xmom*factor
    70                 new_inflow_ymom = old_inflow_ymom*factor
     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
    7187               
    7288
    7389        inflow.set_heights(new_inflow_height)
     90
     91        #inflow.set_xmoms(Q/inflow.get_area())
     92        #inflow.set_ymoms(0.0)
     93
     94
    7495        inflow.set_xmoms(new_inflow_xmom)
    7596        inflow.set_ymoms(new_inflow_ymom)
    7697
    77                
    78                 # set outflow
    79                 if old_inflow_height > 0.0 :
    80                         timestep_star = timestep*new_inflow_height/old_inflow_height
    81                 else:
    82                         timestep_star = 0.0
    83                
    84                 print Q, barrel_speed, outlet_depth, Qstar, factor, timestep_star
    85                
     98
     99        loss = (old_inflow_height - new_inflow_height)*inflow.get_area()
     100
     101               
     102        # set outflow
     103        if old_inflow_height > 0.0 :
     104            timestep_star = timestep*new_inflow_height/old_inflow_height
     105        else:
     106            timestep_star = 0.0
     107
    86108               
    87109        outflow_extra_height = Q*timestep_star/outflow.get_area()
     
    90112               
    91113
    92         outflow.set_heights(outflow.get_average_height() + outflow_extra_height)
    93         outflow.set_xmoms(outflow.get_average_xmom() + outflow_extra_momentum[0] )
    94         outflow.set_ymoms(outflow.get_average_ymom() + outflow_extra_momentum[1] )
     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()
    95133
    96134    def print_stats(self):
     
    99137        print 'Generic Culvert Operator'
    100138        print '====================================='
     139
     140        print 'Culvert'
     141        print self.culvert
     142
     143        print 'Culvert Routine'
     144        print self.routine
    101145       
    102146        for i, inlet in enumerate(self.inlets):
Note: See TracChangeset for help on using the changeset viewer.