return z domain.set_quantity('elevation', topography) domain.set_quantity('friction', 0.01) # Constant friction domain.set_quantity('stage', expression='elevation') # Dry initial condition filename = os.path.join(path, 'example_rating_curve.csv') Boyd_pipe_operator(domain, label='1_5m_inletctl', end_points=[[9.0, 2.5], [13.0, 2.5]], losses=1.5, diameter=1.5, barrels=2.0, apron=5.0, use_momentum_jet=True, use_velocity_head=False, logging=True, manning=0.013, verbose=False) #Boyd_box_operator(domain, label = '1_5m_inletctl', #end_points=[[9.0, 2.5],[13.0, 2.5]], #losses=1.5, #width=1.5, #height=1.5, #apron=5.0, #use_momentum_jet=True, #use_velocity_head=False, #logging=True, #manning=0.013,
domain.set_quantity('elevation', topography) domain.set_quantity('friction', 0.01) # Constant friction domain.set_quantity('stage', expression='elevation') # Dry initial condition filename = os.path.join(path, 'example_rating_curve.csv') end_point0 = num.array([9.0, 2.5]) end_point1 = num.array([13.0, 2.5]) Boyd_pipe_operator( domain, #end_point0=[9.0, 2.5], #end_point1=[13.0, 2.5], #exchange_line0=[[9.0, 1.75],[9.0, 3.25]], #exchange_line1=[[13.0, 1.75],[13.0, 3.25]], losses=1.5, end_points=[end_point0, end_point1], diameter=1.5, apron=0.5, use_momentum_jet=True, use_velocity_head=False, manning=0.013, verbose=False) line = [[0.0, 5.0], [0.0, 10.0]] Q = 5.0 #Inlet_operator(domain, line, Q) ##----------------------------------------------------------------------- ## Setup boundary conditions ##-----------------------------------------------------------------------
#domain.set_name('merewether1') # Name of sww file #dplotter = anuga.Domain_plotter(domain) #plt.triplot(dplotter.triang, linewidth = 0.4); domain.set_quantity('elevation', 0.5) domain.set_quantity('friction', 0.01) # Constant friction domain.set_quantity('stage', expression='elevation') # Dry initial condition Bi = anuga.Dirichlet_boundary([2.0, 0, 0]) # Inflow Bo = anuga.Dirichlet_boundary([-2, 0, 0]) Br = anuga.Reflective_boundary(domain) # Solid reflective wall domain.set_boundary({'left': Bi, 'right': Br, 'top': Br, 'bottom': Br}) end_point0 = num.array([0.35, 2.5]) end_point1 = num.array([17.0, 2.5]) """ #if I use this method then the surface would have 2 raised water peaks. Boyd_pipe_operator(domain, #end_point0=[9.0, 2.5], #end_point1=[13.0, 2.5], #exchange_line0=[[9.0, 1.75],[9.0, 3.25]], #exchange_line1=[[13.0, 1.75],[13.0, 3.25]], losses=1.5, end_points=[end_point0, end_point1], diameter=0.375, #apron=0.5, use_momentum_jet=True, use_velocity_head=False, manning=0.013, #logging = True, #label = 'culvert_output',
def test_boyd_non_skew5(self): """test_boyd_non_skew This tests the Boyd routine with data obtained from culvertw application 1.1 by IceMindserer BD Parkinson, calculation code by MJ Boyd """ stage_0 = 15.0 #change stage_1 = 14.0 #change elevation_0 = 11.0 elevation_1 = 10.0 domain_length = 200.0 domain_width = 200.0 culvert_length = 20.0 culvert_width = 1.2 ##culvert_height = 3.66 culvert_losses = {'inlet':0.5, 'outlet':1.0, 'bend':0.0, 'grate':0.0, 'pier': 0.0, 'other': 0.0} culvert_mannings = 0.013 culvert_apron = 0.0 enquiry_gap = 5.0 expected_Q = 3.70 expected_v = 3.27 expected_d = 1.20 domain = self._create_domain(d_length=domain_length, d_width=domain_width, dx = 5.0, dy = 5.0, elevation_0 = elevation_0, elevation_1 = elevation_1, stage_0 = stage_0, stage_1 = stage_1) #print 'Defining Structures' ep0 = numpy.array([domain_length/2-culvert_length/2, 100.0]) ep1 = numpy.array([domain_length/2+culvert_length/2, 100.0]) culvert = Boyd_pipe_operator(domain, losses=culvert_losses, diameter=culvert_width, end_points=[ep0, ep1], #height=culvert_height, apron=culvert_apron, enquiry_gap=enquiry_gap, use_momentum_jet=False, use_velocity_head=False, manning=culvert_mannings, logging=False, label='1.2pipe', verbose=False) #culvert.determine_inflow_outflow() ( Q, v, d ) = culvert.discharge_routine() if verbose: print 'test_boyd_non_skew5' print 'Q: ', Q, 'expected_Q: ', expected_Q print 'v: ', v, 'expected_v: ', expected_v print 'd: ', d, 'expected_d: ', expected_d assert numpy.allclose(Q, expected_Q, rtol=1.0e-2) #inflow assert numpy.allclose(v, expected_v, rtol=1.0e-2) #outflow velocity assert numpy.allclose(d, expected_d, rtol=1.0e-2) #depth at outlet used to calc v
z[i] += 2.5 - 1.0 * (x[i] - 12.0) # Sloping D/S Face return z domain.set_quantity('elevation', topography) domain.set_quantity('friction', 0.01) # Constant friction domain.set_quantity('stage', expression='elevation') # Dry initial condition filename = os.path.join(path, 'example_rating_curve.csv') Boyd_pipe_operator(domain, end_points=[[9.0, 2.5], [13.0, 2.5]], losses=1.5, diameter=1.5, apron=5.0, use_momentum_jet=True, use_velocity_head=False, manning=0.013, verbose=False) line = [[0.0, 5.0], [0.0, 10.0]] Q = 5.0 Inlet_operator(domain, line, Q) ##----------------------------------------------------------------------- ## Setup boundary conditions ##----------------------------------------------------------------------- ## Inflow based on Flow Depth and Approaching Momentum Bi = anuga.Dirichlet_boundary([2.0, 0.0, 0.0])