Changeset 8828


Ignore:
Timestamp:
Apr 15, 2013, 9:00:10 PM (12 years ago)
Author:
steve
Message:

Still cleaning up boyd operators

Location:
trunk/anuga_core
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/generic_domain.py

    r8810 r8828  
    15661566
    15671567            # Update any other quantities that might be useful
    1568             self.update_other_quantities()
     1568            # self.update_other_quantities()
    15691569
    15701570            # Update extrema if necessary (for reporting)
  • trunk/anuga_core/source/anuga/shallow_water/shallow_water_domain.py

    r8815 r8828  
    14011401        """
    14021402
    1403 
    1404 
     1403        return
     1404   
     1405        """
    14051406        if self.flow_algorithm == 'yusuke':
    14061407            return
     
    14301431#                raise Exception('Unknown order')
    14311432
    1432 
     1433        """
    14331434
    14341435    def update_centroids_of_velocities_and_height(self):
  • trunk/anuga_core/source/anuga/structures/boyd_box_operator.py

    r8827 r8828  
    9191    def discharge_routine(self):
    9292
    93 
     93        local_debug = False
    9494
    9595        if self.use_velocity_head:
    96             self.delta_total_energy = self.inlets[0].get_enquiry_total_energy() - self.inlets[1].get_enquiry_total_energy()
     96            self.delta_total_energy = \
     97                 self.inlets[0].get_enquiry_total_energy() - self.inlets[1].get_enquiry_total_energy()
    9798        else:
    98             self.delta_total_energy = self.inlets[0].get_enquiry_stage() - self.inlets[1].get_enquiry_stage()
     99            self.delta_total_energy = \
     100                 self.inlets[0].get_enquiry_stage() - self.inlets[1].get_enquiry_stage()
    99101
    100102        self.inflow  = self.inlets[0]
     
    106108            self.delta_total_energy = -self.delta_total_energy
    107109
    108 
    109 
    110 
    111 
    112         local_debug = False
    113110
    114111        if self.inflow.get_enquiry_depth() > 0.01: #this value was 0.01:
  • trunk/anuga_core/source/anuga/structures/inlet_operator.py

    r8680 r8828  
    3030        anuga.Operator.__init__(self, domain, description, label, logging, verbose)
    3131
    32        
    3332        self.line = numpy.array(line, dtype='d')
    3433
     
    5150
    5251        self.set_default(default)
     52
     53        self.activate_logging()
    5354
    5455
  • trunk/anuga_core/source/anuga/structures/test_boyd_box_operator.py

    r8129 r8828  
    130130                                    use_velocity_head=False,
    131131                                    manning=culvert_mannings,
     132                                    logging=True,
    132133                                    label='3.6x3.6RCBC',
    133134                                    verbose=False)
  • trunk/anuga_core/source/anuga/structures/test_inlet_operator.py

    r8506 r8828  
    114114        Q2 = 10.0
    115115       
    116         Inlet_operator(domain, line1, Q1)
     116        Inlet_operator(domain, line1, Q1, logging=True)
    117117        Inlet_operator(domain, line2, Q2)
    118118
  • trunk/anuga_core/source/anuga_parallel/parallel_boyd_box_operator.py

    r8826 r8828  
    33import pypar
    44
    5 from anuga.structures.boyd_box_operator import discharge_routine as sequential_discharge_routine
     5from anuga.structures.boyd_box_operator import boyd_box_function
    66
    77from parallel_inlet_operator import Parallel_Inlet_operator
     
    382382                #print "ZZZZZ: driving energy = %f" %(self.driving_energy)
    383383
    384                 depth = self.culvert_height
    385                 width = self.culvert_width
    386                 flow_width = self.culvert_width
    387                 driving_energy = self.driving_energy
    388                 sum_loss = self.sum_loss
    389                 culvert_length= self.culvert_length
    390                 manning = self.manning
    391                 delta_total_energy = self.delta_total_energy
     384#                depth = self.culvert_height
     385#                width = self.culvert_width
     386#                flow_width = self.culvert_width
     387#                driving_energy = self.driving_energy
     388#                sum_loss = self.sum_loss
     389#                culvert_length= self.culvert_length
     390#                manning = self.manning
     391#                delta_total_energy = self.delta_total_energy
    392392
    393393
    394394           
    395 
    396 
    397                 # intially assume the culvert flow is controlled by the inlet
    398                 # check unsubmerged and submerged condition and use Min Q
    399                 # but ensure the correct flow area and wetted perimeter are used
    400                 Q_inlet_unsubmerged = 0.544*anuga.g**0.5*width*driving_energy**1.50 # Flow based on Inlet Ctrl Inlet Unsubmerged
    401                 Q_inlet_submerged = 0.702*anuga.g**0.5*width*depth**0.89*driving_energy**0.61  # Flow based on Inlet Ctrl Inlet Submerged
    402 
    403                 # FIXME(Ole): Are these functions really for inlet control?
    404                 if Q_inlet_unsubmerged < Q_inlet_submerged:
    405                     Q = Q_inlet_unsubmerged
    406                     dcrit = (Q**2/anuga.g/width**2)**0.333333
    407                     if dcrit > depth:
    408                         dcrit = depth
    409                         flow_area = width*dcrit
    410                         perimeter= 2.0*(width+dcrit)
    411                     else: # dcrit < depth
    412                         flow_area = width*dcrit
    413                         perimeter= 2.0*dcrit+width
    414                     outlet_culvert_depth = dcrit
    415                     case = 'Inlet unsubmerged Box Acts as Weir'
    416                 else: # Inlet Submerged but check internal culvert flow depth
    417                     Q = Q_inlet_submerged
    418                     dcrit = (Q**2/anuga.g/width**2)**0.333333
    419                     if dcrit > depth:
    420                         dcrit = depth
    421                         flow_area = width*dcrit
    422                         perimeter= 2.0*(width+dcrit)
    423                     else: # dcrit < depth
    424                         flow_area = width*dcrit
    425                         perimeter= 2.0*dcrit+width
    426                     outlet_culvert_depth = dcrit
    427                     case = 'Inlet submerged Box Acts as Orifice'
    428 
    429                 dcrit = (Q**2/anuga.g/width**2)**0.333333
    430                 # May not need this .... check if same is done above
    431                 outlet_culvert_depth = dcrit
    432                 if outlet_culvert_depth > depth:
    433                     outlet_culvert_depth = depth  # Once again the pipe is flowing full not partfull
    434                     flow_area = width*depth  # Cross sectional area of flow in the culvert
    435                     perimeter = 2*(width+depth)
    436                     self.case = 'Inlet CTRL Outlet unsubmerged PIPE PART FULL'
    437                 else:
    438                     flow_area = width * outlet_culvert_depth
    439                     perimeter = width+2*outlet_culvert_depth
    440                     case = 'INLET CTRL Culvert is open channel flow we will for now assume critical depth'
    441                 # Initial Estimate of Flow for Outlet Control using energy slope
    442                 #( may need to include Culvert Bed Slope Comparison)
    443                 hyd_rad = flow_area/perimeter
    444                 culvert_velocity = math.sqrt(delta_total_energy/((sum_loss/2/anuga.g)+(manning**2*culvert_length)/hyd_rad**1.33333))
    445                 Q_outlet_tailwater = flow_area * culvert_velocity
    446 
    447 
    448                 if delta_total_energy < driving_energy:
    449                     # Calculate flows for outlet control
    450 
    451                     # Determine the depth at the outlet relative to the depth of flow in the Culvert
    452                     if outflow_enq_depth > depth:        # The Outlet is Submerged
    453                         outlet_culvert_depth=depth
    454                         flow_area=width*depth       # Cross sectional area of flow in the culvert
    455                         perimeter=2.0*(width+depth)
    456                         case = 'Outlet submerged'
    457                     else:   # Here really should use the Culvert Slope to calculate Actual Culvert Depth & Velocity
    458                         dcrit = (Q**2/anuga.g/width**2)**0.333333
    459                         outlet_culvert_depth=dcrit   # For purpose of calculation assume the outlet depth = Critical Depth
    460                         if outlet_culvert_depth > depth:
    461                             outlet_culvert_depth=depth
    462                             flow_area=width*depth
    463                             perimeter=2.0*(width+depth)
    464                             case = 'Outlet is Flowing Full'
    465                         else:
    466                             flow_area=width*outlet_culvert_depth
    467                             perimeter=(width+2.0*outlet_culvert_depth)
    468                             case = 'Outlet is open channel flow'
    469 
    470                     hyd_rad = flow_area/perimeter
    471 
    472 
    473 
    474                     # Final Outlet control velocity using tail water
    475                     culvert_velocity = math.sqrt(delta_total_energy/((sum_loss/2/anuga.g)+(manning**2*culvert_length)/hyd_rad**1.33333))
    476                     Q_outlet_tailwater = flow_area * culvert_velocity
    477 
    478                     Q = min(Q, Q_outlet_tailwater)
    479                 else:
    480 
    481                     pass
    482                     #FIXME(Ole): What about inlet control?
    483 
    484                 culv_froude=math.sqrt(Q**2*flow_width/(anuga.g*flow_area**3))
    485                
    486                 if local_debug:
    487                     anuga.log.critical('FLOW AREA = %s' % str(flow_area))
    488                     anuga.log.critical('PERIMETER = %s' % str(perimeter))
    489                     anuga.log.critical('Q final = %s' % str(Q))
    490                     anuga.log.critical('FROUDE = %s' % str(culv_froude))
    491 
    492                 # Determine momentum at the outlet
    493                 barrel_velocity = Q/(flow_area + anuga.velocity_protection/flow_area)
    494 
     395                Q, barrel_velocity, outlet_culvert_depth, case = \
     396                              boyd_box_function(depth               =self.culvert_height,
     397                                                width               =self.culvert_width,
     398                                                flow_width          =self.culvert_width,
     399                                                length              =self.culvert_length,
     400                                                driving_energy      =self.driving_energy,
     401                                                delta_total_energy  =self.delta_total_energy,
     402                                                outlet_enquiry_depth=outflow_enq_depth,
     403                                                sum_loss            =self.sum_loss,
     404                                                manning             =self.manning)
    495405
    496406               
  • trunk/anuga_core/source/anuga_parallel/test_all.py

    r8426 r8828  
    2020#List files that should be excluded from the testing process.
    2121#E.g. if they are known to fail and under development
    22 exclude_files = ['test_failure.py']
     22exclude_files = ['test_failure.py', 'test_parallel_boyd_pipe_operator.py']
    2323
    2424# Directories that should not be searched for test files.
  • trunk/anuga_core/source/anuga_parallel/test_parallel_frac_op.py

    r8507 r8828  
    167167    boyd_box0 = None
    168168   
    169     inlet0 = Inlet_operator(domain, line0, Q0, verbose = False)
    170     inlet1 = Inlet_operator(domain, line1, Q1, verbose = False)
     169    inlet0 = Inlet_operator(domain, line0, Q0, logging=True, description='inlet0', verbose = False)
     170    inlet1 = Inlet_operator(domain, line1, Q1, logging=True, description='inlet1', verbose = False)
    171171   
    172172    # Enquiry point [ 19.    2.5] is contained in two domains in 4 proc case
     
    180180                                  use_velocity_head=False,
    181181                                  manning=0.013,
     182                                  logging=True,
     183                                  description='boyd_box_0',
    182184                                  verbose=False)
    183185       
  • trunk/anuga_core/test_all.py

    r8779 r8828  
    1818try:
    1919    import pypar
     20except:
     21    print 'anuga_parallel tests not run as pypar not installed'
     22else:
    2023    os.chdir(buildroot)
    2124    os.chdir('source')
     
    2528    print 'Changing to', os.getcwd()
    2629    execfile('test_all.py')
    27 except:
    28     print 'anuga_parallel tests not run as pypar not installed'
    29 
    3030
    3131
Note: See TracChangeset for help on using the changeset viewer.