Changeset 5538


Ignore:
Timestamp:
Jul 19, 2008, 8:40:31 PM (11 years ago)
Author:
steve
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/development/anuga_1d/test_shallow_water.py

    r5536 r5538  
    1111class Test_Shallow_Water(unittest.TestCase):
    1212    def setUp(self):
    13         self.points1 = [0.0, 1.0, 2.0, 3.0]
     13        self.points = [0.0, 1.0, 2.0, 3.0]
    1414        self.vertex_values = [[1.0,2.0],[4.0,5.0],[-1.0,2.0]]
    15 
    16 
    17         pass
    1815       
    1916    def tearDown(self):
     
    2320
    2421    def test_creation(self):
    25 
    26 
    27         D1 = Domain(self.points1)
    28 
    29         assert allclose(D1.centroids, [0.5, 1.5, 2.5])
    30 
     22        domain = Domain(self.points)
     23        assert allclose(domain.centroids, [0.5, 1.5, 2.5])
    3124
    3225    def test_compute_fluxes(self):
     26        """
     27        Compare shallow_water_domain flux calculation against a previous
     28        Python implementation (defined in this file)
     29        """
     30        domain = Domain(self.points)
     31        domain.set_quantity('stage',2.0)
     32        domain.set_boundary({'exterior' : Reflective_boundary(domain)})
     33
     34        stage_ud, xmom_ud = compute_fluxes_python(domain)
    3335       
     36        domain.compute_fluxes()
    3437
    35         D1 = Domain(self.points1)
    36         D1.set_quantity('stage',2.0)
    37         D1.set_boundary({'exterior' : Reflective_boundary(D1)})
     38        #print doamin.quantities['xmomentum'].explicit_update
     39        #print compute_fluxes_python(domain)
    3840
    39         stage_ud, xmom_ud = compute_fluxes_python(D1)
    40        
    41         D1.compute_fluxes()
    42 
    43         #print D1.quantities['xmomentum'].explicit_update
    44         #print compute_fluxes_python(D1)
    45 
    46         assert allclose( D1.quantities['stage'].explicit_update, stage_ud )
    47         assert allclose( D1.quantities['xmomentum'].explicit_update, xmom_ud )
     41        assert allclose( domain.quantities['stage'].explicit_update, stage_ud )
     42        assert allclose( domain.quantities['xmomentum'].explicit_update, xmom_ud )
    4843
    4944
Note: See TracChangeset for help on using the changeset viewer.