Пример #1
0
    def test_advection_example(self):
        #Test that system can evolve

        from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular

        points, vertices, boundary = rectangular(6, 6)

        #Create advection domain with direction (1,-1)
        domain = Advection_Domain(points, vertices, boundary,
                                        velocity=[1.0, -1.0])

        # Initial condition is zero by default

        #Boundaries
        T = Transmissive_boundary(domain)
        D = Dirichlet_boundary(num.array([3.1415]))

        domain.set_boundary( {'left': D, 'right': T, 'bottom': T, 'top': T} )
        domain.check_integrity()

        #Check that the boundary value gets propagated to all elements
        for t in domain.evolve(yieldstep = 0.05, finaltime = 10):
            if num.allclose(domain.quantities['stage'].centroid_values, 3.1415):
                break

        assert num.allclose(domain.quantities['stage'].centroid_values, 3.1415)