Changeset 5879


Ignore:
Timestamp:
Oct 30, 2008, 12:41:02 PM (16 years ago)
Author:
ole
Message:

Added test that boundary condition is being evaluated at the right time

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/shallow_water/test_shallow_water_domain.py

    r5873 r5879  
    557557        domain.check_integrity()
    558558
     559       
     560       
     561       
     562    def test_boundary_condition_time(self):
     563        """test_boundary_condition_time
     564       
     565        This tests that boundary conditions are evaluated
     566        using the right time from domain.
     567
     568        """
     569       
     570        # Setup computational domain
     571        from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
     572
     573
     574        #--------------------------------------------------------------
     575        # Setup computational domain
     576        #--------------------------------------------------------------
     577        N = 5
     578        points, vertices, boundary = rectangular_cross(N, N)
     579        domain = Domain(points, vertices, boundary)
     580
     581        #--------------------------------------------------------------
     582        # Setup initial conditions
     583        #--------------------------------------------------------------
     584        domain.set_quantity('elevation', 0.0)
     585        domain.set_quantity('friction', 0.0)
     586        domain.set_quantity('stage', 0.0)
     587
     588
     589        #--------------------------------------------------------------
     590        # Setup boundary conditions
     591        #--------------------------------------------------------------
     592        Bt = Time_boundary(domain=domain,             # Time dependent boundary 
     593                           f=lambda t: [t, 0.0, 0.0])
     594       
     595        Br = Reflective_boundary(domain)              # Reflective wall
     596
     597        domain.set_boundary({'left': Bt, 'right': Br, 'top': Br, 'bottom': Br})
     598       
     599        for t in domain.evolve(yieldstep = 10, finaltime = 20.0):
     600            q = Bt.evaluate()
     601   
     602            # FIXME (Ole): This test would not have passed in
     603            # changeset:5846.
     604            msg = 'Time boundary not evaluated correctly'
     605            assert allclose(t, q[0]), msg
     606           
     607       
    559608
    560609    def test_compute_fluxes0(self):
Note: See TracChangeset for help on using the changeset viewer.