Ejemplo n.º 1
0
    def test_flux_2_triangles(self):
        """Flow between two triangles
        Check that fluxes have opposite signs
        """

        a = [0.0, 0.5]
        b = [0.0, 0.0]
        c = [0.5, 0.5]
        d = [0.5, 0.0]

        points = [a, b, c, d]
        vertices = [ [0,1,2], [3,2,1] ]
        domain = Advection_Domain(points, vertices)
        domain.check_integrity()


        #Populate boundary array with dirichlet conditions.
        domain.neighbours = num.array([[1,-1,-2], [0,-3,-4]])
        domain.set_quantity('stage', [1.0, 0.0], location='centroids')
        domain.distribute_to_vertices_and_edges()

        domain.compute_fluxes()

        X = domain.quantities['stage'].explicit_update
        assert X[0] == -X[1]
Ejemplo n.º 2
0
    def test_flux_1_triangle0(self):
        a = [0.0, 0.5]
        b = [0.0, 0.0]
        c = [0.5, 0.5]

        points = [a, b, c]
        vertices = [ [0,1,2] ]
        domain = Advection_Domain(points, vertices)
        domain.check_integrity()


        #Populate boundary array with dirichlet conditions.
        domain.neighbours = num.array([[-1,-2,-3]])
        domain.quantities['stage'].boundary_values[:] = 1.0

        domain.order = 1

        domain.distribute_to_vertices_and_edges() #Use first order default

        domain.check_integrity()

        domain.compute_fluxes()
        U = -domain.quantities['stage'].explicit_update
        R = -0.5/domain.areas[0]

        assert U==R, '%s %s' %(U, R)
    def test_flux_1_triangle1(self):

        a = [0.0, 0.5]
        b = [0.0, 0.0]
        c = [0.5, 0.5]

        points = [a, b, c]
        vertices = [[0, 1, 2]]
        domain = Advection_Domain(points, vertices)
        domain.check_integrity()

        domain.set_quantity('stage', [1.0], location='centroids')

        domain.distribute_to_vertices_and_edges()
        domain.check_integrity()

        domain.compute_fluxes()
        U = -domain.quantities['stage'].explicit_update
        R = 0.5 / domain.areas[0]

        assert U == R, '%s %s' % (U, R)
    def test_flux_1_triangle1(self):

        a = [0.0, 0.5]
        b = [0.0, 0.0]
        c = [0.5, 0.5]

        points = [a, b, c]
        vertices = [ [0,1,2] ]
        domain = Advection_Domain(points, vertices)
        domain.check_integrity()

        domain.set_quantity('stage', [1.0], location='centroids')

        domain.distribute_to_vertices_and_edges()
        domain.check_integrity()


        domain.compute_fluxes()
        U = -domain.quantities['stage'].explicit_update
        R = 0.5/domain.areas[0]

        assert U==R, '%s %s' %(U, R)