Changeset 6002
- Timestamp:
- Nov 26, 2008, 3:39:12 PM (15 years ago)
- Location:
- anuga_core/source/anuga/shallow_water
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/shallow_water/shallow_water_domain.py
r5991 r6002 1645 1645 center [m]: Coordinates at center of flow point 1646 1646 radius [m]: Size of circular area 1647 polygon: Arbitrary polygon .1647 polygon: Arbitrary polygon 1648 1648 default_rate: Rate to be used if rate fails (e.g. if model time exceeds its data) 1649 1649 Admissible types: None, constant number or function of t … … 1652 1652 Either center, radius or polygon can be specified but not both. 1653 1653 If neither are specified the entire domain gets updated. 1654 All coordinates to be specified in absolute UTM coordinates (x, y) assuming the zone of domain. 1654 1655 1655 SeeInflow or Rainfall for examples of use1656 Inflow or Rainfall for examples of use 1656 1657 """ 1657 1658 … … 1690 1691 # previous timestep in order to obtain rate 1691 1692 1692 1693 bounding_polygon = domain.get_boundary_polygon() 1693 bounding_polygon = domain.get_boundary_polygon() # Returns absolute coordinates 1694 1694 1695 1695 -
anuga_core/source/anuga/shallow_water/test_shallow_water_domain.py
r5988 r6002 2545 2545 2546 2546 def test_time_dependent_rainfall_using_starttime(self): 2547 2548 rainfall_poly = ensure_numeric([[1,1], [2,1], [2,2], [1,2]], Float) 2547 2549 2548 2550 a = [0.0, 0.0] … … 2572 2574 R = Rainfall(domain, 2573 2575 rate=lambda t: 3*t + 7, 2574 polygon = [[1,1], [2,1], [2,2], [1,2]])2576 polygon=rainfall_poly) 2575 2577 2576 2578 assert allclose(R.exchange_area, 1) … … 2602 2604 2603 2605 2606 2607 def test_time_dependent_rainfall_using_georef(self): 2608 """test_time_dependent_rainfall_using_georef 2609 2610 This will also test the General forcing term using georef 2611 """ 2612 2613 #Mesh in zone 56 (absolute coords) 2614 2615 x0 = 314036.58727982 2616 y0 = 6224951.2960092 2617 2618 2619 rainfall_poly = ensure_numeric([[1,1], [2,1], [2,2], [1,2]], Float) 2620 rainfall_poly += [x0, y0] 2621 2622 a = [0.0, 0.0] 2623 b = [0.0, 2.0] 2624 c = [2.0, 0.0] 2625 d = [0.0, 4.0] 2626 e = [2.0, 2.0] 2627 f = [4.0, 0.0] 2628 2629 points = [a, b, c, d, e, f] 2630 #bac, bce, ecf, dbe 2631 vertices = [ [1,0,2], [1,2,4], [4,2,5], [3,1,4]] 2632 2633 2634 domain = Domain(points, vertices, 2635 geo_reference = Geo_reference(56, x0, y0)) 2636 2637 #Flat surface with 1m of water 2638 domain.set_quantity('elevation', 0) 2639 domain.set_quantity('stage', 1.0) 2640 domain.set_quantity('friction', 0) 2641 2642 Br = Reflective_boundary(domain) 2643 domain.set_boundary({'exterior': Br}) 2644 2645 # Setup only one forcing term, time dependent rainfall restricted to a polygon enclosing triangle #1 (bce) 2646 domain.forcing_terms = [] 2647 R = Rainfall(domain, 2648 rate=lambda t: 3*t + 7, 2649 polygon=rainfall_poly) 2650 2651 assert allclose(R.exchange_area, 1) 2652 2653 domain.forcing_terms.append(R) 2654 2655 # This will test that time used in the forcing function takes 2656 # startime into account. 2657 domain.starttime = 5.0 2658 2659 domain.time = 7. 2660 2661 domain.compute_forcing_terms() 2662 #print domain.quantities['stage'].explicit_update 2663 2664 #print domain.get_time() 2665 assert allclose(domain.quantities['stage'].explicit_update[1], 2666 (3*domain.get_time()+7)/1000) 2667 assert allclose(domain.quantities['stage'].explicit_update[1], 2668 (3*(domain.time + domain.starttime)+7)/1000) 2669 2670 # Using internal time her should fail 2671 assert not allclose(domain.quantities['stage'].explicit_update[1], 2672 (3*domain.time+7)/1000) 2673 2674 assert allclose(domain.quantities['stage'].explicit_update[0], 0) 2675 assert allclose(domain.quantities['stage'].explicit_update[2:], 0) 2676 2677 2678 2679 2604 2680 2605 2681 … … 6190 6266 6191 6267 data_geo_spatial = Geospatial_data(data_points_rel, 6192 geo_reference = Geo_reference(56, x0, y0))6268 geo_reference = Geo_reference(56, x0, y0)) 6193 6269 data_points_absolute = data_geo_spatial.get_data_points(absolute=True) 6194 6270 attributes = linear_function(data_points_absolute) … … 6232 6308 6233 6309 suite = unittest.makeSuite(Test_Shallow_Water,'test') 6234 6235 6310 #suite = unittest.makeSuite(Test_Shallow_Water,'test_get_energy_through_cross_section_with_g') 6236 6311 #suite = unittest.makeSuite(Test_Shallow_Water,'test_fitting_using_shallow_water_domain') 6237 6312 #suite = unittest.makeSuite(Test_Shallow_Water,'test_tight_slope_limiters') 6238 6313 #suite = unittest.makeSuite(Test_Shallow_Water,'test_get_maximum_inundation_from_sww') 6239 #suite = unittest.makeSuite(Test_Shallow_Water,'test_time_dependent_rainfall _using_starttime')6314 #suite = unittest.makeSuite(Test_Shallow_Water,'test_time_dependent_rainfall') 6240 6315 6241 6316
Note: See TracChangeset
for help on using the changeset viewer.