Changeset 6651


Ignore:
Timestamp:
Mar 28, 2009, 11:03:51 AM (16 years ago)
Author:
ole
Message:

Fixed the remaining unit tests up after having changed the definition of exchange_area in general_forcing. The first bits were done in changeset:6636

File:
1 edited

Legend:

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

    r6643 r6651  
    25672567                     polygon = [[1,1], [2,1], [2,2], [1,2]])
    25682568
    2569         assert num.allclose(R.exchange_area, 1)
     2569        assert num.allclose(R.exchange_area, 2)
    25702570       
    25712571        domain.forcing_terms.append(R)
     
    27342734                     polygon=rainfall_poly)
    27352735
    2736         assert num.allclose(R.exchange_area, 1)
     2736        assert num.allclose(R.exchange_area, 2)
    27372737       
    27382738        domain.forcing_terms.append(R)
     
    28072807                     default_rate=5.0)
    28082808
    2809         assert num.allclose(R.exchange_area, 1)
     2809        assert num.allclose(R.exchange_area, 2)
    28102810       
    28112811        domain.forcing_terms.append(R)
     
    28822882                     default_rate=5.0)
    28832883
    2884         assert num.allclose(R.exchange_area, 1)
     2884        assert num.allclose(R.exchange_area, 2)
    28852885       
    28862886        domain.forcing_terms.append(R)
     
    29242924        # Setup only one forcing term, constant inflow of 2 m^3/s on a circle affecting triangles #0 and #1 (bac and bce)
    29252925        domain.forcing_terms = []
    2926         domain.forcing_terms.append( Inflow(domain, rate=2.0, center=(1,1), radius=1) )
    2927 
     2926       
     2927        I = Inflow(domain, rate=2.0, center=(1,1), radius=1)
     2928        domain.forcing_terms.append(I)       
    29282929        domain.compute_forcing_terms()
    2929         #print domain.quantities['stage'].explicit_update
    2930        
    2931         assert num.allclose(domain.quantities['stage'].explicit_update[1], 2.0/pi)
    2932         assert num.allclose(domain.quantities['stage'].explicit_update[0], 2.0/pi)
     2930       
     2931        A = I.exchange_area
     2932        assert num.allclose(A, 4) # Two triangles       
     2933       
     2934        assert num.allclose(domain.quantities['stage'].explicit_update[1], 2.0/A)
     2935        assert num.allclose(domain.quantities['stage'].explicit_update[0], 2.0/A)
    29332936        assert num.allclose(domain.quantities['stage'].explicit_update[2:], 0)       
    29342937
     
    29612964        # Setup only one forcing term, time dependent inflow of 2 m^3/s on a circle affecting triangles #0 and #1 (bac and bce)
    29622965        domain.forcing_terms = []
    2963         domain.forcing_terms.append( Inflow(domain, rate=lambda t: 2., center=(1,1), radius=1) )
    2964 
    2965         domain.compute_forcing_terms()
    2966        
    2967         assert num.allclose(domain.quantities['stage'].explicit_update[1], 2.0/pi)
    2968         assert num.allclose(domain.quantities['stage'].explicit_update[0], 2.0/pi)
     2966        I = Inflow(domain, rate=lambda t: 2., center=(1,1), radius=1)
     2967        domain.forcing_terms.append(I)
     2968       
     2969        domain.compute_forcing_terms()       
     2970
     2971        A = I.exchange_area
     2972        assert num.allclose(A, 4) # Two triangles
     2973       
     2974        assert num.allclose(domain.quantities['stage'].explicit_update[1], 2.0/A)
     2975        assert num.allclose(domain.quantities['stage'].explicit_update[0], 2.0/A)
    29692976        assert num.allclose(domain.quantities['stage'].explicit_update[2:], 0)       
    29702977       
     
    68766883       
    68776884if __name__ == "__main__":
    6878     suite = unittest.makeSuite(Test_Shallow_Water, 'test_inflow_using_flowline')
     6885    #suite = unittest.makeSuite(Test_Shallow_Water, 'test_inflow_using_flowline')
     6886    suite = unittest.makeSuite(Test_Shallow_Water, 'test')   
    68796887    runner = unittest.TextTestRunner(verbosity=1)   
    68806888    runner.run(suite)
Note: See TracChangeset for help on using the changeset viewer.