Exemplo n.º 1
0
    def test_inlet_variable_Q(self):
        """test_inlet_Q
        
        This tests that the inlet operator adds the correct amount of water
        """

        stage_0 = 11.0
        stage_1 = 10.0
        elevation_0 = 10.0
        elevation_1 = 10.0

        domain_length = 200.0
        domain_width = 200.0

        domain = self._create_domain(d_length=domain_length,
                                     d_width=domain_width,
                                     dx=10.0,
                                     dy=10.0,
                                     elevation_0=elevation_0,
                                     elevation_1=elevation_1,
                                     stage_0=stage_0,
                                     stage_1=stage_1)

        vol0 = domain.compute_total_volume()

        finaltime = 3.0

        #Make sure we are inthe right directory to find the
        #time series data for the inlets
        import os

        path = get_pathname_from_package('anuga.structures')
        filename1 = os.path.join(path, 'tests', 'data',
                                 'inlet_operator_test1.tms')
        filename2 = os.path.join(path, 'tests', 'data',
                                 'inlet_operator_test2.tms')

        line1 = [[95.0, 10.0], [105.0, 10.0]]
        Q1 = file_function(filename=filename1, quantities=['hydrograph'])

        line2 = [[10.0, 90.0], [20.0, 90.0]]
        Q2 = file_function(filename=filename2, quantities=['hydrograph'])

        Inlet_operator(domain, line1, Q1)
        Inlet_operator(domain, line2, Q2)

        for t in domain.evolve(yieldstep=1.0, finaltime=finaltime):
            #domain.write_time()
            #print domain.volumetric_balance_statistics()
            pass

        vol1 = domain.compute_total_volume()

        #print vol1-vol0

        assert numpy.allclose(13.5, vol1 - vol0, rtol=1.0e-8)
        assert numpy.allclose(vol1 - vol0,
                              domain.fractional_step_volume_integral,
                              rtol=1.0e-8)
Exemplo n.º 2
0
    def test_inlet_constant_Q(self):
        """test_inlet_Q
        
        This tests that the inlet operator adds the correct amount of water
        """

        stage_0 = 11.0
        stage_1 = 10.0
        elevation_0 = 10.0
        elevation_1 = 10.0

        domain_length = 200.0
        domain_width = 200.0

        domain = self._create_domain(d_length=domain_length,
                                     d_width=domain_width,
                                     dx=10.0,
                                     dy=10.0,
                                     elevation_0=elevation_0,
                                     elevation_1=elevation_1,
                                     stage_0=stage_0,
                                     stage_1=stage_1)

        vol0 = domain.compute_total_volume()

        finaltime = 3.0
        line1 = [[95.0, 10.0], [105.0, 10.0]]
        Q1 = 5.00

        line2 = [[10.0, 90.0], [20.0, 90.0]]
        Q2 = 10.0

        Inlet_operator(domain, line1, Q1, logging=False)
        Inlet_operator(domain, line2, Q2)

        for t in domain.evolve(yieldstep=1.0, finaltime=finaltime):
            #domain.write_time()
            #print domain.volumetric_balance_statistics()
            pass

        vol1 = domain.compute_total_volume()

        assert numpy.allclose((Q1 + Q2) * finaltime, vol1 - vol0, rtol=1.0e-8)
        assert numpy.allclose((Q1 + Q2) * finaltime,
                              domain.fractional_step_volume_integral,
                              rtol=1.0e-8)
Exemplo n.º 3
0
filename = os.path.join(path, 'example_rating_curve.csv')

