- Timestamp:
- Jun 22, 2010, 5:52:28 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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})
Note: See TracChangeset
for help on using the changeset viewer.