Ignore:
Timestamp:
Jun 18, 2010, 5:49:57 PM (12 years ago)
Author:
steve
Message:

Continuing to numpy the for loops

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/development/2010-projects/anuga_1d/sww/test_sww_domain.py

    r7839 r7860  
    7777
    7878
    79     def test_gravity(self):
     79    def test_gravity_for_loops(self):
    8080        """
    8181        Compare shallow_water_domain gravity calculation
     
    9090        domain.set_boundary({'exterior' : Reflective_boundary(domain)})
    9191
     92        domain.set_spatial_order(1)
     93        domain.distribute_to_vertices_and_edges()
     94
     95        gravity_for_loops(domain)     
     96
     97        assert numpy.allclose( [-34.3, -24.5, -14.7], domain.quantities['xmomentum'].explicit_update )
     98
     99
     100    def test_gravity(self):
     101        """
     102        Compare shallow_water_domain gravity calculation
     103        """
     104
     105        def slope_one(x):
     106            return x
     107
     108        domain = Domain(self.points)
     109        domain.set_quantity('stage',4.0)
     110        domain.set_quantity('elevation',slope_one)
     111        domain.set_boundary({'exterior' : Reflective_boundary(domain)})
     112
     113
     114        domain.set_spatial_order(1)
     115        domain.distribute_to_vertices_and_edges()
     116
    92117        gravity(domain)
    93        
    94         #print domain.quantities['stage'].vertex_values
    95         #print domain.quantities['elevation'].vertex_values
    96         #print domain.quantities['xmomentum'].explicit_update       
    97118
    98119        assert numpy.allclose( [-34.3, -24.5, -14.7], domain.quantities['xmomentum'].explicit_update )
     
    180201
    181202if __name__ == "__main__":
    182     suite = unittest.makeSuite(Test_Shallow_Water, 'test')
     203    suite = unittest.makeSuite(Test_Shallow_Water, 'test_gravity')
    183204    #suite = unittest.makeSuite(Test_Shallow_Water, 'test_evolve_first_order')
    184205
Note: See TracChangeset for help on using the changeset viewer.