gate = Boyd_box_operator(domain,
                         end_points=[[9.0, 2.5], [13.0, 2.5]],
                         losses=1.5,
                         width=1.5,
                         height=10.0,
                         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 = 1.0
Inlet_operator(domain, line, Q)

##-----------------------------------------------------------------------
## Setup boundary conditions
##-----------------------------------------------------------------------

## Inflow based on Flow Depth and Approaching Momentum
Br = anuga.Reflective_boundary(domain)  # Solid reflective wall

domain.set_boundary({'left': Br, 'right': Br, 'top': Br, 'bottom': Br})

##-----------------------------------------------------------------------
## Evolve system through time
##-----------------------------------------------------------------------

#min_delta_w = sys.maxint
Exemplo n.º 4
0
#                            use_velocity_head=False,
#                            manning=0.013,
#                            verbose=False)


line0 = [[0.0, 5.0], [0.0, 10.0]]


Q = file_function('test_hydrograph.tms', quantities=['hydrograph'])

#inlet0 = Inlet_operator(domain, line0, Q, label='first inlet')


line1 = [[1.0, 5.0], [2.0, 10.0]]
poly1 = [[1.0, 5.0], [2.0, 5.0], [2.0, 10.0], [1.0, 10.0]]
inlet1 = Inlet_operator(domain, poly1, 2.0)



##-----------------------------------------------------------------------
## Setup boundary conditions
##-----------------------------------------------------------------------

## Inflow based on Flow Depth and Approaching Momentum
Bi = anuga.Dirichlet_boundary([2.0, 0.0, 0.0])
Br = anuga.Reflective_boundary(domain)              # Solid reflective wall
#Bo = anuga.Dirichlet_boundary([-5, 0, 0])           # Outflow

## Upstream and downstream conditions that will exceed the rating curve
## I.e produce delta_h outside the range [0, 10] specified in the the 
## file example_rating_curve.csv
Exemplo n.º 5
0
#                            use_momentum_jet=True,
#                            use_velocity_head=False,
#                            manning=0.013,
#                            verbose=False)

line0 = [[0.0, 5.0], [0.0, 10.0]]

Q = file_function(
    '/home/lixinhou/anuga_core/anuga/parallel/data/test_hydrograph.tms',
    quantities=['hydrograph'])

#inlet0 = Inlet_operator(domain, line0, Q, label='first inlet')

line1 = [[1.0, 5.0], [2.0, 10.0]]
poly1 = [[1.0, 5.0], [2.0, 5.0], [2.0, 10.0], [1.0, 10.0]]
inlet1 = Inlet_operator(domain, poly1, 2.0)

##-----------------------------------------------------------------------
## Setup boundary conditions
##-----------------------------------------------------------------------

## Inflow based on Flow Depth and Approaching Momentum
Bi = anuga.Dirichlet_boundary([2.0, 0.0, 0.0])
Br = anuga.Reflective_boundary(domain)  # Solid reflective wall
#Bo = anuga.Dirichlet_boundary([-5, 0, 0])           # Outflow

## Upstream and downstream conditions that will exceed the rating curve
## I.e produce delta_h outside the range [0, 10] specified in the the
## file example_rating_curve.csv
#Btus = anuga.Time_boundary(domain, \
#lambda t: [100*num.sin(2*pi*(t-4)/10), 0.0, 0.0])
Exemplo n.º 6
0
#                            use_velocity_head=False,
#                            manning=0.013,
#                            verbose=False)


line0 = [[0.0, 5.0], [0.0, 10.0]]


Q = file_function("test_hydrograph.tms", quantities=["hydrograph"])

# inlet0 = Inlet_operator(domain, line0, Q, label='first inlet')


line1 = [[1.0, 5.0], [2.0, 10.0]]
poly1 = [[1.0, 5.0], [2.0, 5.0], [2.0, 10.0], [1.0, 10.0]]
inlet1 = Inlet_operator(domain, poly1, 2.0)


##-----------------------------------------------------------------------
## Setup boundary conditions
##-----------------------------------------------------------------------

## Inflow based on Flow Depth and Approaching Momentum
Bi = anuga.Dirichlet_boundary([2.0, 0.0, 0.0])
Br = anuga.Reflective_boundary(domain)  # Solid reflective wall
# Bo = anuga.Dirichlet_boundary([-5, 0, 0])           # Outflow

## Upstream and downstream conditions that will exceed the rating curve
## I.e produce delta_h outside the range [0, 10] specified in the the
## file example_rating_curve.csv
# Btus = anuga.Time_boundary(domain, \