Changeset 646


Ignore:
Timestamp:
Dec 1, 2004, 12:30:19 PM (20 years ago)
Author:
duncan
Message:

this has a test for boundary conditions set to None

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/pyvolution/test_shallow_water.py

    r623 r646  
    259259
    260260
    261        
     261    def test_boundary_conditionsII(self):
     262       
     263        a = [0.0, 0.0]
     264        b = [0.0, 2.0]
     265        c = [2.0,0.0]
     266        d = [0.0, 4.0]
     267        e = [2.0, 2.0]
     268        f = [4.0,0.0]
     269
     270        points = [a, b, c, d, e, f]
     271        #bac, bce, ecf, dbe
     272        vertices = [ [1,0,2], [1,2,4], [4,2,5], [3,1,4] ]
     273        boundary = { (0, 0): 'Third',
     274                     (0, 2): 'First',
     275                     (2, 0): 'Second',
     276                     (2, 1): 'Second',
     277                     (3, 1): 'Second',
     278                     (3, 2): 'Third',
     279                     (0, 1): 'Internal'}                                         
     280                     
     281
     282        domain = Domain(points, vertices, boundary)
     283        domain.check_integrity()
     284
     285
     286        domain.set_quantity('level', [[1,2,3], [5,5,5],
     287                                      [0,0,9], [-6, 3, 3]])
     288
     289        domain.set_quantity('xmomentum', [[1,1,1], [2,2,2],
     290                                          [3,3,3], [4, 4, 4]])
     291
     292        domain.set_quantity('ymomentum', [[10,10,10], [20,20,20],
     293                                          [30,30,30], [40, 40, 40]])       
     294
     295
     296        D = Dirichlet_boundary([5,2,1])
     297        T = Transmissive_boundary(domain)
     298        R = Reflective_boundary(domain)
     299        domain.set_boundary( {'First': D, 'Second': T, 'Third': R, 'Internal':None})
     300       
     301        domain.update_boundary()
     302
     303        #Level
     304        assert domain.quantities['level'].boundary_values[0] == 2.5
     305        assert domain.quantities['level'].boundary_values[0] ==\
     306               domain.get_conserved_quantities(0, edge=0)[0] #Reflective (2.5)
     307        assert domain.quantities['level'].boundary_values[1] == 5. #Dirichlet
     308        assert domain.quantities['level'].boundary_values[2] ==\
     309               domain.get_conserved_quantities(2, edge=0)[0] #Transmissive (4.5)
     310        assert domain.quantities['level'].boundary_values[3] ==\
     311               domain.get_conserved_quantities(2, edge=1)[0] #Transmissive (4.5)
     312        assert domain.quantities['level'].boundary_values[4] ==\
     313               domain.get_conserved_quantities(3, edge=1)[0] #Transmissive (-1.5)
     314        assert domain.quantities['level'].boundary_values[5] ==\
     315               domain.get_conserved_quantities(3, edge=2)[0] #Reflective (-1.5)
     316
     317        #Xmomentum
     318        assert domain.quantities['xmomentum'].boundary_values[0] == 1.0 #Reflective
     319        assert domain.quantities['xmomentum'].boundary_values[1] == 2. #Dirichlet
     320        assert domain.quantities['xmomentum'].boundary_values[2] ==\
     321               domain.get_conserved_quantities(2, edge=0)[1] #Transmissive
     322        assert domain.quantities['xmomentum'].boundary_values[3] ==\
     323               domain.get_conserved_quantities(2, edge=1)[1] #Transmissive
     324        assert domain.quantities['xmomentum'].boundary_values[4] ==\
     325               domain.get_conserved_quantities(3, edge=1)[1] #Transmissive
     326        assert domain.quantities['xmomentum'].boundary_values[5] == -4.0  #Reflective
     327       
     328        #Ymomentum
     329        assert domain.quantities['ymomentum'].boundary_values[0] == -10.0 #Reflective
     330        assert domain.quantities['ymomentum'].boundary_values[1] == 1.  #Dirichlet
     331        assert domain.quantities['ymomentum'].boundary_values[2] == 30. #Transmissive
     332        assert domain.quantities['ymomentum'].boundary_values[3] == 30. #Transmissive
     333        assert domain.quantities['ymomentum'].boundary_values[4] == 40. #Transmissive
     334        assert domain.quantities['ymomentum'].boundary_values[5] == 40. #Reflective
     335
    262336
    263337    def test_compute_fluxes0(self):
     
    21842258if __name__ == "__main__":
    21852259    suite = unittest.makeSuite(TestCase,'test')
     2260    #suite = unittest.makeSuite(TestCase,'test_boundary_conditionsII')
    21862261    runner = unittest.TextTestRunner()
    21872262    runner.run(suite)
Note: See TracChangeset for help on using the changeset viewer.