Changeset 7869
- Timestamp:
- Jun 22, 2010, 5:52:28 PM (15 years ago)
- Location:
- trunk/anuga_core/source/anuga
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/__init__.py
r7866 r7869 93 93 # Forcing 94 94 #----------------------------- 95 from anuga.shallow_water.forcing import Inflow, Rainfall 95 from anuga.shallow_water.forcing import Inflow, Rainfall, Wind_stress 96 96 97 97 #----------------------------- -
trunk/anuga_core/source/anuga/shallow_water_balanced/test_swb_basic.py
r7866 r7869 133 133 134 134 def test_rotate(self): 135 from anuga.shallow_water.shallow_water_ext import rotate 135 136 normal = num.array([0.0, -1.0]) 136 137 … … 492 493 # Setup boundary conditions 493 494 #-------------------------------------------------------------- 494 Br = Reflective_boundary(domain)# Reflective wall495 Bd = Dirichlet_boundary([final_runup_height, 0, 0]) # Constantinflow495 Br = anuga.Reflective_boundary(domain) # Reflective wall 496 Bd = anuga.Dirichlet_boundary([final_runup_height, 0, 0])# Steady inflow 496 497 497 498 # All reflective to begin with (still water) … … 598 599 from anuga.abstract_2d_finite_volumes.mesh_factory \ 599 600 import rectangular_cross 600 from data_manager import get_maximum_inundation_elevation601 from data_manager import get_maximum_inundation_location602 from data_manager importget_maximum_inundation_data601 from anuga.shallow_water.sww_interrogate import \ 602 get_maximum_inundation_elevation, get_maximum_inundation_location, \ 603 get_maximum_inundation_data 603 604 604 605 initial_runup_height = -0.4 … … 632 633 # Setup boundary conditions 633 634 #-------------------------------------------------------------- 634 Br = Reflective_boundary(domain)# Reflective wall635 Bd = Dirichlet_boundary([final_runup_height, 0, 0]) # Constantinflow635 Br = anuga.Reflective_boundary(domain) # Reflective wall 636 Bd = anuga.Dirichlet_boundary([final_runup_height, 0, 0])# Steady inflow 636 637 637 638 # All reflective to begin with (still water) … … 787 788 """ 788 789 789 from anuga.pmesh.mesh_interface import create_mesh_from_regions790 from anuga.abstract_2d_finite_volumes.mesh_factory \791 import rectangular_cross792 from anuga.shallow_water import Domain793 from anuga.shallow_water import Reflective_boundary794 from anuga.shallow_water import Dirichlet_boundary795 796 790 #----------------------------------------------------------------- 797 791 # Setup computational domain 798 792 #----------------------------------------------------------------- 799 points, vertices, boundary = rectangular_cross(10, 10)# Basic mesh800 domain = Domain(points, vertices, boundary) # Create domain793 points, vertices, boundary = anuga.rectangular_cross(10, 10)# Basic mesh 794 domain = anuga.Domain(points, vertices, boundary) # Create domain 801 795 domain.set_default_order(2) 802 796 domain.set_quantities_to_be_stored(None) … … 816 810 # Setup boundary conditions 817 811 #---------------------------------------------------------------- 818 Br = Reflective_boundary(domain) # Solid reflective wall819 Bd = Dirichlet_boundary([-0.2, 0., 0.]) # Constant boundary values812 Br = anuga.Reflective_boundary(domain) # Solid reflective wall 813 Bd = anuga.Dirichlet_boundary([-0.2, 0., 0.]) # Constant 820 814 domain.set_boundary({'left': Br, 'right': Bd, 'top': Br, 'bottom': Br}) 821 815 … … 879 873 vertices = [[1,0,2], [1,2,4], [4,2,5], [3,1,4]] 880 874 881 domain = Domain(points, vertices)875 domain = anuga.Domain(points, vertices) 882 876 883 877 #Set up for a gradient of (3,0) at mid triangle (bce) … … 898 892 initial_stage = copy.copy(domain.quantities['stage'].vertex_values) 899 893 900 domain.set_boundary({'exterior': Reflective_boundary(domain)})894 domain.set_boundary({'exterior': anuga.Reflective_boundary(domain)}) 901 895 902 896 domain.optimise_dry_cells = True … … 916 910 917 911 def test_second_order_flat_bed_onestep(self): 918 from mesh_factory import rectangular919 912 920 913 #Create basic mesh 921 points, vertices, boundary = rectangular(6, 6)914 points, vertices, boundary = anuga.rectangular(6, 6) 922 915 923 916 #Create shallow water domain 924 domain = Domain(points, vertices, boundary)917 domain = anuga.Domain(points, vertices, boundary) 925 918 domain.set_default_order(2) 926 919 927 920 # Boundary conditions 928 Br = Reflective_boundary(domain)929 Bd = Dirichlet_boundary([0.1, 0., 0.])921 Br = anuga.Reflective_boundary(domain) 922 Bd = anuga.Dirichlet_boundary([0.1, 0., 0.]) 930 923 domain.set_boundary({'left': Bd, 'right': Br, 'top': Br, 'bottom': Br}) 931 924 … … 1027 1020 1028 1021 # Create shallow water domain 1029 domain = Domain(points, vertices, boundary)1022 domain = anuga.Domain(points, vertices, boundary) 1030 1023 domain.smooth = False 1031 1024 domain.default_order = 2 1032 1025 1033 1026 # Boundary conditions 1034 Br = Reflective_boundary(domain)1035 Bd = Dirichlet_boundary([0.1, 0., 0.])1027 Br = anuga.Reflective_boundary(domain) 1028 Bd = anuga.Dirichlet_boundary([0.1, 0., 0.]) 1036 1029 domain.set_boundary({'left': Bd, 'right': Br, 'top': Br, 'bottom': Br}) 1037 1030 … … 1063 1056 1064 1057 # Boundary conditions 1065 Br = Reflective_boundary(domain)1066 Bd = Dirichlet_boundary([0.2, 0., 0.])1058 Br = anuga.Reflective_boundary(domain) 1059 Bd = anuga.Dirichlet_boundary([0.2, 0., 0.]) 1067 1060 1068 1061 domain.set_boundary({'left': Bd, 'right': Br, 'top': Br, 'bottom': Br}) … … 1101 1094 1102 1095 # Boundary conditions 1103 Br = Reflective_boundary(domain)1104 Bd = Dirichlet_boundary([0.2, 0., 0.])1096 Br = anuga.Reflective_boundary(domain) 1097 Bd = anuga.Dirichlet_boundary([0.2, 0., 0.]) 1105 1098 1106 1099 domain.set_boundary({'left': Bd, 'right': Br, 'top': Br, 'bottom': Br}) … … 1156 1149 1157 1150 # Boundary conditions 1158 Br = Reflective_boundary(domain)1159 Bd = Dirichlet_boundary([0.2, 0., 0.])1151 Br = anuga.Reflective_boundary(domain) 1152 Bd = anuga.Dirichlet_boundary([0.2, 0., 0.]) 1160 1153 1161 1154 domain.set_boundary({'left': Bd, 'right': Br, 'top': Br, 'bottom': Br}) … … 1201 1194 1202 1195 # Boundary conditions 1203 Br = Reflective_boundary(domain)1204 Bd = Dirichlet_boundary([0.2, 0., 0.])1196 Br = anuga.Reflective_boundary(domain) 1197 Bd = anuga.Dirichlet_boundary([0.2, 0., 0.]) 1205 1198 1206 1199 domain.set_boundary({'left': Bd, 'right': Br, 'top': Br, 'bottom': Br}) … … 1348 1341 1349 1342 # Boundary conditions 1350 Br = Reflective_boundary(domain)1343 Br = anuga.Reflective_boundary(domain) 1351 1344 domain.set_boundary({'left': Br, 'right': Br, 'top': Br, 'bottom': Br}) 1352 1345 … … 1512 1505 1513 1506 # Boundary conditions 1514 Br = Reflective_boundary(domain)1507 Br = anuga.Reflective_boundary(domain) 1515 1508 domain.set_boundary({'left': Br, 'right': Br, 'top': Br, 'bottom': Br}) 1516 1509 … … 1556 1549 domain.set_quantity('elevation', Z) 1557 1550 1558 Br = Reflective_boundary(domain)1559 Bd = Dirichlet_boundary([inflow_stage, 0.0, 0.0])1551 Br = anuga.Reflective_boundary(domain) 1552 Bd = anuga.Dirichlet_boundary([inflow_stage, 0.0, 0.0]) 1560 1553 domain.set_boundary({'left': Bd, 'right': Br, 'bottom': Br, 'top': Br}) 1561 1554 … … 1614 1607 import time, os 1615 1608 from Scientific.IO.NetCDF import NetCDFFile 1616 from data_manager import extent_sww1617 1609 from mesh_factory import rectangular_cross 1618 1610 … … 1728 1720 1729 1721 tags = {} 1730 b1 = Dirichlet_boundary(conserved_quantities = num.array([0.0]))1731 b2 = Dirichlet_boundary(conserved_quantities = num.array([1.0]))1732 b3 = Dirichlet_boundary(conserved_quantities = num.array([2.0]))1722 b1 = anuga.Dirichlet_boundary(conserved_quantities = num.array([0.0])) 1723 b2 = anuga.Dirichlet_boundary(conserved_quantities = num.array([1.0])) 1724 b3 = anuga.Dirichlet_boundary(conserved_quantities = num.array([2.0])) 1733 1725 tags["1"] = b1 1734 1726 tags["2"] = b2 … … 1909 1901 1910 1902 verbose = False 1911 1912 from anuga.shallow_water import Domain1913 from anuga.pmesh.mesh_interface import create_mesh_from_regions1914 from anuga.geospatial_data.geospatial_data import Geospatial_data1915 1916 1903 1917 1904 # Get path where this test is run … … 1965 1952 1966 1953 meshname = os.path.join(path, 'offending_mesh.msh') 1967 create_mesh_from_regions(bounding_polygon,1954 anuga.create_mesh_from_regions(bounding_polygon, 1968 1955 boundary_tags={'south': [0], 'east': [1], 1969 1956 'north': [2], 'west': [3]}, … … 1974 1961 verbose=verbose) 1975 1962 1976 domain = Domain(meshname, use_cache=False, verbose=verbose)1963 domain = anuga.Domain(meshname, use_cache=False, verbose=verbose) 1977 1964 1978 1965 #---------------------------------------------------------------------- … … 2000 1987 os.remove(points_file) 2001 1988 2002 #finally:2003 # Cleanup regardless2004 #FIXME(Ole): Finally does not work like this in python2.42005 #FIXME(Ole): Reinstate this when Python2.4 is out of the way2006 #FIXME(Ole): Python 2.6 apparently introduces something called 'with'2007 #os.remove(meshname)2008 #os.remove(points_file)2009 2010 1989 2011 1990 def test_fitting_example_that_crashed_2(self): … … 2022 2001 2023 2002 verbose = False 2024 2025 from anuga.shallow_water import Domain2026 from anuga.pmesh.mesh_interface import create_mesh_from_regions2027 from anuga.geospatial_data import Geospatial_data2028 2003 2029 2004 # Get path where this test is run … … 2039 2014 bounding_polygon = [[W, S], [E, S], [E, N], [W, N]] 2040 2015 2041 create_mesh_from_regions(bounding_polygon,2016 anuga.create_mesh_from_regions(bounding_polygon, 2042 2017 boundary_tags={'south': [0], 2043 2018 'east': [1], … … 2049 2024 verbose=verbose) 2050 2025 2051 domain = Domain(meshname, use_cache=True, verbose=verbose)2026 domain = anuga.Domain(meshname, use_cache=True, verbose=verbose) 2052 2027 2053 2028 # Large test set revealed one problem … … 2131 2106 # Setup boundary conditions 2132 2107 #------------------------------------------------------------------ 2133 Bi = Dirichlet_boundary([0.4, 0, 0]) # Inflow2134 Br = Reflective_boundary(domain) # Solid reflective wall2135 Bo = Dirichlet_boundary([-5, 0, 0]) # Outflow2108 Bi = anuga.Dirichlet_boundary([0.4, 0, 0]) # Inflow 2109 Br = anuga.Reflective_boundary(domain) # Solid reflective wall 2110 Bo = anuga.Dirichlet_boundary([-5, 0, 0]) # Outflow 2136 2111 2137 2112 domain.set_boundary({'left': Bi, 'right': Bo, 'top': Br, 'bottom': Br}) -
trunk/anuga_core/source/anuga/shallow_water_balanced/test_swb_boundary_condition.py
r7866 r7869 5 5 from math import pi, sqrt 6 6 import tempfile 7 8 import anuga 7 9 8 10 from anuga.config import g, epsilon … … 60 62 [30,30,30], [40,40,40]]) 61 63 62 D = Dirichlet_boundary([5, 2, 1])63 T = Transmissive_boundary(domain)64 R = Reflective_boundary(domain)64 D = anuga.Dirichlet_boundary([5, 2, 1]) 65 T = anuga.Transmissive_boundary(domain) 66 R = anuga.Reflective_boundary(domain) 65 67 domain.set_boundary({'First': D, 'Second': T, 'Third': R}) 66 68 … … 140 142 (0, 1): 'Internal'} 141 143 142 domain = Domain(points, vertices, boundary)144 domain = anuga.Domain(points, vertices, boundary) 143 145 domain.check_integrity() 144 146 … … 150 152 [30,30,30], [40,40,40]]) 151 153 152 D = Dirichlet_boundary([5, 2, 1])153 T = Transmissive_boundary(domain)154 R = Reflective_boundary(domain)154 D = anuga.Dirichlet_boundary([5, 2, 1]) 155 T = anuga.Transmissive_boundary(domain) 156 R = anuga.Reflective_boundary(domain) 155 157 domain.set_boundary({'First': D, 'Second': T, 156 158 'Third': R, 'Internal': None}) … … 192 194 [30,30,30], [40,40,40]]) 193 195 194 D = Dirichlet_boundary([5, 2, 1])195 T = Transmissive_stage_zero_momentum_boundary(domain)196 R = Reflective_boundary(domain)196 D = anuga.Dirichlet_boundary([5, 2, 1]) 197 T = anuga.Transmissive_stage_zero_momentum_boundary(domain) 198 R = anuga.Reflective_boundary(domain) 197 199 domain.set_boundary({'First': D, 'Second': T, 'Third': R}) 198 200 … … 270 272 #-------------------------------------------------------------- 271 273 # Time dependent boundary 272 Bt = Time_boundary(domain=domain, f=lambda t: [t, 0.0, 0.0])273 274 Br = Reflective_boundary(domain) # Reflective wall274 Bt = anuga.Time_boundary(domain=domain, f=lambda t: [t, 0.0, 0.0]) 275 276 Br = anuga.Reflective_boundary(domain) # Reflective wall 275 277 276 278 domain.set_boundary({'left': Bt, 'right': Br, 'top': Br, 'bottom': Br}) … … 326 328 327 329 # Boundary conditions 328 Br = Reflective_boundary(domain1)329 Bd = Dirichlet_boundary([0.3,0,0])330 Br = anuga.Reflective_boundary(domain1) 331 Bd = anuga.Dirichlet_boundary([0.3,0,0]) 330 332 domain1.set_boundary({'left': Bd, 'top': Bd, 'right': Br, 'bottom': Br}) 331 333 … … 370 372 371 373 # Boundary conditions 372 Br = Reflective_boundary(domain2)373 Bf = Field_boundary(domain1.get_name() + '.sww', domain2)374 Br = anuga.Reflective_boundary(domain2) 375 Bf = anuga.Field_boundary(domain1.get_name() + '.sww', domain2) 374 376 domain2.set_boundary({'right':Br, 'bottom':Br, 'diagonal':Bf}) 375 377 domain2.check_integrity() … … 433 435 434 436 # Boundary conditions 435 Br = Reflective_boundary(domain1)436 Bd = Dirichlet_boundary([0.3,0,0])437 Br = anuga.Reflective_boundary(domain1) 438 Bd = anuga.Dirichlet_boundary([0.3,0,0]) 437 439 domain1.set_boundary({'left': Bd, 'top': Bd, 'right': Br, 'bottom': Br}) 438 440 … … 498 500 499 501 # Boundary conditions 500 Br = Reflective_boundary(domain2)501 Bf = Field_boundary(domain1.get_name() + '.sww',502 Br = anuga.Reflective_boundary(domain2) 503 Bf = anuga.Field_boundary(domain1.get_name() + '.sww', 502 504 domain2, verbose=False) 503 505 domain2.set_boundary({'right':Br, 'bottom':Br, 'diagonal':Bf}) … … 605 607 606 608 # Boundary conditions 607 Br = Reflective_boundary(domain1)608 Bd = Dirichlet_boundary([0.3, 0, 0])609 Br = anuga.Reflective_boundary(domain1) 610 Bd = anuga.Dirichlet_boundary([0.3, 0, 0]) 609 611 domain1.set_boundary({'left': Bd, 'top': Bd, 'right': Br, 'bottom': Br}) 610 612 … … 671 673 672 674 # Boundary conditions 673 Br = Reflective_boundary(domain2)674 Bf = Field_boundary(domain1.get_name() + '.sww',675 Br = anuga.Reflective_boundary(domain2) 676 Bf = anuga.Field_boundary(domain1.get_name() + '.sww', 675 677 domain2, mean_stage=mean_stage, verbose=False) 676 678 … … 761 763 762 764 # Create shallow water domain 763 domain1 = Domain(points, vertices, boundary)765 domain1 = anuga.Domain(points, vertices, boundary) 764 766 765 767 domain1.reduction = mean … … 784 786 785 787 # Boundary conditions 786 Br = Reflective_boundary(domain1)787 Bd = Dirichlet_boundary([0.3, 0, 0])788 Br = anuga.Reflective_boundary(domain1) 789 Bd = anuga.Dirichlet_boundary([0.3, 0, 0]) 788 790 domain1.set_boundary({'left': Bd, 'top': Bd, 'right': Br, 'bottom': Br}) 789 791 … … 846 848 847 849 # Boundary conditions 848 Br = Reflective_boundary(domain2)849 Bf = Field_boundary(domain1.get_name() + '.sww',850 Br = anuga.Reflective_boundary(domain2) 851 Bf = anuga.Field_boundary(domain1.get_name() + '.sww', 850 852 domain2, mean_stage=1, verbose=False) 851 853 -
trunk/anuga_core/source/anuga/shallow_water_balanced/test_swb_forcing_terms.py
r7866 r7869 552 552 os.remove(filename + '.tms') 553 553 554 W = Wind_stress(F)554 W = anuga.Wind_stress(F) 555 555 556 556 domain.forcing_terms = [] … … 1163 1163 # on a circle affecting triangles #0 and #1 (bac and bce) 1164 1164 domain.forcing_terms = [] 1165 I = Inflow(domain, rate=lambda t: 2., center=(1,1), radius=1)1165 I = anuga.Inflow(domain, rate=lambda t: 2., center=(1,1), radius=1) 1166 1166 domain.forcing_terms.append(I) 1167 1167 … … 1290 1290 # for a range of stage values 1291 1291 for stage in [2.0, 1.0, 0.5, 0.25, 0.1, 0.0]: 1292 print stage1293 1294 1292 domain.time = 0.0 1295 1293 domain.set_quantity('stage', stage) … … 1302 1300 for t in domain.evolve(yieldstep=dt, finaltime=5.0): 1303 1301 volume = domain.quantities['stage'].get_integral() 1304 print t, volume, predicted_volume1305 1302 assert num.allclose (volume, predicted_volume) 1306 1303 predicted_volume = predicted_volume - 2.0/pi/100/dt # Why 100? … … 1309 1306 # range of stage values 1310 1307 for stage in [2.0, 1.0, 0.5, 0.25, 0.1, 0.0]: 1311 print stage1312 1313 1308 domain.time = 0.0 1314 1309 domain.set_quantity('stage', stage) … … 1323 1318 for t in domain.evolve(yieldstep=dt, finaltime=5.0): 1324 1319 volume = domain.quantities['stage'].get_integral() 1325 1326 print t, volume1327 1320 assert num.allclose(volume, initial_volume) 1328 1321 … … 1403 1396 domain.forcing_terms.append(fixed_inflow) 1404 1397 1405 ref_flow = fixed_inflow.rate*number_of_inflows g1398 ref_flow = fixed_inflow.rate*number_of_inflows 1406 1399 1407 1400 # Compute normal depth on plane using Mannings equation … … 1417 1410 #-------------------------------------------------------------- 1418 1411 1419 Br = Reflective_boundary(domain)1412 Br = anuga.Reflective_boundary(domain) 1420 1413 1421 1414 # Define downstream boundary based on predicted depth … … 1423 1416 return (-slope*length) + normal_depth 1424 1417 1425 Bt = Transmissive_momentum_set_stage_boundary(domain=domain, 1426 function=normal_depth_stage_downstream) 1427 1428 1429 1418 Bt = anuga.Transmissive_momentum_set_stage_boundary( 1419 domain=domain, function=normal_depth_stage_downstream) 1430 1420 1431 1421 domain.set_boundary({'left': Br, … … 1433 1423 'top': Br, 1434 1424 'bottom': Br}) 1435 1436 1425 1437 1426 … … 1617 1606 1618 1607 1619 1620 def Xtest_friction_dependent_flow_using_flowline(self): 1621 """test_friction_dependent_flow_using_flowline 1622 1623 Test the internal flow (using flowline) as a function of 1624 different values of Mannings n and different slopes. 1625 1626 Flow is applied in the form of boundary conditions with fixed momentum. 1627 """ 1628 1629 verbose = True 1630 1631 #---------------------------------------------------------------------- 1632 # Import necessary modules 1633 #---------------------------------------------------------------------- 1634 1635 from anuga.abstract_2d_finite_volumes.mesh_factory \ 1636 import rectangular_cross 1637 from anuga.shallow_water import Domain 1638 from anuga.shallow_water.shallow_water_domain import Reflective_boundary 1639 from anuga.shallow_water.shallow_water_domain import Dirichlet_boundary 1640 from anuga.shallow_water.forcing import Inflow 1641 from anuga.shallow_water.data_manager \ 1642 import get_flow_through_cross_section 1643 from anuga.abstract_2d_finite_volumes.util \ 1644 import sww2csv_gauges, csv2timeseries_graphs 1645 1646 1647 #---------------------------------------------------------------------- 1648 # Setup computational domain 1649 #---------------------------------------------------------------------- 1650 1651 finaltime = 1000.0 1652 1653 length = 300. 1654 width = 20. 1655 dx = dy = 5 # Resolution: of grid on both axes 1656 1657 # Input parameters 1658 uh = 1.0 1659 vh = 0.0 1660 d = 1.0 1661 1662 ref_flow = uh*d*width # 20 m^3/s in the x direction across entire domain 1663 1664 points, vertices, boundary = rectangular_cross(int(length/dx), 1665 int(width/dy), 1666 len1=length, 1667 len2=width) 1668 1669 for mannings_n in [0.035]: #[0.0, 0.012, 0.035]: 1670 for slope in [1.0/300]: #[0.0, 1.0/300, 1.0/150]: 1671 # Loop over a range of bedslopes representing 1672 # sub to super critical flows 1673 if verbose: 1674 print 1675 print 'Slope:', slope, 'Mannings n:', mannings_n 1676 domain = Domain(points, vertices, boundary) 1677 domain.set_name('Inflow_flowline_test') # Output name 1678 1679 #-------------------------------------------------------------- 1680 # Setup initial conditions 1681 #-------------------------------------------------------------- 1682 1683 def topography(x, y): 1684 z = -x * slope 1685 return z 1686 1687 # Use function for elevation 1688 domain.set_quantity('elevation', topography) 1689 # Constant friction 1690 domain.set_quantity('friction', mannings_n) 1691 1692 #domain.set_quantity('stage', expression='elevation') 1693 1694 # Set initial flow as depth=1m, uh=1.0 m/s, vh = 0.0 1695 # making it 20 m^3/s across entire domain 1696 domain.set_quantity('stage', expression='elevation + %f' % d) 1697 domain.set_quantity('xmomentum', uh) 1698 domain.set_quantity('ymomentum', vh) 1699 1700 #-------------------------------------------------------------- 1701 # Setup boundary conditions 1702 #-------------------------------------------------------------- 1703 1704 Br = Reflective_boundary(domain) # Solid reflective wall 1705 1706 # Constant flow in and out of domain 1707 # Depth = 1m, uh=1 m/s, i.e. a flow of 20 m^3/s 1708 # across boundaries 1709 Bi = Dirichlet_boundary([d, uh, vh]) 1710 Bo = Dirichlet_boundary([-length*slope+d, uh, vh]) 1711 #Bo = Dirichlet_boundary([-100, 0, 0]) 1712 1713 domain.set_boundary({'left': Bi, 'right': Bo, 1714 'top': Br, 'bottom': Br}) 1715 1716 #-------------------------------------------------------------- 1717 # Evolve system through time 1718 #-------------------------------------------------------------- 1719 1720 for t in domain.evolve(yieldstep=100.0, finaltime=finaltime): 1721 if verbose : 1722 print domain.timestepping_statistics() 1723 print domain.volumetric_balance_statistics() 1724 1725 # 90 degree flowline at 200m 1726 q = domain.get_flow_through_cross_section([[200.0, 0.0], 1727 [200.0, 20.0]]) 1728 msg = ('Predicted flow was %f, should have been %f' 1729 % (q, ref_flow)) 1730 if verbose: 1731 print ('90 degree flowline: ANUGA = %f, Ref = %f' 1732 % (q, ref_flow)) 1733 1734 # 45 degree flowline at 200m 1735 q = domain.get_flow_through_cross_section([[200.0, 0.0], 1736 [220.0, 20.0]]) 1737 msg = ('Predicted flow was %f, should have been %f' 1738 % (q, ref_flow)) 1739 if verbose: 1740 print ('45 degree flowline: ANUGA = %f, Ref = %f' 1741 % (q, ref_flow)) 1742 1743 # Stage recorder (gauge) in middle of plane at 200m 1744 x = 200.0 1745 y = 10.00 1746 w = domain.get_quantity('stage').\ 1747 get_values(interpolation_points=[[x, y]])[0] 1748 z = domain.get_quantity('elevation').\ 1749 get_values(interpolation_points=[[x, y]])[0] 1750 domain_depth = w-z 1751 1752 xmom = domain.get_quantity('xmomentum').\ 1753 get_values(interpolation_points=[[x, y]])[0] 1754 ymom = domain.get_quantity('ymomentum').\ 1755 get_values(interpolation_points=[[x, y]])[0] 1756 if verbose: 1757 print ('At interpolation point (h, uh, vh): ', 1758 domain_depth, xmom, ymom) 1759 print 'uh * d * width = ', xmom*domain_depth*width 1760 1761 if slope > 0.0: 1762 # Compute normal depth at gauge location using Manning eqn 1763 # v=1/n*(r^2/3)*(s^0.5) or r=(Q*n/(s^0.5*W))^0.6 1764 normal_depth = (ref_flow*mannings_n/(slope**0.5*width))**0.6 1765 if verbose: 1766 print ('Depth: ANUGA = %f, Mannings = %f' 1767 % (domain_depth, normal_depth)) 1768 1769 os.remove('Inflow_flowline_test.sww') 1770 1771 1772 ################################################################################# 1608 ################################################################################ 1773 1609 1774 1610 if __name__ == "__main__":
Note: See TracChangeset
for help on using the changeset viewer.