Changeset 3689


Ignore:
Timestamp:
Oct 4, 2006, 11:00:56 AM (18 years ago)
Author:
ole
Message:

Added functionality for getting arbitrary interpolated values in Quantity as well as calculating inundation height and location. This work was done at SUT during the last week of September 2006.

Location:
anuga_core/source/anuga
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/abstract_2d_finite_volumes/domain.py

    r3678 r3689  
    318318
    319319        See methods inside the quantity object for more options
     320
     321        FIXME: clean input args
    320322        """
    321323
     
    498500        print self.timestepping_statistics()
    499501
    500         #Old version
    501         #if self.min_timestep == self.max_timestep:
    502         #    print 'Time = %.4f, delta t = %.8f, steps=%d (%d)'\
    503         #          %(self.time, self.min_timestep, self.number_of_steps,
    504         #            self.number_of_first_order_steps)
    505         #elif self.min_timestep > self.max_timestep:
    506         #    print 'Time = %.4f, steps=%d (%d)'\
    507         #          %(self.time, self.number_of_steps,
    508         #            self.number_of_first_order_steps)
    509         #else:
    510         #    print 'Time = %.4f, delta t in [%.8f, %.8f], steps=%d (%d)'\
    511         #          %(self.time, self.min_timestep,
    512         #            self.max_timestep, self.number_of_steps,
    513         #            self.number_of_first_order_steps)
    514502
    515503    def timestepping_statistics(self):
  • anuga_core/source/anuga/abstract_2d_finite_volumes/general_mesh.py

    r3684 r3689  
    178178
    179179    def __repr__(self):
    180         return 'Mesh: %d vertex coordinates, %d triangles'\
     180        return 'Mesh: %d vertices, %d triangles'\
    181181               %(self.coordinates.shape[0], len(self))
    182182
     
    197197
    198198
    199     def get_vertex_coordinates(self, obj=False, absolute=False):
     199    def get_vertex_coordinates(self, unique=False, obj=False, absolute=False):
    200200        """Return all vertex coordinates.
    201201        Return all vertex coordinates for all triangles as an Nx6 array
     
    212212        (To see which, switch to default absolute=True and run tests).
    213213        """
     214
     215        if unique is True:
     216            V = self.coordinates
     217            if absolute is True:
     218                if not self.geo_reference.is_absolute():
     219                    V = self.geo_reference.get_absolute(V)
     220
     221            return V
     222
     223               
    214224
    215225        V = self.vertex_coordinates
     
    226236               
    227237        if obj is True:
    228 
    229238            N = V.shape[0]
    230239            return reshape(V, (3*N, 2))
  • anuga_core/source/anuga/abstract_2d_finite_volumes/neighbour_mesh.py

    r3688 r3689  
    175175
    176176    def __repr__(self):
    177         return 'Mesh: %d vertex_coordinates, %d triangles, %d boundary segments'\
    178                %(self.coordinates.shape[0], len(self), len(self.boundary))
     177        return General_mesh.__repr__(self) + ', %d boundary segments'\
     178               %(len(self.boundary))
    179179
    180180
  • anuga_core/source/anuga/abstract_2d_finite_volumes/quantity.py

    r3678 r3689  
    1515"""
    1616
     17from Numeric import array, zeros, Float, concatenate, NewAxis, argmax, allclose
     18from anuga.utilities.numerical_tools import ensure_numeric
    1719
    1820class Quantity:
     
    2123
    2224        from anuga.abstract_2d_finite_volumes.neighbour_mesh import Mesh
    23         from Numeric import array, zeros, Float
    2425
    2526        msg = 'First argument in Quantity.__init__ '
     
    619620
    620621
    621         from Numeric import Float
    622         from anuga.utilities.numerical_tools import ensure_numeric
    623         #from anuga.abstract_2d_finite_volumes.least_squares import fit_to_mesh
    624622        from anuga.fit_interpolate.fit import fit_to_mesh
    625623        from anuga.coordinate_transforms.geo_reference import Geo_reference
     
    754752
    755753
    756     def get_values(self, location='vertices', indices = None):
     754   
     755   
     756    def get_maximum_index(self, indices=None):
     757        """Return index for maximum value of quantity (on centroids)
     758
     759        Optional argument:
     760            indices is the set of element ids that the operation applies to.
     761
     762        Usage:
     763            i = get_maximum_index()
     764
     765        Notes:
     766            We do not seek the maximum at vertices as each vertex can
     767            have multiple values - one for each triangle sharing it.
     768
     769            If there are multiple cells with same maximum value, the first cell
     770            encountered in the triangle array is returned.
     771        """
     772
     773        V = self.get_values(location='centroids', indices=indices)
     774
     775        # Always return absolute indices
     776        i = argmax(V)
     777
     778        if indices is None:
     779            return i
     780        else:
     781            return indices[i]
     782
     783       
     784    def get_maximum_value(self, indices=None):
     785        """Return maximum value of quantity (on centroids)
     786
     787        Optional argument:
     788            indices is the set of element ids that the operation applies to.
     789
     790        Usage:
     791            v = get_maximum_value()
     792
     793        Note, we do not seek the maximum at vertices as each vertex can
     794        have multiple values - one for each triangle sharing it           
     795        """
     796
     797
     798        i = self.get_maximum_index(indices)
     799        V = self.get_values(location='centroids') #, indices=indices)
     800       
     801        return V[i]
     802       
     803
     804    def get_maximum_location(self, indices=None):
     805        """Return location of maximum value of quantity (on centroids)
     806
     807        Optional argument:
     808            indices is the set of element ids that the operation applies to.
     809
     810        Usage:
     811            x, y = get_maximum_location()
     812
     813
     814        Notes:
     815            We do not seek the maximum at vertices as each vertex can
     816            have multiple values - one for each triangle sharing it.
     817
     818            If there are multiple cells with same maximum value, the first cell
     819            encountered in the triangle array is returned.           
     820        """
     821
     822        i = self.get_maximum_index(indices)
     823        x, y = self.domain.get_centroid_coordinates()[i]
     824
     825        return x, y
     826
     827
     828
     829
     830    def get_interpolated_values(self, interpolation_points):
     831
     832        # Interpolation object based on internal (discontinuous triangles)
     833        x, y, vertex_values, triangles = self.get_vertex_values(xy=True, smooth=False)
     834        # FIXME: This concat should roll into get_vertex_values
     835        vertex_coordinates = concatenate( (x[:, NewAxis], y[:, NewAxis]), axis=1 )
     836
     837        can_reuse = False
     838        if hasattr(self, 'interpolation_object'):
     839            # Reuse to save time
     840            I = self.interpolation_object
     841
     842            if allclose(interpolation_points, I._point_coordinates):
     843                can_reuse = True
     844               
     845
     846        if can_reuse is True:       
     847            result = I.interpolate(vertex_values) # Use absence to indicate reuse
     848        else:   
     849            from anuga.fit_interpolate.interpolate import Interpolate
     850
     851            # Create interpolation object with matrix
     852            I = Interpolate(vertex_coordinates, triangles)
     853            self.interpolation_object = I
     854
     855            # Call interpolate with points the first time
     856            interpolation_points = ensure_numeric(interpolation_points, Float)                       
     857            result = I.interpolate(vertex_values, interpolation_points)           
     858
     859        return result
     860
     861
     862    def get_values(self, interpolation_points=None, location='vertices', indices = None):
    757863        """get values for quantity
    758864
    759865        return X, Compatible list, Numeric array (see below)
     866        interpolation_points: List of x, y coordinates where value is sought (using interpolation)
     867                If points are given, values of location and indices are ignored
    760868        location: Where values are to be stored.
    761869                  Permissible options are: vertices, edges, centroid
    762870                  and unique vertices. Default is 'vertices'
    763871
    764         In case of location == 'centroids' the dimension values must
    765         be a list of a Numerical array of length N, N being the number
    766         of elements. Otherwise it must be of dimension Nx3
    767872
    768873        The returned values with be a list the length of indices
    769         (N if indices = None).  Each value will be a list of the three
    770         vertex values for this quantity.
     874        (N if indices = None).
     875
     876        In case of location == 'centroids' the dimension of returned values will
     877        be a list or a Numerical array of length N, N being the number
     878        of elements.
     879       
     880        In case of location == 'vertices' or 'edges' the dimension of returned values will
     881        be of dimension Nx3
     882
     883        In case of location == 'unique vertices' the average value at each vertex will be
     884        returned and the dimension of returned values will be a 1d array of length "number of vertices"
     885       
    771886
    772887        Indices is the set of element ids that the operation applies to.
     
    777892        """
    778893        from Numeric import take
     894
     895        if interpolation_points is not None:
     896            return self.get_interpolated_values(interpolation_points)
     897       
     898       
    779899
    780900        if location not in ['vertices', 'centroids', 'edges', 'unique vertices']:
     
    810930                # Go through all triangle, vertex pairs
    811931                # Average the values
     932               
     933                # FIXME (Ole): Should we merge this with get_vertex_values
     934                # and use the concept of a reduction operator?
    812935                sum = 0
    813936                for triangle_id, vertex_id in triangles:
     
    9401063            precision = Float
    9411064
    942         if reduction is None:
    943             reduction = self.domain.reduction
    944 
    9451065        #Create connectivity
    9461066
    9471067        if smooth == True:
     1068           
     1069            if reduction is None:
     1070                reduction = self.domain.reduction
    9481071
    9491072            V = self.domain.get_vertices()
  • anuga_core/source/anuga/abstract_2d_finite_volumes/test_general_mesh.py

    r3560 r3689  
    1818    def tearDown(self):
    1919        pass
     20
     21
     22    def test_get_vertex_coordinates(self):
     23        from mesh_factory import rectangular
     24        from Numeric import zeros, Float
     25
     26        #Create basic mesh
     27        points, vertices, boundary = rectangular(1, 3)
     28        domain = General_mesh(points, vertices, boundary)
     29
     30        assert allclose(domain.get_vertex_coordinates(unique=True), domain.coordinates)
     31
     32        #assert allclose(domain.get_vertex_coordinates(), ...TODO
     33        #assert allclose(domain.get_vertex_coordinates(absolute=True), ...TODO
     34       
     35       
    2036
    2137    def test_get_vertex_values(self):
     
    6783        assert unique_vertices == [0,2,4,5,6,7]
    6884
     85
     86       
     87
    6988#-------------------------------------------------------------
    7089if __name__ == "__main__":
  • anuga_core/source/anuga/abstract_2d_finite_volumes/test_quantity.py

    r3678 r3689  
    110110                                               [4.5, 4.5, 0.],
    111111                                               [3.0, -1.5, -1.5]])
     112
     113    def test_get_maximum_1(self):
     114        quantity = Conserved_quantity(self.mesh4,
     115                                      [[1,2,3], [5,5,5], [0,0,9], [-6, 3, 3]])
     116        assert allclose(quantity.centroid_values, [2., 5., 3., 0.]) #Centroids
     117
     118        v = quantity.get_maximum_value()
     119        assert v == 5
     120
     121        i = quantity.get_maximum_index()
     122        assert i == 1
     123       
     124        x,y = quantity.get_maximum_location()
     125        xref, yref = 4.0/3, 4.0/3
     126        assert x == xref
     127        assert y == yref
     128
     129        v = quantity.get_values(interpolation_points = [[x,y]])
     130        assert allclose(v, 5)
     131
     132    def test_get_maximum_2(self):
     133
     134        a = [0.0, 0.0]
     135        b = [0.0, 2.0]
     136        c = [2.0,0.0]
     137        d = [0.0, 4.0]
     138        e = [2.0, 2.0]
     139        f = [4.0,0.0]
     140
     141        points = [a, b, c, d, e, f]
     142        #bac, bce, ecf, dbe
     143        vertices = [[1,0,2], [1,2,4], [4,2,5], [3,1,4]]
     144
     145        domain = Domain(points, vertices)
     146
     147        quantity = Quantity(domain)
     148        quantity.set_values(lambda x, y: x+2*y) #2 4 4 6
     149       
     150        v = quantity.get_maximum_value()
     151        assert v == 6
     152
     153        i = quantity.get_maximum_index()
     154        assert i == 3
     155       
     156        x,y = quantity.get_maximum_location()
     157        xref, yref = 2.0/3, 8.0/3
     158        assert x == xref
     159        assert y == yref
     160
     161        v = quantity.get_values(interpolation_points = [[x,y]])
     162        assert allclose(v, 6)
     163
     164
     165        #Multiple locations for maximum -
     166        #Test that the algorithm picks the first occurrence       
     167        v = quantity.get_maximum_value(indices=[0,1,2])
     168        assert allclose(v, 4)
     169
     170        i = quantity.get_maximum_index(indices=[0,1,2])
     171        assert i == 1
     172       
     173        x,y = quantity.get_maximum_location(indices=[0,1,2])
     174        xref, yref = 4.0/3, 4.0/3
     175        assert x == xref
     176        assert y == yref
     177
     178        v = quantity.get_values(interpolation_points = [[x,y]])
     179        assert allclose(v, 4)       
     180
     181        # More test of indices......
     182        v = quantity.get_maximum_value(indices=[2,3])
     183        assert allclose(v, 6)
     184
     185        i = quantity.get_maximum_index(indices=[2,3])
     186        assert i == 3
     187       
     188        x,y = quantity.get_maximum_location(indices=[2,3])
     189        xref, yref = 2.0/3, 8.0/3
     190        assert x == xref
     191        assert y == yref
     192
     193        v = quantity.get_values(interpolation_points = [[x,y]])
     194        assert allclose(v, 6)       
     195
     196       
    112197
    113198    def test_boundary_allocation(self):
     
    13891474        #      quantity.get_values(location = 'centroids')
    13901475
     1476
     1477
     1478
     1479    def test_get_values_2(self):
     1480        """Different mesh (working with domain object) - also check centroids.
     1481        """
     1482
     1483       
     1484        a = [0.0, 0.0]
     1485        b = [0.0, 2.0]
     1486        c = [2.0,0.0]
     1487        d = [0.0, 4.0]
     1488        e = [2.0, 2.0]
     1489        f = [4.0,0.0]
     1490
     1491        points = [a, b, c, d, e, f]
     1492        #bac, bce, ecf, dbe
     1493        vertices = [ [1,0,2], [1,2,4], [4,2,5], [3,1,4]]
     1494
     1495        domain = Domain(points, vertices)
     1496
     1497        quantity = Quantity(domain)
     1498        quantity.set_values(lambda x, y: x+2*y) #2 4 4 6
     1499       
     1500        assert allclose(quantity.get_values(location='centroids'), [2,4,4,6])
     1501        assert allclose(quantity.get_values(location='centroids', indices=[1,3]), [4,6])
     1502
     1503
     1504        assert allclose(quantity.get_values(location='vertices'), [[4,0,2],
     1505                                                                   [4,2,6],
     1506                                                                   [6,2,4],
     1507                                                                   [8,4,6]])
     1508       
     1509        assert allclose(quantity.get_values(location='vertices', indices=[1,3]), [[4,2,6],
     1510                                                                                  [8,4,6]])
     1511
     1512
     1513        assert allclose(quantity.get_values(location='edges'), [[1,3,2],
     1514                                                                [4,5,3],
     1515                                                                [3,5,4],
     1516                                                                [5,7,6]])
     1517        assert allclose(quantity.get_values(location='edges', indices=[1,3]),
     1518                        [[4,5,3],
     1519                         [5,7,6]])       
     1520
     1521        # Check averaging over vertices
     1522        #a: 0
     1523        #b: (4+4+4)/3
     1524        #c: (2+2+2)/3
     1525        #d: 8
     1526        #e: (6+6+6)/3       
     1527        #f: 4
     1528        assert(quantity.get_values(location='unique vertices'), [0, 4, 2, 8, 6, 4])       
     1529                                                                                 
     1530       
     1531
     1532
     1533
     1534
     1535    def test_get_interpolated_values(self):
     1536
     1537        from mesh_factory import rectangular
     1538        from shallow_water import Domain
     1539        from Numeric import zeros, Float
     1540
     1541        #Create basic mesh
     1542        points, vertices, boundary = rectangular(1, 3)
     1543        domain = Domain(points, vertices, boundary)
     1544
     1545        #Constant values
     1546        quantity = Quantity(domain,[[0,0,0],[1,1,1],[2,2,2],[3,3,3],
     1547                                    [4,4,4],[5,5,5]])
     1548
     1549       
     1550
     1551        # Get interpolated values at centroids
     1552        interpolation_points = domain.get_centroid_coordinates()
     1553        answer = quantity.get_values(location='centroids')
     1554
     1555       
     1556        #print quantity.get_values(points=interpolation_points)
     1557        assert allclose(answer, quantity.get_values(interpolation_points=interpolation_points))
     1558
     1559
     1560        #Arbitrary values
     1561        quantity = Quantity(domain,[[0,1,2],[3,1,7],[2,1,2],[3,3,7],
     1562                                    [1,4,-9],[2,5,0]])
     1563
     1564
     1565        # Get interpolated values at centroids
     1566        interpolation_points = domain.get_centroid_coordinates()
     1567        answer = quantity.get_values(location='centroids')
     1568        #print answer
     1569        #print quantity.get_values(points=interpolation_points)
     1570        assert allclose(answer, quantity.get_values(interpolation_points=interpolation_points))       
     1571                       
     1572
     1573        #FIXME TODO
     1574        #indices = [0,5,3]
     1575        #answer = [0.5,1,5]
     1576        #assert allclose(answer,
     1577        #                quantity.get_values(indices=indices, \
     1578        #                                    location = 'unique vertices'))
     1579
     1580
     1581
     1582
     1583    def test_get_interpolated_values_2(self):
     1584        a = [0.0, 0.0]
     1585        b = [0.0, 2.0]
     1586        c = [2.0,0.0]
     1587        d = [0.0, 4.0]
     1588        e = [2.0, 2.0]
     1589        f = [4.0,0.0]
     1590
     1591        points = [a, b, c, d, e, f]
     1592        #bac, bce, ecf, dbe
     1593        vertices = [[1,0,2], [1,2,4], [4,2,5], [3,1,4]]
     1594
     1595        domain = Domain(points, vertices)
     1596
     1597        quantity = Quantity(domain)
     1598        quantity.set_values(lambda x, y: x+2*y) #2 4 4 6
     1599
     1600        #First pick one point
     1601        x, y = 2.0/3, 8.0/3
     1602        v = quantity.get_values(interpolation_points = [[x,y]])
     1603        assert allclose(v, 6)       
     1604
     1605        # Then another to test that algorithm won't blindly
     1606        # reuse interpolation matrix
     1607        x, y = 4.0/3, 4.0/3
     1608        v = quantity.get_values(interpolation_points = [[x,y]])
     1609        assert allclose(v, 4)       
     1610
     1611
     1612
     1613
    13911614    def test_getting_some_vertex_values(self):
    13921615        """
  • anuga_core/source/anuga/config.py

    r3678 r3689  
    117117maximum_allowed_speed = 100.0 #Maximal particle speed of water
    118118
    119 minimum_storable_height = 0.001 #Water depth below which it is *stored* as 0
     119minimum_storable_height = minimum_allowed_height #Water depth below which it is *stored* as 0
  • anuga_core/source/anuga/damage_modelling/test_inundation_damage.py

    r3567 r3689  
    142142    def tearDown(self):
    143143        #print "***** tearDown  ********"
     144
     145        # FIXME (Ole): Sometimes this fails - is the file open or is it sometimes not created?
    144146        os.remove(self.sww.filename)
    145147        os.remove(self.csv_file)
  • anuga_core/source/anuga/examples/netherlands.py

    r3678 r3689  
    166166#
    167167print 'Initial condition'
    168 domain.set_quantity('stage', Constant_height(Z, 0.0))
    169 #domain.set_quantity('stage', Constant_stage(inflow_stage/2.0))
     168domain.set_quantity('stage', expression='Z + 0.0')
    170169
    171170#Evolve
  • anuga_core/source/anuga/examples/runup.py

    r3563 r3689  
    99# Import necessary modules
    1010#------------------------------------------------------------------------------
    11 
    1211from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
    1312from anuga.shallow_water import Domain
     
    1514from anuga.shallow_water import Dirichlet_boundary
    1615from anuga.shallow_water import Time_boundary
    17 from anuga.shallow_water import Transmissive_boundary
     16from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
    1817
    1918
     
    2120# Setup computational domain
    2221#------------------------------------------------------------------------------
    23 
    24 points, vertices, boundary = rectangular_cross(10, 10) # Basic mesh
     22N=10
     23points, vertices, boundary = rectangular_cross(N, N) # Basic mesh
    2524
    2625domain = Domain(points, vertices, boundary) # Create domain
     
    3130# Setup initial conditions
    3231#------------------------------------------------------------------------------
    33 
    3432def topography(x,y):
    3533    return -x/2                             # linear bed slope
    36     #return x*(-(2.0-x)*.5)                  # curved bed slope
     34   
    3735
    3836domain.set_quantity('elevation', topography) # Use function for elevation
    39 domain.set_quantity('friction', 0.1)         # Constant friction
     37domain.set_quantity('friction', 0.0)         # Constant friction
    4038domain.set_quantity('stage', -.4)            # Constant negative initial stage
    4139
     
    4442# Setup boundary conditions
    4543#------------------------------------------------------------------------------
     44from math import sin, pi, exp
    4645
    47 from math import sin, pi, exp
     46def waveform(t):
     47    return (0.1*sin(t*2*pi)-0.8) * exp(-2*t)
     48
     49Bw = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
    4850Br = Reflective_boundary(domain)      # Solid reflective wall
    49 Bt = Transmissive_boundary(domain)    # Continue all values on boundary
    50 Bd = Dirichlet_boundary([-0.2,0.,0.]) # Constant boundary values
    51 Bw = Time_boundary(domain=domain,     # Time dependent boundary 
    52                    f=lambda t: [(.1*sin(t*2*pi)-0.3) * exp(-2*t), 0.0, 0.0])
     51Bd = Dirichlet_boundary([-0.3,0,0])
    5352
    5453# Associate boundary tags with boundary objects
     
    5958# Evolve system through time
    6059#------------------------------------------------------------------------------
    61 
    62 for t in domain.evolve(yieldstep = 0.1, finaltime = 10.0):
     60for t in domain.evolve(yieldstep = 0.1, finaltime = 5.0):
    6361    domain.write_time()
    6462   
  • anuga_core/source/anuga/examples/runup_convergence.py

    r3630 r3689  
    3434sea_level = 0       # Mean sea level
    3535min_elevation = -20 # Lowest elevation (elevation of offshore flat part)
    36 offshore_depth=sea_level-min_elevation # offshore water depth
     36offshore_depth = sea_level-min_elevation # offshore water depth
    3737amplitude = 0.5       # Solitary wave height H
    3838normalized_amplitude = amplitude/offshore_depth
     
    5252
    5353# Structured mesh
    54 dx = 20           # Resolution: Length of subdivisions on x axis (length)
    55 dy = 20           # Resolution: Length of subdivisions on y axis (width)
     54dx = 30           # Resolution: Length of subdivisions on x axis (length)
     55dy = 30           # Resolution: Length of subdivisions on y axis (width)
    5656
    5757length = east-west
     
    7474                         interior_regions=[[interior_polygon,dx*dy/32]])
    7575domain = Domain(meshname, use_cache=True, verbose = True)
    76 
     76domain.set_minimum_storable_height(0.01)
    7777
    7878
     
    134134
    135135
     136w0 = domain.get_maximum_inundation_elevation()
     137x0, y0 = domain.get_maximum_inundation_location()
     138print 'Coastline elevation = %.2f at (%.2f, %.2f)' %(w0, x0, y0)
     139w_i = domain.get_quantity('stage').get_values(interpolation_points=[[x0,y0]])
     140print 'Interpolated elevation at (%.2f, %.2f) is %.2f' %(x0, y0, w_i)
     141
    136142#------------------------------------------------------------------------------
    137143# Evolve system through time
    138144#------------------------------------------------------------------------------
    139145
     146w_max = w0
    140147stagestep = []
    141148for t in domain.evolve(yieldstep = 1, finaltime = 300):
    142149    domain.write_time()
     150
     151    w = domain.get_maximum_inundation_elevation()
     152    x, y = domain.get_maximum_inundation_location()
     153    print '  Coastline elevation = %.2f at (%.2f, %.2f)' %(w, x, y)   
     154    #w_i = domain.get_quantity('stage').get_values(interpolation_points=[[x,y]])
     155    #print '  Interpolated elevation at (%.2f, %.2f) is %.2f' %(x, y, w_i)
     156                                                             
     157
     158    if w > w_max:
     159        w_max = w
     160        x_max = x
     161        y_max = y
    143162
    144163    # Let's find the maximum runup here working directly with the quantities,
     
    149168    # 3 Find min x where h>0 over all t.
    150169    # 4 Perhaps do this across a number of ys
    151    
     170
     171print 'Max coastline elevation = %.2f at (%.2f, %.2f)' %(w_max, x_max, y_max)
     172
     173print 'Run up distance - %.2f' %sqrt( (x-x0)**2 + (y-y0)**2 )
     174
     175
    152176
    153177#-----------------------------------------------------------------------------
  • anuga_core/source/anuga/fit_interpolate/general_fit_interpolate.py

    r3566 r3689  
    7777        triangles = ensure_numeric(triangles, Int)
    7878        vertex_coordinates = ensure_absolute(vertex_coordinates,
    79                                          geo_reference = mesh_origin)
     79                                             geo_reference = mesh_origin)
    8080
    8181        #Don't pass geo_reference to mesh.  It doesn't work.
     
    8383        self.mesh.check_integrity()
    8484        self.root = build_quadtree(self.mesh,
    85                               max_points_per_cell = max_vertices_per_cell)
     85                                   max_points_per_cell = max_vertices_per_cell)
    8686        #print "self.root",self.root.show()
    8787       
    8888       
     89    def __repr__(self):
     90        return 'Interpolation object based on: ' + repr(self.mesh)
  • anuga_core/source/anuga/fit_interpolate/interpolate.py

    r3686 r3689  
    7676              a mesh origin, since geospatial has its own mesh origin.
    7777        """
     78
     79        # FIXME (Ole): Need an input check
    7880       
    7981        # Initialise variabels
     
    8284       
    8385        FitInterpolate.__init__(self,
    84                  vertex_coordinates,
    85                  triangles,
    86                  mesh_origin,
    87                  verbose,
    88                  max_vertices_per_cell)
    89 
    90      # FIXME: What is a good start_blocking_len value?
     86                                vertex_coordinates,
     87                                triangles,
     88                                mesh_origin,
     89                                verbose,
     90                                max_vertices_per_cell)
     91
     92    # FIXME: What is a good start_blocking_len value?
    9193    def interpolate(self, f, point_coordinates = None,
    9294                    start_blocking_len = 500000, verbose=False):
     
    114116          Interpolated values at inputted points (z).
    115117        """
    116         #print "point_coordinates interpolate.interpolate",point_coordinates
    117         if isinstance(point_coordinates,Geospatial_data):
     118
     119       
     120        # FIXME (Ole): Need an input check that dimensions are compatible
     121
     122        # FIXME (Ole): Why is the interpolation matrix rebuilt everytime the method is called
     123        # even if interpolation points are unchanged.
     124       
     125        #print "point_coordinates interpolate.interpolate", point_coordinates
     126        if isinstance(point_coordinates, Geospatial_data):
    118127            point_coordinates = point_coordinates.get_data_points( \
    119128                absolute = True)
    120        
     129
    121130        # Can I interpolate, based on previous point_coordinates?
    122131        if point_coordinates is None:
    123132            if self._A_can_be_reused is True and \
    124             len(self._point_coordinates) < start_blocking_len:
     133                   len(self._point_coordinates) < start_blocking_len:
    125134                z = self._get_point_data_z(f,
    126135                                           verbose=verbose)
     
    134143                msg = 'ERROR (interpolate.py): No point_coordinates inputted'
    135144                raise Exception(msg)
    136            
    137            
    138         if point_coordinates is not None:
     145       
     146        if point_coordinates is not None:   
    139147            self._point_coordinates = point_coordinates
    140148            if len(point_coordinates) < start_blocking_len or \
     
    144152                                           verbose=verbose)
    145153            else:
     154                #print 'BLOCKING'
    146155                #Handle blocking
    147156                self._A_can_be_reused = False
    148                 start=0
     157                start = 0
    149158                # creating a dummy array to concatenate to.
    150159               
     
    156165                    z = zeros((0,))
    157166                   
    158                 for end in range(start_blocking_len
    159                                  ,len(point_coordinates)
    160                                  ,start_blocking_len):
     167                for end in range(start_blocking_len,
     168                                 len(point_coordinates),
     169                                 start_blocking_len):
    161170                    t = self.interpolate_block(f, point_coordinates[start:end],
    162171                                               verbose=verbose)
     
    171180        return z
    172181
     182
    173183    def interpolate_block(self, f, point_coordinates = None, verbose=False):
    174184        """
     
    184194                absolute = True)
    185195        if point_coordinates is not None:
    186             self._A =self._build_interpolation_matrix_A(point_coordinates,
    187                                                        verbose=verbose)
     196            self._A = self._build_interpolation_matrix_A(point_coordinates,
     197                                                         verbose=verbose)
    188198        return self._get_point_data_z(f)
    189199
     
    206216
    207217    def _build_interpolation_matrix_A(self,
    208                                      point_coordinates,
    209                                      verbose = False):
     218                                      point_coordinates,
     219                                      verbose = False):
    210220        """Build n x m interpolation matrix, where
    211221        n is the number of data points and
     
    224234        """
    225235
    226 
     236        #print 'Building interpolation matrix'
    227237       
    228238        #Convert point_coordinates to Numeric arrays, in case it was a list.
     
    486496            #Build interpolator
    487497            interpol = Interpolate(vertex_coordinates,
    488                                      triangles,
    489                                      #point_coordinates = \
    490                                      #self.interpolation_points,
    491                                      #alpha = 0,
    492                                      verbose = verbose)
     498                                   triangles,
     499                                   #point_coordinates = \
     500                                   #self.interpolation_points,
     501                                   #alpha = 0,
     502                                   verbose = verbose)
    493503
    494504            if verbose: print 'Interpolate'
     
    501511                    if len(quantities[name].shape) == 2:
    502512                        result = interpol.interpolate(quantities[name][i,:],
    503                                      point_coordinates = \
    504                                      self.interpolation_points)
     513                                                      point_coordinates = \
     514                                                      self.interpolation_points)
    505515                    else:
    506516                       #Assume no time dependency
  • anuga_core/source/anuga/fit_interpolate/test_interpolate.py

    r3563 r3689  
    105105        assert allclose(interp._build_interpolation_matrix_A(data).todense(),
    106106                        [[1./3, 1./3, 1./3]])
     107
     108
     109
     110    def test_simple_interpolation_example(self):
     111       
     112        from mesh_factory import rectangular
     113        from shallow_water import Domain
     114        from Numeric import zeros, Float
     115        from abstract_2d_finite_volumes.quantity import Quantity
     116
     117        #Create basic mesh
     118        points, vertices, boundary = rectangular(1, 3)
     119
     120        #Create shallow water domain
     121        domain = Domain(points, vertices, boundary)
     122
     123        #---------------
     124        #Constant values
     125        #---------------       
     126        quantity = Quantity(domain,[[0,0,0],[1,1,1],[2,2,2],[3,3,3],
     127                                    [4,4,4],[5,5,5]])
     128
     129
     130        x, y, vertex_values, triangles = quantity.get_vertex_values(xy=True, smooth=False)
     131        vertex_coordinates = concatenate( (x[:, NewAxis], y[:, NewAxis]), axis=1 )
     132        # FIXME: This concat should roll into get_vertex_values
     133
     134
     135        # Get interpolated values at centroids
     136        interpolation_points = domain.get_centroid_coordinates()
     137        answer = quantity.get_values(location='centroids')
     138
     139        I = Interpolate(vertex_coordinates, triangles)
     140        result = I.interpolate(vertex_values, interpolation_points)
     141        assert allclose(result, answer)
     142
     143
     144        #---------------
     145        #Variable values
     146        #---------------
     147        quantity = Quantity(domain,[[0,1,2],[3,1,7],[2,1,2],[3,3,7],
     148                                    [1,4,-9],[2,5,0]])
     149       
     150        x, y, vertex_values, triangles = quantity.get_vertex_values(xy=True, smooth=False)
     151        vertex_coordinates = concatenate( (x[:, NewAxis], y[:, NewAxis]), axis=1 )
     152        # FIXME: This concat should roll into get_vertex_values
     153
     154
     155        # Get interpolated values at centroids
     156        interpolation_points = domain.get_centroid_coordinates()
     157        answer = quantity.get_values(location='centroids')
     158
     159        I = Interpolate(vertex_coordinates, triangles)
     160        result = I.interpolate(vertex_values, interpolation_points)
     161        assert allclose(result, answer)       
     162       
    107163
    108164    def test_quad_tree(self):
     
    770826
    771827       
    772     def test_interpolate_reuse(self):
     828    def test_interpolate_reuse_if_None(self):
    773829        a = [-1.0, 0.0]
    774830        b = [3.0, 4.0]
     
    827883        except:
    828884            pass
     885       
     886    def xxtest_interpolate_reuse_if_same(self):
     887
     888        # This on tests that repeated identical interpolation
     889        # points makes use of precomputed matrix (Ole)
     890        # This is not really a test and is disabled for now
     891       
     892        a = [-1.0, 0.0]
     893        b = [3.0, 4.0]
     894        c = [4.0, 1.0]
     895        d = [-3.0, 2.0] #3
     896        e = [-1.0, -2.0]
     897        f = [1.0, -2.0] #5
     898
     899        vertices = [a, b, c, d,e,f]
     900        triangles = [[0,1,3], [1,0,2], [0,4,5], [0,5,2]] #abd bac aef afc
     901
     902
     903        point_coords = [[-2.0, 2.0],
     904                        [-1.0, 1.0],
     905                        [0.0, 2.0],
     906                        [1.0, 1.0],
     907                        [2.0, 1.0],
     908                        [0.0, 0.0],
     909                        [1.0, 0.0],
     910                        [0.0, -1.0],
     911                        [-0.2, -0.5],
     912                        [-0.9, -1.5],
     913                        [0.5, -1.9],
     914                        [3.0, 1.0]]
     915
     916        interp = Interpolate(vertices, triangles)
     917        f = array([linear_function(vertices),2*linear_function(vertices) ])
     918        f = transpose(f)
     919        z = interp.interpolate(f, point_coords)
     920        answer = [linear_function(point_coords),
     921                  2*linear_function(point_coords) ]
     922        answer = transpose(answer)
     923
     924        assert allclose(z, answer)
     925        assert allclose(interp._A_can_be_reused, True)
     926
     927
     928        z = interp.interpolate(f)    # None
     929        assert allclose(z, answer)       
     930        z = interp.interpolate(f, point_coords) # Repeated (not really a test)       
     931        assert allclose(z, answer)
    829932       
    830933
     
    14691572
    14701573    suite = unittest.makeSuite(Test_Interpolate,'test')
    1471     #suite = unittest.makeSuite(Test_Interpolate,'test_interpolate_sww2csv')
     1574    #suite = unittest.makeSuite(Test_Interpolate,'test_interpolation_function_outside_point')
    14721575    runner = unittest.TextTestRunner(verbosity=1)
    14731576    runner.run(suite)
  • anuga_core/source/anuga/pmesh/mesh_interface.py

    r3624 r3689  
    2828                             mesh_geo_reference=None,
    2929                             minimum_triangle_angle=28.0,
     30                             use_cache=False,
    3031                             verbose=True):
    3132    """Create mesh from bounding polygons, and resolutions.
  • anuga_core/source/anuga/shallow_water/shallow_water_domain.py

    r3681 r3689  
    7070#$LastChangedRevision$
    7171#$LastChangedBy$
     72
     73from Numeric import zeros, ones, Float, array, sum, size
     74from Numeric import compress, arange
    7275
    7376
     
    217220
    218221
     222
     223    def get_wet_elements(self, indices=None):
     224        """Return indices for elements where h > minimum_allowed_height
     225
     226        Optional argument:
     227            indices is the set of element ids that the operation applies to.
     228
     229        Usage:
     230            indices = get_wet_elements()
     231
     232        Note, centroid values are used for this operation           
     233        """
     234
     235        # Water depth below which it is considered to be 0 in the model
     236        # FIXME (Ole): Allow this to be specified as a keyword argument as well
     237        from anuga.config import minimum_allowed_height
     238       
     239
     240        elevation = self.get_quantity('elevation').get_values(location='centroids', indices=indices)
     241        stage = self.get_quantity('stage').get_values(location='centroids', indices=indices)               
     242        depth = stage - elevation
     243
     244        # Select indices for which depth > 0
     245        wet_indices = compress(depth > minimum_allowed_height, arange(len(depth)))
     246        return wet_indices
     247
     248
     249    def get_maximum_inundation_elevation(self, indices=None):
     250        """Return highest elevation where h > 0
     251
     252        Optional argument:
     253            indices is the set of element ids that the operation applies to.
     254
     255        Usage:
     256            q = get_maximum_inundation_elevation()
     257
     258        Note, centroid values are used for this operation           
     259        """
     260
     261        wet_elements = self.get_wet_elements(indices)
     262        return self.get_quantity('elevation').get_maximum_value(indices=wet_elements)
     263
     264
     265    def get_maximum_inundation_location(self, indices=None):
     266        """Return highest elevation where h > 0
     267
     268        Optional argument:
     269            indices is the set of element ids that the operation applies to.
     270
     271        Usage:
     272            q = get_maximum_inundation_elevation()
     273
     274        Note, centroid values are used for this operation           
     275        """
     276
     277        wet_elements = self.get_wet_elements(indices)
     278        return self.get_quantity('elevation').get_maximum_location(indices=wet_elements)   
     279
     280
     281
     282
    219283    def initialise_visualiser(self,scale_z=1.0,rect=None):
    220284        #Realtime visualisation
     
    400464    """
    401465
    402     from Numeric import zeros, Float
    403 
    404466    assert len(q) == 3,\
    405467           'Vector of conserved quantities must have length 3'\
     
    451513    from anuga.config import g, epsilon
    452514    from math import sqrt
    453     from Numeric import array
    454515
    455516    #Align momentums with x-axis
     
    539600
    540601    import sys
    541     from Numeric import zeros, Float
    542602
    543603    N = domain.number_of_elements
     
    614674    """
    615675    import sys
    616     from Numeric import zeros, Float
    617676
    618677    N = domain.number_of_elements
     
    643702
    644703    import sys
    645     from Numeric import zeros, Float
    646704
    647705    N = domain.number_of_elements
     
    794852    """
    795853
    796     from Numeric import zeros, Float
    797 
    798854    N = domain.number_of_elements
    799855    beta_h = domain.beta_h
     
    865921    Wrapper for c-extension
    866922    """
    867 
    868     from Numeric import zeros, Float
    869923
    870924    N = domain.number_of_elements
     
    10461100        self.normals = domain.normals
    10471101
    1048         from Numeric import zeros, Float
    10491102        self.conserved_quantities = zeros(3, Float)
    10501103
     
    12041257    """
    12051258
    1206     from Numeric import zeros, Float, array, sum
    1207 
    12081259    xmom = domain.quantities['xmomentum'].explicit_update
    12091260    ymom = domain.quantities['ymomentum'].explicit_update
     
    13801431    2: a scalar
    13811432    """
    1382 
    1383     from Numeric import ones, Float, array
    1384 
    13851433
    13861434    if callable(f):
  • anuga_core/source/anuga/shallow_water/shallow_water_ext.c

    r3678 r3689  
    342342    else
    343343      alpha = 1.0;  //Flat bed
    344 
     344     
     345     
     346    //alpha = 1.0;  //Always deep FIXME: This actually looks good now
    345347
    346348    //printf("dz = %.3f, alpha = %.8f\n", dz, alpha);
  • anuga_core/source/anuga/shallow_water/test_shallow_water_domain.py

    r3678 r3689  
    55
    66from anuga.config import g, epsilon
    7 from Numeric import allclose, array, zeros, ones, Float, take
     7from Numeric import allclose, alltrue, array, zeros, ones, Float, take
    88from anuga.utilities.numerical_tools import mean
    99
     
    668668
    669669
    670     def test_catching_negative_heights(self):
    671 
     670    def xtest_catching_negative_heights(self):
     671
     672        #OBSOLETE
     673       
    672674        a = [0.0, 0.0]
    673675        b = [0.0, 2.0]
     
    701703
    702704
     705
     706    def test_get_wet_elements(self):
     707
     708        a = [0.0, 0.0]
     709        b = [0.0, 2.0]
     710        c = [2.0,0.0]
     711        d = [0.0, 4.0]
     712        e = [2.0, 2.0]
     713        f = [4.0,0.0]
     714
     715        points = [a, b, c, d, e, f]
     716        #bac, bce, ecf, dbe
     717        vertices = [ [1,0,2], [1,2,4], [4,2,5], [3,1,4]]
     718
     719        domain = Domain(points, vertices)
     720        val0 = 2.+2.0/3
     721        val1 = 4.+4.0/3
     722        val2 = 8.+2.0/3
     723        val3 = 2.+8.0/3
     724
     725        zl=zr=5
     726        domain.set_quantity('elevation', zl*ones( (4,3) ))
     727        domain.set_quantity('stage', [[val0, val0-1, val0-2],
     728                                      [val1, val1+1, val1],
     729                                      [val2, val2-2, val2],
     730                                      [val3-0.5, val3, val3]])
     731
     732
     733
     734        #print domain.get_quantity('elevation').get_values(location='centroids')
     735        #print domain.get_quantity('stage').get_values(location='centroids')       
     736        domain.check_integrity()
     737
     738        indices = domain.get_wet_elements()
     739        assert allclose(indices, [1,2])
     740
     741        indices = domain.get_wet_elements(indices=[0,1,3])
     742        assert allclose(indices, [1])
     743       
     744
     745
     746    def test_get_maximum_inundation_1(self):
     747
     748        a = [0.0, 0.0]
     749        b = [0.0, 2.0]
     750        c = [2.0,0.0]
     751        d = [0.0, 4.0]
     752        e = [2.0, 2.0]
     753        f = [4.0,0.0]
     754
     755        points = [a, b, c, d, e, f]
     756        #bac, bce, ecf, dbe
     757        vertices = [ [1,0,2], [1,2,4], [4,2,5], [3,1,4]]
     758
     759        domain = Domain(points, vertices)
     760
     761        domain.set_quantity('elevation', lambda x, y: x+2*y) #2 4 4 6
     762        domain.set_quantity('stage', 3)
     763
     764        domain.check_integrity()
     765
     766        indices = domain.get_wet_elements()
     767        assert allclose(indices, [0])
     768
     769        q = domain.get_maximum_inundation_elevation()
     770        assert allclose(q, domain.get_quantity('elevation').get_values(location='centroids')[0])
     771
     772        x, y = domain.get_maximum_inundation_location()
     773        assert allclose([x, y], domain.get_centroid_coordinates()[0])
     774
     775
     776    def test_get_maximum_inundation_2(self):
     777        """test_get_maximum_inundation_2(self)
     778
     779        Test multiple wet cells with same elevation
     780        """
     781       
     782        a = [0.0, 0.0]
     783        b = [0.0, 2.0]
     784        c = [2.0,0.0]
     785        d = [0.0, 4.0]
     786        e = [2.0, 2.0]
     787        f = [4.0,0.0]
     788
     789        points = [a, b, c, d, e, f]
     790        #bac, bce, ecf, dbe
     791        vertices = [ [1,0,2], [1,2,4], [4,2,5], [3,1,4]]
     792
     793        domain = Domain(points, vertices)
     794
     795        domain.set_quantity('elevation', lambda x, y: x+2*y) #2 4 4 6
     796        domain.set_quantity('stage', 4.1)
     797
     798        domain.check_integrity()
     799
     800        indices = domain.get_wet_elements()
     801        assert allclose(indices, [0,1,2])
     802
     803        q = domain.get_maximum_inundation_elevation()
     804        assert allclose(q, 4)       
     805
     806        x, y = domain.get_maximum_inundation_location()
     807        assert allclose([x, y], domain.get_centroid_coordinates()[1])       
     808       
     809
     810    def test_get_maximum_inundation_3(self):
     811        """test_get_maximum_inundation_3(self)
     812
     813        Test real runup example
     814        """
     815
     816        from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
     817
     818        initial_runup_height = -0.4
     819        final_runup_height = -0.3
     820
     821
     822        #--------------------------------------------------------------
     823        # Setup computational domain
     824        #--------------------------------------------------------------
     825        N = 5
     826        points, vertices, boundary = rectangular_cross(N, N)
     827        domain = Domain(points, vertices, boundary)           
     828
     829        #--------------------------------------------------------------
     830        # Setup initial conditions
     831        #--------------------------------------------------------------
     832        def topography(x,y):
     833            return -x/2                             # linear bed slope
     834           
     835
     836        domain.set_quantity('elevation', topography)       # Use function for elevation
     837        domain.set_quantity('friction', 0.)                # Zero friction
     838        domain.set_quantity('stage', initial_runup_height) # Constant negative initial stage
     839
     840
     841        #--------------------------------------------------------------
     842        # Setup boundary conditions
     843        #--------------------------------------------------------------
     844        Br = Reflective_boundary(domain)              # Reflective wall
     845        Bd = Dirichlet_boundary([final_runup_height,  # Constant inflow
     846                                 0,
     847                                 0])
     848
     849        # All reflective to begin with (still water)
     850        domain.set_boundary({'left': Br, 'right': Br, 'top': Br, 'bottom': Br})
     851
     852
     853        #--------------------------------------------------------------
     854        # Test initial inundation height
     855        #--------------------------------------------------------------
     856
     857        indices = domain.get_wet_elements()
     858        z = domain.get_quantity('elevation').\
     859            get_values(location='centroids', indices=indices)
     860        assert alltrue(z<initial_runup_height)
     861
     862        q = domain.get_maximum_inundation_elevation()
     863        assert allclose(q, initial_runup_height, rtol = 1.0/N) # First order accuracy
     864
     865        x, y = domain.get_maximum_inundation_location()
     866
     867        qref = domain.get_quantity('elevation').get_values(interpolation_points = [[x, y]])
     868        assert allclose(q, qref)
     869
     870
     871        wet_elements = domain.get_wet_elements()
     872        wet_elevations = domain.get_quantity('elevation').get_values(location='centroids',
     873                                                                     indices=wet_elements)
     874        assert alltrue(wet_elevations<initial_runup_height)
     875        assert allclose(wet_elevations, z)       
     876
     877
     878        #print domain.get_quantity('elevation').get_maximum_value(indices=wet_elements)
     879        #print domain.get_quantity('elevation').get_maximum_location(indices=wet_elements)
     880        #print domain.get_quantity('elevation').get_maximum_index(indices=wet_elements)
     881
     882       
     883        #--------------------------------------------------------------
     884        # Let triangles adjust
     885        #--------------------------------------------------------------
     886        for t in domain.evolve(yieldstep = 0.1, finaltime = 1.0):
     887            pass
     888
     889
     890        #--------------------------------------------------------------
     891        # Test inundation height again
     892        #--------------------------------------------------------------
     893
     894        indices = domain.get_wet_elements()
     895        z = domain.get_quantity('elevation').\
     896            get_values(location='centroids', indices=indices)
     897
     898        assert alltrue(z<initial_runup_height)
     899
     900        q = domain.get_maximum_inundation_elevation()
     901        assert allclose(q, initial_runup_height, rtol = 1.0/N) # First order accuracy
     902       
     903        x, y = domain.get_maximum_inundation_location()
     904        qref = domain.get_quantity('elevation').get_values(interpolation_points = [[x, y]])
     905        assert allclose(q, qref)       
     906
     907
     908        #--------------------------------------------------------------
     909        # Update boundary to allow inflow
     910        #--------------------------------------------------------------
     911        domain.modify_boundary({'right': Bd})
     912
     913       
     914        #--------------------------------------------------------------
     915        # Evolve system through time
     916        #--------------------------------------------------------------
     917        for t in domain.evolve(yieldstep = 0.1, finaltime = 3.0):
     918            #domain.write_time()
     919            pass
     920   
     921        #--------------------------------------------------------------
     922        # Test inundation height again
     923        #--------------------------------------------------------------
     924
     925        indices = domain.get_wet_elements()
     926        z = domain.get_quantity('elevation').\
     927            get_values(location='centroids', indices=indices)
     928
     929        assert alltrue(z<final_runup_height)
     930
     931        q = domain.get_maximum_inundation_elevation()
     932        assert allclose(q, final_runup_height, rtol = 1.0/N) # First order accuracy
     933
     934        x, y = domain.get_maximum_inundation_location()
     935        qref = domain.get_quantity('elevation').get_values(interpolation_points = [[x, y]])
     936        assert allclose(q, qref)       
     937
     938
     939        wet_elements = domain.get_wet_elements()
     940        wet_elevations = domain.get_quantity('elevation').get_values(location='centroids',
     941                                                                     indices=wet_elements)
     942        assert alltrue(wet_elevations<final_runup_height)
     943        assert allclose(wet_elevations, z)       
     944       
    703945
    704946
     
    27572999
    27583000        #Initial condition
    2759         domain.set_quantity('stage', Constant_height(x_slope, 0.05))
     3001        domain.set_quantity('stage', expression = 'elevation + 0.05')
    27603002        domain.check_integrity()
    27613003
     
    33543596         self.failUnless(domain.geo_reference.xllcorner  == 140.0,
    33553597                          "bad geo_referece")
    3356     #************
     3598
     3599
     3600         #************
    33573601
    33583602   
     
    33983642         self.failUnless(domain.geo_reference.xllcorner  == 140.0,
    33993643                          "bad geo_referece")
    3400     #************
     3644         #************
    34013645         os.remove(fileName)
    34023646
    34033647        #-------------------------------------------------------------
     3648       
    34043649if __name__ == "__main__":
    34053650    suite = unittest.makeSuite(Test_Shallow_Water,'test')
     3651    #suite = unittest.makeSuite(Test_Shallow_Water,'test_get_maximum_inundation_3')
    34063652    runner = unittest.TextTestRunner(verbosity=1)   
    34073653    runner.run(suite)
Note: See TracChangeset for help on using the changeset viewer.