Ignore:
Timestamp:
Aug 27, 2010, 2:30:30 PM (12 years ago)
Author:
habili
Message:

Refactoring of the culvert code.

File:
1 edited

Legend:

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

    r7977 r7978  
    33import anuga.utilities.log as log
    44import box_culvert
     5import culvert_routines
    56
    67class Culvert_operator:
     
    1718    def __init__(self,
    1819                 domain,
    19                  end_point0=None,
    20                  end_point1=None,
    21                  width=None,
     20                 end_point0,
     21                 end_point1,
     22                 width,
    2223                 height=None,
    2324                 verbose=False):
     
    4344        timestep = self.domain.get_timestep()
    4445
    45         inflow  = self.inlets[0]
    46         outflow = self.inlets[1]
    47 
    48         # Determine flow direction based on total energy difference
    49         delta_total_energy = inflow.get_average_total_energy() - outflow.get_average_total_energy()
    50 
    51         if delta_total_energy < 0:
    52             inflow  = self.inlets[1]
    53             outflow = self.inlets[0]
    54             delta_total_energy = -delta_total_energy
    55 
    56         delta_z = inflow.get_average_elevation() - outflow.get_average_elevation()
    57         culvert_slope = delta_z/self.culvert.get_culvert_length()
    58 
    59         # Determine controlling energy (driving head) for culvert
    60         if inflow.get_average_specific_energy() > delta_total_energy:
    61             # Outlet control
    62             driving_head = delta_total_energy
    63         else:
    64             # Inlet control
    65             driving_head = inflow.get_average_specific_energy()
    66            
    67         # Transfer
    68         from culvert_routines import boyd_box, boyd_circle
    69         Q, barrel_velocity, culvert_outlet_depth =\
    70                               boyd_circle(inflow.get_average_height(),
    71                                          outflow.get_average_height(),
    72                                          inflow.get_average_speed(),
    73                                          outflow.get_average_speed(),
    74                                          inflow.get_average_specific_energy(),
    75                                          delta_total_energy,
    76                                          culvert_length=self.culvert.get_culvert_length(),
    77                                          culvert_width=self.width,
    78                                          culvert_height=self.height,
    79                                          manning=0.01)
     46        from culvert_routines import Culvert_routines
     47        culvert_routine = culvert_routines.Culvert_routines(self.culvert)
     48       
     49        Q, barrel_velocity, culvert_outlet_depth = culvert_routine.boyd_circle()
    8050
    8151        transfer_water = Q*timestep
     52
     53        inflow = culvert_routine.get_inflow()
     54        outflow = culvert_routine.get_outflow()
    8255
    8356        inflow.set_heights(inflow.get_average_height() - transfer_water)
Note: See TracChangeset for help on using the changeset viewer.