Changeset 767


Ignore:
Timestamp:
Jan 21, 2005, 12:07:59 PM (20 years ago)
Author:
ole
Message:

Clean up and comments

Location:
inundation/ga/storm_surge/pyvolution
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/pyvolution/shallow_water.py

    r750 r767  
    66consisting of methods specific to the Shallow Water Wave Equation
    77
    8 FIXME: Write equations here!
    9 
    10 
    11 Conserved quantities are w (water level or stage), uh (x momentum)
    12 and vh (y momentum).
     8
     9U_t + E_x + G_y = S
     10
     11where
     12
     13U = [w, uh, vh]
     14E = [uh, u^2h + gh^2/2, uvh]
     15G = [vh, uvh, v^2h + gh^2/2]
     16S represents source terms forcing the system
     17(e.g. gravity, friction, wind stress, ...)
     18
     19
     20The quantities are
     21
     22symbol    variable name    explanation
     23z         elevation        elevation of bed on which flow is modelled
     24h         height           water height above z
     25w         stage            water level, w = z+h
     26u                          speed in the x direction
     27v                          speed in the y direction
     28uh        xmomentum        momentum in the x direction
     29vh        ymomentum        momentum in the y direction
     30
     31eta                        mannings friction coefficient
     32nu                         wind stress coefficient
     33
     34The conserved quantities are w, uh, vh
     35
     36
     37For details see e.g.
     38Christopher Zoppou and Stephen Roberts,
     39Catastrophic Collapse of Water Supply Reservoirs in Urban Areas,
     40Journal of Hydraulic Engineering, vol. 127, No. 7 July 1999
     41
    1342
    1443
     
    81110        level = self.quantities['level']
    82111        bed = self.quantities['elevation']       
    83 
    84         #msg = 'All water levels must be greater than the bed elevation'
    85         #assert alltrue( greater_equal(
    86         #    level.vertex_values, bed.vertex_values )), msg
    87         #
    88         #assert alltrue( greater_equal(
    89         #    level.edge_values, bed.edge_values )), msg
    90         #
    91         #assert alltrue( greater_equal(
    92         #    level.centroid_values, bed.centroid_values )), msg       
    93112
    94113
     
    220239    """
    221240
    222     #FIXME: Needs to be tested
    223 
    224241    from Numeric import zeros, Float
    225242   
     
    233250        raise 'Normal vector must be an Numeric array'
    234251
    235     #FIXME: Put this test into C-extension as well
    236252    assert l == 2, 'Normal vector must have 2 components'
    237 
     253   
    238254 
    239255    n1 = normal[0]
     
    423439        Ymom.explicit_update[k] = flux[2]
    424440
    425     #print 'FLUX l', Level.explicit_update
    426     #print 'FLUX x', Xmom.explicit_update
    427     #print 'FLUX y', Ymom.explicit_update   
    428441   
    429442    domain.timestep = timestep   
     
    563576            xmomc[k] = ymomc[k] = 0.0
    564577       
    565         #FIXME: Delete   
    566         #From 'newstyle
    567         #if hc[k] < domain.minimum_allowed_height:       
    568         #     if hc[k] < 0.0:
    569         #            #Control level and height
    570         #            wc[k] = zc[k]
    571         #
    572         #        #Control momentum
    573         #        xmomc[k] = ymomc[k] = 0.0
    574         #else:
    575            
    576578
    577579
  • inundation/ga/storm_surge/pyvolution/shallow_water_ext.c

    r761 r767  
    431431  normal = (PyArrayObject *)
    432432    PyArray_ContiguousFromObject(Normal, PyArray_DOUBLE, 0, 0);
    433  
     433
     434 
     435  if (normal -> dimensions[0] != 2) {
     436    PyErr_SetString(PyExc_RuntimeError, "Normal vector must have 2 components");
     437    return NULL;
     438  }
     439
    434440  //Allocate space for return vector r (don't DECREF)
    435441  dimensions[0] = 3;
  • inundation/ga/storm_surge/pyvolution/test_shallow_water.py

    r765 r767  
    9494        assert allclose(w, q)
    9595
    96 
     96        #Check error check
     97        try:
     98            rotate(r, array([1,1,1]) )
     99        except:
     100            pass
     101        else:
     102            raise 'Should have raised an exception'
    97103
    98104    def test_flux_zero_case(self):
Note: See TracChangeset for help on using the changeset viewer.