Changeset 8387
- Timestamp:
- Apr 10, 2012, 12:50:53 PM (13 years ago)
- Location:
- trunk/anuga_core/source/anuga/shallow_water
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/shallow_water/test_forcing.py
r8371 r8387 1917 1917 os.remove(field_sts_filename+'.sww') 1918 1918 1919 def test_ gravity(self):1919 def test_flux_gravity(self): 1920 1920 #Assuming no friction 1921 1921 … … 1935 1935 domain = Domain(points, vertices) 1936 1936 1937 B = Reflective_boundary(domain) 1938 domain.set_boundary( {'exterior': B}) 1939 1940 1937 1941 #Set up for a gradient of (3,0) at mid triangle (bce) 1938 1942 def slope(x, y): … … 1950 1954 assert num.allclose(domain.quantities[name].semi_implicit_update, 0) 1951 1955 1952 domain.compute_forcing_terms() 1953 1954 1956 # fluxes and gravity term are now combined. To ensure zero flux on boundary 1957 # need to set reflective boundaries 1958 domain.update_boundary() 1959 domain.compute_fluxes() 1955 1960 1956 1961 … … 1977 1982 domain = Domain(points, vertices) 1978 1983 1984 B = Reflective_boundary(domain) 1985 domain.set_boundary( {'exterior': B}) 1986 1979 1987 #Set up for a gradient of (3,0) at mid triangle (bce) 1980 1988 def slope(x, y): … … 1994 2002 assert num.allclose(domain.quantities[name].semi_implicit_update, 0) 1995 2003 2004 2005 # Only manning friction in the forcing terms (gravity now combined with flux calc) 1996 2006 domain.compute_forcing_terms() 1997 2007 1998 2008 assert num.allclose(domain.quantities['stage'].explicit_update, 0) 1999 2009 assert num.allclose(domain.quantities['xmomentum'].explicit_update, 2000 -g*h*3)2010 0) 2001 2011 assert num.allclose(domain.quantities['ymomentum'].explicit_update, 0) 2002 2012 … … 2052 2062 2053 2063 domain = Domain(points, vertices) 2064 B = Reflective_boundary(domain) 2065 domain.set_boundary( {'exterior': B}) 2054 2066 2055 2067 # Use the new function which takes into account the extra … … 2078 2090 assert num.allclose(domain.quantities['stage'].explicit_update, 0) 2079 2091 assert num.allclose(domain.quantities['xmomentum'].explicit_update, 2080 -g*h*3)2092 0) 2081 2093 assert num.allclose(domain.quantities['ymomentum'].explicit_update, 0) 2082 2094 -
trunk/anuga_core/source/anuga/shallow_water/test_shallow_water_domain.py
r8386 r8387 2450 2450 2451 2451 domain = Domain(points, vertices) 2452 B = Reflective_boundary(domain) 2453 domain.set_boundary( {'exterior': B}) 2452 2454 2453 2455 #Set up for a gradient of (3,0) at mid triangle (bce) … … 2472 2474 assert num.allclose(domain.quantities['stage'].explicit_update, 0) 2473 2475 assert num.allclose(domain.quantities['xmomentum'].explicit_update, 2474 -g*h*3)2476 0) 2475 2477 assert num.allclose(domain.quantities['ymomentum'].explicit_update, 0) 2476 2478 … … 2527 2529 2528 2530 domain = Domain(points, vertices) 2531 B = Reflective_boundary(domain) 2532 domain.set_boundary( {'exterior': B}) 2529 2533 2530 2534 # Use the flat function which doesn't takes into account the extra … … 2553 2557 assert num.allclose(domain.quantities['stage'].explicit_update, 0) 2554 2558 assert num.allclose(domain.quantities['xmomentum'].explicit_update, 2555 -g*h*3)2559 0) 2556 2560 assert num.allclose(domain.quantities['ymomentum'].explicit_update, 0) 2557 2561 … … 2607 2611 2608 2612 domain = Domain(points, vertices) 2613 B = Reflective_boundary(domain) 2614 domain.set_boundary( {'exterior': B}) 2609 2615 2610 2616 # Use the sloped function which takes into account the extra … … 2633 2639 assert num.allclose(domain.quantities['stage'].explicit_update, 0) 2634 2640 assert num.allclose(domain.quantities['xmomentum'].explicit_update, 2635 -g*h*3)2641 0) 2636 2642 assert num.allclose(domain.quantities['ymomentum'].explicit_update, 0) 2637 2643 … … 7570 7576 7571 7577 7572 try:7573 domain.update_centroids_of_velocities_and_height()7574 except AssertionError:7575 pass7576 else:7577 raise Exception('should have caught H<0 error')7578 # try: 7579 # domain.update_centroids_of_velocities_and_height() 7580 # except AssertionError: 7581 # pass 7582 # else: 7583 # raise Exception('should have caught H<0 error') 7578 7584 7579 7585 domain.set_quantity('stage',expression='elevation + 2*x') … … 7651 7657 if __name__ == "__main__": 7652 7658 #suite = unittest.makeSuite(Test_Shallow_Water, 'test_rainfall_forcing_with_evolve') 7653 suite = unittest.makeSuite(Test_Shallow_Water, 'test _well')7659 suite = unittest.makeSuite(Test_Shallow_Water, 'test') 7654 7660 runner = unittest.TextTestRunner(verbosity=1) 7655 7661 runner.run(suite)
Note: See TracChangeset
for help on using the changeset viewer.