Ignore:
Timestamp:
Jun 22, 2010, 5:52:28 PM (12 years ago)
Author:
hudson
Message:

Shallow water balanced tests fail, but no longer have errors.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/shallow_water_balanced/test_swb_basic.py

    r7866 r7869  
    133133
    134134    def test_rotate(self):
     135        from anuga.shallow_water.shallow_water_ext import rotate
    135136        normal = num.array([0.0, -1.0])
    136137
     
    492493        # Setup boundary conditions
    493494        #--------------------------------------------------------------
    494         Br = Reflective_boundary(domain)                       # Reflective wall
    495         Bd = Dirichlet_boundary([final_runup_height, 0, 0])    # Constant inflow
     495        Br = anuga.Reflective_boundary(domain)                 # Reflective wall
     496        Bd = anuga.Dirichlet_boundary([final_runup_height, 0, 0])# Steady inflow
    496497
    497498        # All reflective to begin with (still water)
     
    598599        from anuga.abstract_2d_finite_volumes.mesh_factory \
    599600                import rectangular_cross
    600         from data_manager import get_maximum_inundation_elevation
    601         from data_manager import get_maximum_inundation_location
    602         from data_manager import get_maximum_inundation_data
     601        from anuga.shallow_water.sww_interrogate import \
     602            get_maximum_inundation_elevation, get_maximum_inundation_location, \
     603            get_maximum_inundation_data
    603604
    604605        initial_runup_height = -0.4
     
    632633        # Setup boundary conditions
    633634        #--------------------------------------------------------------
    634         Br = Reflective_boundary(domain)                       # Reflective wall
    635         Bd = Dirichlet_boundary([final_runup_height, 0, 0])    # Constant inflow
     635        Br = anuga.Reflective_boundary(domain)                 # Reflective wall
     636        Bd = anuga.Dirichlet_boundary([final_runup_height, 0, 0])# Steady inflow
    636637
    637638        # All reflective to begin with (still water)
     
    787788        """
    788789
    789         from anuga.pmesh.mesh_interface import create_mesh_from_regions
    790         from anuga.abstract_2d_finite_volumes.mesh_factory \
    791                 import rectangular_cross
    792         from anuga.shallow_water import Domain
    793         from anuga.shallow_water import Reflective_boundary
    794         from anuga.shallow_water import Dirichlet_boundary
    795 
    796790        #-----------------------------------------------------------------
    797791        # Setup computational domain
    798792        #-----------------------------------------------------------------
    799         points, vertices, boundary = rectangular_cross(10, 10) # Basic mesh
    800         domain = Domain(points, vertices, boundary) # Create domain
     793        points, vertices, boundary = anuga.rectangular_cross(10, 10)# Basic mesh
     794        domain = anuga.Domain(points, vertices, boundary) # Create domain
    801795        domain.set_default_order(2)
    802796        domain.set_quantities_to_be_stored(None)
     
    816810        # Setup boundary conditions
    817811        #----------------------------------------------------------------
    818         Br = Reflective_boundary(domain)           # Solid reflective wall
    819         Bd = Dirichlet_boundary([-0.2, 0., 0.])    # Constant boundary values
     812        Br = anuga.Reflective_boundary(domain)           # Solid reflective wall
     813        Bd = anuga.Dirichlet_boundary([-0.2, 0., 0.])    # Constant
    820814        domain.set_boundary({'left': Br, 'right': Bd, 'top': Br, 'bottom': Br})
    821815
     
    879873        vertices = [[1,0,2], [1,2,4], [4,2,5], [3,1,4]]
    880874
    881         domain = Domain(points, vertices)
     875        domain = anuga.Domain(points, vertices)
    882876
    883877        #Set up for a gradient of (3,0) at mid triangle (bce)
     
    898892        initial_stage = copy.copy(domain.quantities['stage'].vertex_values)
    899893
    900         domain.set_boundary({'exterior': Reflective_boundary(domain)})
     894        domain.set_boundary({'exterior': anuga.Reflective_boundary(domain)})
    901895
    902896        domain.optimise_dry_cells = True
     
    916910
    917911    def test_second_order_flat_bed_onestep(self):
    918         from mesh_factory import rectangular
    919912
    920913        #Create basic mesh
    921         points, vertices, boundary = rectangular(6, 6)
     914        points, vertices, boundary = anuga.rectangular(6, 6)
    922915
    923916        #Create shallow water domain
    924         domain = Domain(points, vertices, boundary)
     917        domain = anuga.Domain(points, vertices, boundary)
    925918        domain.set_default_order(2)
    926919
    927920        # 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.])
    930923        domain.set_boundary({'left': Bd, 'right': Br, 'top': Br, 'bottom': Br})
    931924
     
    10271020
    10281021        # Create shallow water domain
    1029         domain = Domain(points, vertices, boundary)
     1022        domain = anuga.Domain(points, vertices, boundary)
    10301023        domain.smooth = False
    10311024        domain.default_order = 2
    10321025
    10331026        # 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.])
    10361029        domain.set_boundary({'left': Bd, 'right': Br, 'top': Br, 'bottom': Br})
    10371030
     
    10631056
    10641057        # 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.])
    10671060
    10681061        domain.set_boundary({'left': Bd, 'right': Br, 'top': Br, 'bottom': Br})
     
    11011094
    11021095        # 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.])
    11051098
    11061099        domain.set_boundary({'left': Bd, 'right': Br, 'top': Br, 'bottom': Br})
     
    11561149
    11571150        # 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.])
    11601153
    11611154        domain.set_boundary({'left': Bd, 'right': Br, 'top': Br, 'bottom': Br})
     
    12011194
    12021195        # 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.])
    12051198
    12061199        domain.set_boundary({'left': Bd, 'right': Br, 'top': Br, 'bottom': Br})
     
    13481341
    13491342        # Boundary conditions
    1350         Br = Reflective_boundary(domain)
     1343        Br = anuga.Reflective_boundary(domain)
    13511344        domain.set_boundary({'left': Br, 'right': Br, 'top': Br, 'bottom': Br})
    13521345
     
    15121505
    15131506        # Boundary conditions
    1514         Br = Reflective_boundary(domain)
     1507        Br = anuga.Reflective_boundary(domain)
    15151508        domain.set_boundary({'left': Br, 'right': Br, 'top': Br, 'bottom': Br})
    15161509
     
    15561549        domain.set_quantity('elevation', Z)
    15571550
    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])
    15601553        domain.set_boundary({'left': Bd, 'right': Br, 'bottom': Br, 'top': Br})
    15611554
     
    16141607        import time, os
    16151608        from Scientific.IO.NetCDF import NetCDFFile
    1616         from data_manager import extent_sww
    16171609        from mesh_factory import rectangular_cross
    16181610
     
    17281720
    17291721         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]))
    17331725         tags["1"] = b1
    17341726         tags["2"] = b2
     
    19091901
    19101902        verbose = False
    1911 
    1912         from anuga.shallow_water import Domain
    1913         from anuga.pmesh.mesh_interface import create_mesh_from_regions
    1914         from anuga.geospatial_data.geospatial_data import Geospatial_data
    1915 
    19161903       
    19171904        # Get path where this test is run
     
    19651952
    19661953        meshname = os.path.join(path, 'offending_mesh.msh')
    1967         create_mesh_from_regions(bounding_polygon,
     1954        anuga.create_mesh_from_regions(bounding_polygon,
    19681955                                 boundary_tags={'south': [0], 'east': [1],
    19691956                                                'north': [2], 'west': [3]},
     
    19741961                                 verbose=verbose)
    19751962
    1976         domain = Domain(meshname, use_cache=False, verbose=verbose)
     1963        domain = anuga.Domain(meshname, use_cache=False, verbose=verbose)
    19771964
    19781965        #----------------------------------------------------------------------
     
    20001987            os.remove(points_file)           
    20011988       
    2002         #finally:
    2003             # Cleanup regardless
    2004             #FIXME(Ole): Finally does not work like this in python2.4
    2005             #FIXME(Ole): Reinstate this when Python2.4 is out of the way
    2006             #FIXME(Ole): Python 2.6 apparently introduces something called 'with'           
    2007             #os.remove(meshname)
    2008             #os.remove(points_file)
    2009 
    20101989
    20111990    def test_fitting_example_that_crashed_2(self):
     
    20222001
    20232002        verbose = False       
    2024 
    2025         from anuga.shallow_water import Domain
    2026         from anuga.pmesh.mesh_interface import create_mesh_from_regions
    2027         from anuga.geospatial_data import Geospatial_data
    20282003       
    20292004        # Get path where this test is run
     
    20392014        bounding_polygon = [[W, S], [E, S], [E, N], [W, N]]
    20402015
    2041         create_mesh_from_regions(bounding_polygon,
     2016        anuga.create_mesh_from_regions(bounding_polygon,
    20422017                                 boundary_tags={'south': [0],
    20432018                                                'east': [1],
     
    20492024                                 verbose=verbose)
    20502025
    2051         domain = Domain(meshname, use_cache=True, verbose=verbose)
     2026        domain = anuga.Domain(meshname, use_cache=True, verbose=verbose)
    20522027       
    20532028        # Large test set revealed one problem
     
    21312106        # Setup boundary conditions
    21322107        #------------------------------------------------------------------
    2133         Bi = Dirichlet_boundary([0.4, 0, 0])          # Inflow
    2134         Br = Reflective_boundary(domain)              # Solid reflective wall
    2135         Bo = Dirichlet_boundary([-5, 0, 0])           # Outflow
     2108        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
    21362111
    21372112        domain.set_boundary({'left': Bi, 'right': Bo, 'top': Br, 'bottom': Br})
Note: See TracChangeset for help on using the changeset viewer.