Changeset 773


Ignore:
Timestamp:
Jan 21, 2005, 2:40:39 PM (19 years ago)
Author:
ole
Message:

Changed quantity name 'level' to 'stage'

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

Legend:

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

    r271 r773  
    1010  u_t + (v_1 u)_x + (v_2 u)_y = 0
    1111
    12 There is only one conserved quantity, the level u
     12There is only one conserved quantity, the stage u
    1313
    1414The advection equation is a very simple specialisation of the generic
     
    2929       
    3030        Generic_domain.__init__(self, coordinates, vertices, boundary,
    31                                 ['level'])
     31                                ['stage'])
    3232
    3333        if velocity is None:
     
    4747        Generic_domain.check_integrity(self)
    4848
    49         msg = 'Conserved quantity must be "level"'
    50         assert self.conserved_quantities[0] == 'level', msg
     49        msg = 'Conserved quantity must be "stage"'
     50        assert self.conserved_quantities[0] == 'stage', msg
    5151       
    5252
     
    113113
    114114        #Shortcuts
    115         Level = self.quantities['level']
     115        Stage = self.quantities['stage']
    116116
    117117        #Arrays
    118         level = Level.edge_values
     118        stage = Stage.edge_values
    119119
    120         level_bdry = Level.boundary_values
     120        stage_bdry = Stage.boundary_values
    121121   
    122122        flux = zeros(1, Float) #Work array for summing up fluxes
     
    129129            for i in range(3):
    130130                #Quantities inside volume facing neighbour i
    131                 ql = level[k, i]
     131                ql = stage[k, i]
    132132
    133133                #Quantities at neighbour on nearest face
     
    135135                if n < 0:
    136136                    m = -n-1 #Convert neg flag to index
    137                     qr = level_bdry[m]
     137                    qr = stage_bdry[m]
    138138                else:   
    139139                    m = neighbour_edges[k,i]
    140                     qr = level[n, m]
     140                    qr = stage[n, m]
    141141
    142142                   
     
    157157            #quantities get updated
    158158            flux /= areas[k]
    159             Level.explicit_update[k] = flux[0]
     159            Stage.explicit_update[k] = flux[0]
    160160           
    161161            timestep = min(timestep, optimal_timestep)
  • inundation/ga/storm_surge/pyvolution/bed_w_eden_boundary.py

    r624 r773  
    5555######################
    5656#Initial condition (constant)
    57 domain.set_quantity('level', 0.0)
     57domain.set_quantity('stage', 0.0)
    5858domain.check_integrity()
    5959
  • inundation/ga/storm_surge/pyvolution/bed_w_file_boundary.py

    r624 r773  
    7272h = 0.5
    7373h = 0.0
    74 domain.set_quantity('level', Constant_height(x_slope, h))
     74domain.set_quantity('stage', Constant_height(x_slope, h))
    7575
    7676domain.check_integrity()
  • inundation/ga/storm_surge/pyvolution/cornell_room.py

    r489 r773  
    116116    return z
    117117
    118 domain.set_quantity('level', height)
     118domain.set_quantity('stage', height)
    119119
    120120E = domain.quantities['elevation'].vertex_values
    121 L = domain.quantities['level'].vertex_values
    122 domain.set_quantity('level', E+L)
     121L = domain.quantities['stage'].vertex_values
     122domain.set_quantity('stage', E+L)
    123123
    124124#Evolve
  • inundation/ga/storm_surge/pyvolution/data_manager.py

    r620 r773  
    321321
    322322            #FIXME: Make this more general and rethink naming
    323             if name == 'level':
     323            if name == 'stage':
    324324                stage[i,:] = A.astype(self.precision)
    325325            elif name == 'xmomentum':
  • inundation/ga/storm_surge/pyvolution/flatbed.py

    r664 r773  
    3333manning = 0.07
    3434manning = 0.0
    35 inflow_level = 10.0
     35inflow_stage = 10.0
    3636domain.set_quantity('friction', manning)
    3737
     
    5353domain.set_quantity('elevation',
    5454        Polygon_function([(p0,slope), (p1,wiggle), (p2,15)]))
    55 #domain.set_quantity('level',
     55#domain.set_quantity('stage',
    5656#       Polygon_function([(p0,slope), (p1,wiggle), (p2,15)]))   
    5757
     
    6464# Boundary conditions
    6565Br = Reflective_boundary(domain)
    66 Bd = Dirichlet_boundary([inflow_level,0.,0.])
     66Bd = Dirichlet_boundary([inflow_stage,0.,0.])
    6767
    6868domain.set_boundary({'left': Bd, 'right': Br, 'top': Br, 'bottom': Br})
  • inundation/ga/storm_surge/pyvolution/flatbed_compare.py

    r483 r773  
    4747    domain.write_time()
    4848
    49 print domain.quantities['level'].centroid_values[:4]
     49print domain.quantities['stage'].centroid_values[:4]
    5050print domain.quantities['xmomentum'].centroid_values[:4]
    5151print domain.quantities['ymomentum'].centroid_values[:4]
    5252domain.distribute_to_vertices_and_edges()
    5353print
    54 print domain.quantities['level'].vertex_values[:4,0]
     54print domain.quantities['stage'].vertex_values[:4,0]
    5555print domain.quantities['xmomentum'].vertex_values[:4,0]
    5656print domain.quantities['ymomentum'].vertex_values[:4,0] 
  • inundation/ga/storm_surge/pyvolution/netherlands.py

    r649 r773  
    160160#
    161161print 'Initial condition'
    162 domain.set_quantity('level', Constant_height(Z, 0.))
     162domain.set_quantity('stage', Constant_height(Z, 0.))
    163163
    164164#Evolve
  • inundation/ga/storm_surge/pyvolution/pmesh2domain.py

    r686 r773  
    3333    #(when I get around to it) so it should be removed from here. 
    3434   
    35     # set the water level to be the elevation
     35    # set the water stage to be the elevation
    3636    # This doesn't work on the domain instance.
    37     if vertex_quantity_dict.has_key('elevation') and not vertex_quantity_dict.has_key('level'):
    38         vertex_quantity_dict['level'] = vertex_quantity_dict['elevation']
     37    if vertex_quantity_dict.has_key('elevation') and not vertex_quantity_dict.has_key('stage'):
     38        vertex_quantity_dict['stage'] = vertex_quantity_dict['elevation']
    3939    domain.set_quantity_vertices_dict(vertex_quantity_dict)
    4040    #print "vertex_quantity_dict",vertex_quantity_dict
  • inundation/ga/storm_surge/pyvolution/pressure_force.py

    r566 r773  
    5454    ymom = domain.quantities['ymomentum'].explicit_update
    5555
    56     Level = domain.quantities['level']
     56    Stage = domain.quantities['stage']
    5757    Elevation = domain.quantities['elevation']   
    58     h = Level.vertex_values - Elevation.vertex_values
     58    h = Stage.vertex_values - Elevation.vertex_values
    5959    x = domain.get_vertex_coordinates()
    6060
     
    8888#Initial condition
    8989h = 0.05
    90 domain.set_quantity('level', Constant_height(x_slope, h))
     90domain.set_quantity('stage', Constant_height(x_slope, h))
    9191
    9292
  • inundation/ga/storm_surge/pyvolution/quantity.py

    r715 r773  
    377377           
    378378
    379     # FIXME have a get_vertex_values as well, so the 'level' quantity can be
     379    # FIXME have a get_vertex_values as well, so the 'stage' quantity can be
    380380    # set, based on the elevation
    381381    def set_vertex_values(self, A, indexes = None):
  • inundation/ga/storm_surge/pyvolution/realtime_visualisation.py

    r324 r773  
    114114    s=0
    115115
    116     Q = domain.quantities['level']
     116    Q = domain.quantities['stage']
    117117    try:
    118118        Z = domain.quantities['elevation']
     
    196196
    197197
    198     Q = domain.quantities['level']
     198    Q = domain.quantities['stage']
    199199    N = Q.vertex_values.shape[0]
    200200   
  • inundation/ga/storm_surge/pyvolution/run_profile.py

    r515 r773  
    4848######################
    4949#Initial condition
    50 domain.set_quantity('level', Constant_height(slope, 0.3))
     50domain.set_quantity('stage', Constant_height(slope, 0.3))
    5151
    5252domain.check_integrity()
  • inundation/ga/storm_surge/pyvolution/run_tsh_weir.py

    r390 r773  
    8282
    8383#print domain.quantities['elevation'].vertex_values
    84 #print domain.quantities['level'].vertex_values
     84#print domain.quantities['stage'].vertex_values
    8585         
    8686######################
    8787#Initial condition
    8888print 'Initial condition'
    89 domain.set_quantity('level', Constant_height(W, 0.))
     89domain.set_quantity('stage', Constant_height(W, 0.))
    9090domain.check_integrity()
    9191
  • inundation/ga/storm_surge/pyvolution/shallow_water.py

    r772 r773  
    6767                 tagged_elements = None):
    6868
    69         conserved_quantities = ['level', 'xmomentum', 'ymomentum']
     69        conserved_quantities = ['stage', 'xmomentum', 'ymomentum']
    7070        other_quantities = ['elevation', 'friction']
    7171       
     
    9494        self.reduction = min  #Looks better near steep slopes
    9595       
    96         self.quantities_to_be_stored = ['level']
     96        self.quantities_to_be_stored = ['stage']
    9797
    9898       
    9999        #Establish shortcuts to relevant quantities (for efficiency)
    100         #self.w = self.quantities['level']
     100        #self.w = self.quantities['stage']
    101101        #self.uh = self.quantities['xmomentum']                 
    102102        #self.vh = self.quantities['ymomentum']                         
     
    109109        #Check that we are solving the shallow water wave equation
    110110
    111         msg = 'First conserved quantity must be "level"'
    112         assert self.conserved_quantities[0] == 'level', msg
     111        msg = 'First conserved quantity must be "stage"'
     112        assert self.conserved_quantities[0] == 'stage', msg
    113113        msg = 'Second conserved quantity must be "xmomentum"'
    114114        assert self.conserved_quantities[1] == 'xmomentum', msg
     
    117117       
    118118
    119         #Check that levels are >= bed elevation
     119        #Check that stages are >= bed elevation
    120120        from Numeric import alltrue, greater_equal
    121121       
    122         level = self.quantities['level']
     122        stage = self.quantities['stage']
    123123        bed = self.quantities['elevation']       
    124124
     
    140140#         This is specific to the shallow water wave equation
    141141#         Defaults for 'elevation', 'friction', 'xmomentum' and 'ymomentum'
    142 #         are 0.0. Default for 'level' is whatever the value of 'elevation'.
     142#         are 0.0. Default for 'stage' is whatever the value of 'elevation'.
    143143#         """
    144144
     
    147147#             print self.quantities.keys()
    148148#             if not self.quantities.has_key(name):
    149 #                 if name == 'level':
     149#                 if name == 'stage':
    150150                   
    151151#                     if self.quantities.has_key('elevation'):
     
    161161#         #Lift negative heights up
    162162#         #z = self.quantities['elevation'].vertex_values
    163 #         #w = self.quantities['level'].vertex_values
     163#         #w = self.quantities['stage'].vertex_values
    164164
    165165#         #h = w-z
     
    171171
    172172                   
    173 #         #self.quantities['level'].interpolate()
     173#         #self.quantities['stage'].interpolate()
    174174               
    175175
     
    206206            #Store model data, e.g. for subsequent visualisation   
    207207            if self.store is True:
    208                 #self.store_timestep(['level', 'xmomentum', 'ymomentum'])
     208                #self.store_timestep(['stage', 'xmomentum', 'ymomentum'])
    209209                self.store_timestep(self.quantities_to_be_stored)
    210210               
     
    375375    Resulting flux is then scaled by area and stored in
    376376    explicit_update for each of the three conserved quantities
    377     level, xmomentum and ymomentum   
     377    stage, xmomentum and ymomentum   
    378378
    379379    The maximal allowable speed computed by the flux_function for each volume
     
    392392   
    393393    #Shortcuts
    394     Level = domain.quantities['level']
     394    Stage = domain.quantities['stage']
    395395    Xmom = domain.quantities['xmomentum']
    396396    Ymom = domain.quantities['ymomentum']
     
    398398
    399399    #Arrays
    400     level = Level.edge_values
     400    stage = Stage.edge_values
    401401    xmom =  Xmom.edge_values
    402402    ymom =  Ymom.edge_values
    403403    bed =   Bed.edge_values   
    404404
    405     level_bdry = Level.boundary_values
     405    stage_bdry = Stage.boundary_values
    406406    xmom_bdry =  Xmom.boundary_values
    407407    ymom_bdry =  Ymom.boundary_values
     
    416416        for i in range(3):
    417417            #Quantities inside volume facing neighbour i
    418             ql = [level[k, i], xmom[k, i], ymom[k, i]]
     418            ql = [stage[k, i], xmom[k, i], ymom[k, i]]
    419419            zl = bed[k, i]
    420420
     
    423423            if n < 0:
    424424                m = -n-1 #Convert negative flag to index
    425                 qr = [level_bdry[m], xmom_bdry[m], ymom_bdry[m]]
     425                qr = [stage_bdry[m], xmom_bdry[m], ymom_bdry[m]]
    426426                zr = zl #Extend bed elevation to boundary
    427427            else:   
    428428                m = domain.neighbour_edges[k,i]
    429                 qr = [level[n, m], xmom[n, m], ymom[n, m]]
     429                qr = [stage[n, m], xmom[n, m], ymom[n, m]]
    430430                zr = bed[n, m]               
    431431
     
    447447        #quantities get updated
    448448        flux /= domain.areas[k]
    449         Level.explicit_update[k] = flux[0]
     449        Stage.explicit_update[k] = flux[0]
    450450        Xmom.explicit_update[k] = flux[1]
    451451        Ymom.explicit_update[k] = flux[2]
     
    465465   
    466466    #Shortcuts
    467     Level = domain.quantities['level']
     467    Stage = domain.quantities['stage']
    468468    Xmom = domain.quantities['xmomentum']
    469469    Ymom = domain.quantities['ymomentum']
     
    479479                                     domain.radii,
    480480                                     domain.areas,
    481                                      Level.edge_values,
     481                                     Stage.edge_values,
    482482                                     Xmom.edge_values,
    483483                                     Ymom.edge_values, 
    484484                                     Bed.edge_values,   
    485                                      Level.boundary_values,
     485                                     Stage.boundary_values,
    486486                                     Xmom.boundary_values,
    487487                                     Ymom.boundary_values,
    488                                      Level.explicit_update,
     488                                     Stage.explicit_update,
    489489                                     Xmom.explicit_update,
    490490                                     Ymom.explicit_update)
     
    549549   
    550550    #Shortcuts
    551     wv = domain.quantities['level'].vertex_values
     551    wv = domain.quantities['stage'].vertex_values
    552552    zv = domain.quantities['elevation'].vertex_values
    553553    xmomv = domain.quantities['xmomentum'].vertex_values
     
    560560       
    561561        if hmax < domain.minimum_allowed_height:
    562             #Control level
     562            #Control stage
    563563            wv[k, :] = zv[k, :]
    564564
     
    572572   
    573573    #Shortcuts
    574     wc = domain.quantities['level'].centroid_values
     574    wc = domain.quantities['stage'].centroid_values
    575575    zc = domain.quantities['elevation'].centroid_values
    576576    xmomc = domain.quantities['xmomentum'].centroid_values
     
    582582
    583583        if hc[k] < domain.minimum_allowed_height:
    584             #Control level
     584            #Control stage
    585585            wc[k] = zc[k]
    586586
     
    595595   
    596596    #Shortcuts
    597     wc = domain.quantities['level'].centroid_values
     597    wc = domain.quantities['stage'].centroid_values
    598598    zc = domain.quantities['elevation'].centroid_values
    599599    xmomc = domain.quantities['xmomentum'].centroid_values
     
    617617   
    618618    #Shortcuts
    619     wc = domain.quantities['level'].centroid_values
     619    wc = domain.quantities['stage'].centroid_values
    620620    zc = domain.quantities['elevation'].centroid_values
    621621    hc = wc - zc
    622622   
    623     wv = domain.quantities['level'].vertex_values
     623    wv = domain.quantities['stage'].vertex_values
    624624    zv = domain.quantities['elevation'].vertex_values
    625625    hv = wv-zv
    626626
    627627
    628     #Computed linear combination between constant levels and and
    629     #levels parallel to the bed elevation.     
     628    #Computed linear combination between constant stages and and
     629    #stages parallel to the bed elevation.     
    630630    for k in range(domain.number_of_elements):
    631631        #Compute maximal variation in bed elevation
     
    695695   
    696696    #Shortcuts
    697     wc = domain.quantities['level'].centroid_values
     697    wc = domain.quantities['stage'].centroid_values
    698698    zc = domain.quantities['elevation'].centroid_values
    699699    hc = wc - zc
    700700   
    701     wv = domain.quantities['level'].vertex_values
     701    wv = domain.quantities['stage'].vertex_values
    702702    zv = domain.quantities['elevation'].vertex_values
    703703    hv = wv-zv
     
    739739       
    740740        #Handy shorthands
    741         self.level = domain.quantities['level'].edge_values
     741        self.stage = domain.quantities['stage'].edge_values
    742742        self.xmom = domain.quantities['xmomentum'].edge_values
    743743        self.ymom = domain.quantities['ymomentum'].edge_values         
     
    757757
    758758        q = self.conserved_quantities
    759         q[0] = self.level[vol_id, edge_id]
     759        q[0] = self.stage[vol_id, edge_id]
    760760        q[1] = self.xmom[vol_id, edge_id]
    761761        q[2] = self.ymom[vol_id, edge_id]
     
    784784    ymom = domain.quantities['ymomentum'].explicit_update
    785785
    786     Level = domain.quantities['level']
     786    Stage = domain.quantities['stage']
    787787    Elevation = domain.quantities['elevation']   
    788     h = Level.edge_values - Elevation.edge_values
     788    h = Stage.edge_values - Elevation.edge_values
    789789    v = Elevation.vertex_values
    790790   
     
    813813    ymom = domain.quantities['ymomentum'].explicit_update
    814814
    815     Level = domain.quantities['level']   
     815    Stage = domain.quantities['stage']   
    816816    Elevation = domain.quantities['elevation']   
    817     h = Level.edge_values - Elevation.edge_values
     817    h = Stage.edge_values - Elevation.edge_values
    818818    v = Elevation.vertex_values
    819819   
     
    832832    from math import sqrt
    833833
    834     w = domain.quantities['level'].centroid_values
     834    w = domain.quantities['stage'].centroid_values
    835835    z = domain.quantities['elevation'].centroid_values
    836836    h = w-z
     
    866866    ymom = domain.quantities['ymomentum']   
    867867       
    868     w = domain.quantities['level'].centroid_values
     868    w = domain.quantities['stage'].centroid_values
    869869    z = domain.quantities['elevation'].centroid_values
    870870   
     
    892892    from math import sqrt
    893893
    894     w = domain.quantities['level'].centroid_values
     894    w = domain.quantities['stage'].centroid_values
    895895    z = domain.quantities['elevation'].centroid_values
    896896    h = w-z
  • inundation/ga/storm_surge/pyvolution/shallow_water_ext.c

    r767 r773  
    198198  double dz, hmin, alpha;
    199199 
    200   //Compute linear combination between constant levels and and
    201   //levels parallel to the bed elevation.     
     200  //Compute linear combination between constant stages and and
     201  //stages parallel to the bed elevation.     
    202202 
    203203  for (k=0; k<N; k++) {
     
    473473    Resulting flux is then scaled by area and stored in
    474474    explicit_update for each of the three conserved quantities
    475     level, xmomentum and ymomentum
     475    stage, xmomentum and ymomentum
    476476
    477477    The maximal allowable speed computed by the flux_function for each volume
     
    489489                                     domain.radii,
    490490                                     domain.areas,
    491                                      Level.edge_values,
     491                                     Stage.edge_values,
    492492                                     Xmom.edge_values,
    493493                                     Ymom.edge_values, 
    494494                                     Bed.edge_values,   
    495                                      Level.boundary_values,
     495                                     Stage.boundary_values,
    496496                                     Xmom.boundary_values,
    497497                                     Ymom.boundary_values,
    498                                      Level.explicit_update,
     498                                     Stage.explicit_update,
    499499                                     Xmom.explicit_update,
    500500                                     Ymom.explicit_update)
     
    511511  PyArrayObject *neighbours, *neighbour_edges,
    512512    *normals, *edgelengths, *radii, *areas,
    513     *level_edge_values,
     513    *stage_edge_values,
    514514    *xmom_edge_values,
    515515    *ymom_edge_values, 
    516516    *bed_edge_values,   
    517     *level_boundary_values,
     517    *stage_boundary_values,
    518518    *xmom_boundary_values,
    519519    *ymom_boundary_values,
    520     *level_explicit_update,
     520    *stage_explicit_update,
    521521    *xmom_explicit_update,
    522522    *ymom_explicit_update;
     
    541541                        &normals,
    542542                        &edgelengths, &radii, &areas,
    543                         &level_edge_values,
     543                        &stage_edge_values,
    544544                        &xmom_edge_values,
    545545                        &ymom_edge_values, 
    546546                        &bed_edge_values,   
    547                         &level_boundary_values,
     547                        &stage_boundary_values,
    548548                        &xmom_boundary_values,
    549549                        &ymom_boundary_values,
    550                         &level_explicit_update,
     550                        &stage_explicit_update,
    551551                        &xmom_explicit_update,
    552552                        &ymom_explicit_update)) {
     
    555555  }
    556556
    557   number_of_elements = level_edge_values -> dimensions[0];
     557  number_of_elements = stage_edge_values -> dimensions[0];
    558558 
    559559   
     
    566566    for (i=0; i<3; i++) {
    567567      ki = k*3+i;
    568       ql[0] = ((double *) level_edge_values -> data)[ki];
     568      ql[0] = ((double *) stage_edge_values -> data)[ki];
    569569      ql[1] = ((double *) xmom_edge_values -> data)[ki];
    570570      ql[2] = ((double *) ymom_edge_values -> data)[ki];           
     
    575575      if (n < 0) {
    576576        m = -n-1; //Convert negative flag to index
    577         qr[0] = ((double *) level_boundary_values -> data)[m]; 
     577        qr[0] = ((double *) stage_boundary_values -> data)[m]; 
    578578        qr[1] = ((double *) xmom_boundary_values -> data)[m];   
    579579        qr[2] = ((double *) ymom_boundary_values -> data)[m];   
     
    583583       
    584584        nm = n*3+m;     
    585         qr[0] = ((double *) level_edge_values -> data)[nm];
     585        qr[0] = ((double *) stage_edge_values -> data)[nm];
    586586        qr[1] = ((double *) xmom_edge_values -> data)[nm];
    587587        qr[2] = ((double *) ymom_edge_values -> data)[nm];           
     
    625625    }
    626626
    627     ((double *) level_explicit_update -> data)[k] = flux[0];
     627    ((double *) stage_explicit_update -> data)[k] = flux[0];
    628628    ((double *) xmom_explicit_update -> data)[k] = flux[1];
    629629    ((double *) ymom_explicit_update -> data)[k] = flux[2];       
     
    642642
    643643  PyArrayObject
    644   *wc,            //Level at centroids
     644  *wc,            //Stage at centroids
    645645  *zc,            //Elevation at centroids   
    646646  *xmomc,         //Momentums at centroids
     
    678678
    679679  PyArrayObject
    680     *wc,            //Level at centroids
     680    *wc,            //Stage at centroids
    681681    *zc,            //Elevation at centroids   
    682682    *hc,            //Height at centroids       
    683     *wv,            //Level at vertices
     683    *wv,            //Stage at vertices
    684684    *zv,            //Elevation at vertices
    685685    *hv,            //Heights at vertices   
  • inundation/ga/storm_surge/pyvolution/show_balanced_limiters.py

    r305 r773  
    7777#
    7878print 'Initial condition'
    79 domain.set_quantity('level', Constant_height(Z, 0.))
     79domain.set_quantity('stage', Constant_height(Z, 0.))
    8080
    8181from Numeric import allclose
  • inundation/ga/storm_surge/pyvolution/test_advection.py

    r648 r773  
    3131        domain.check_integrity()
    3232       
    33         assert domain.quantities.has_key('level')
     33        assert domain.quantities.has_key('stage')
    3434
    3535        assert domain.get_conserved_quantities(0, edge=1) == 0.
     
    4949        #Populate boundary array with dirichlet conditions.
    5050        domain.neighbours = array([[-1,-2,-3]])         
    51         domain.quantities['level'].boundary_values[:] = 1.0
     51        domain.quantities['stage'].boundary_values[:] = 1.0
    5252
    5353        domain.order = 1
     
    5858
    5959        domain.compute_fluxes()
    60         U = -domain.quantities['level'].explicit_update
     60        U = -domain.quantities['stage'].explicit_update
    6161        R = -0.5/domain.areas[0]
    6262
     
    7575        domain.check_integrity()
    7676
    77         domain.set_quantity('level', [1.0], 'centroids')
     77        domain.set_quantity('stage', [1.0], 'centroids')
    7878
    7979        domain.distribute_to_vertices_and_edges()
     
    8282       
    8383        domain.compute_fluxes()
    84         U = -domain.quantities['level'].explicit_update
     84        U = -domain.quantities['stage'].explicit_update
    8585        R = 0.5/domain.areas[0]
    8686
     
    103103        #Populate boundary array with dirichlet conditions.
    104104        domain.neighbours = array([[-1,-2,-3]])                 
    105         domain.quantities['level'].boundary_values[0] = 1.0
     105        domain.quantities['stage'].boundary_values[0] = 1.0
    106106       
    107107        domain.distribute_to_vertices_and_edges() #Use first order default
     
    110110
    111111        domain.compute_fluxes()
    112         U = domain.quantities['level'].explicit_update
     112        U = domain.quantities['stage'].explicit_update
    113113        assert allclose(U, 0)
    114114
     
    134134        #Populate boundary array with dirichlet conditions.
    135135        domain.neighbours = array([[1,-1,-2], [0,-3,-4]])
    136         domain.set_quantity('level', [1.0, 0.0], 'centroids')
     136        domain.set_quantity('stage', [1.0, 0.0], 'centroids')
    137137        domain.distribute_to_vertices_and_edges()
    138138
    139139        domain.compute_fluxes()         
    140140
    141         X = domain.quantities['level'].explicit_update
     141        X = domain.quantities['stage'].explicit_update
    142142        assert X[0] == -X[1]
    143143                       
     
    164164        #Check that the boundary value gets propagated to all elements
    165165        for t in domain.evolve(yieldstep = 0.05, finaltime = 10):
    166             if allclose(domain.quantities['level'].centroid_values, 3.1415):
     166            if allclose(domain.quantities['stage'].centroid_values, 3.1415):
    167167                break
    168168           
    169         assert allclose(domain.quantities['level'].centroid_values, 3.1415)
     169        assert allclose(domain.quantities['stage'].centroid_values, 3.1415)
    170170
    171171       
  • inundation/ga/storm_surge/pyvolution/test_data_manager.py

    r751 r773  
    4141
    4242        bed = domain.quantities['elevation'].vertex_values
    43         level = zeros(bed.shape, Float)
     43        stage = zeros(bed.shape, Float)
    4444
    4545        h = 0.3
    46         for i in range(level.shape[0]):
     46        for i in range(stage.shape[0]):
    4747            if i % 2 == 0:           
    48                 level[i,:] = bed[i,:] + h
     48                stage[i,:] = bed[i,:] + h
    4949            else:
    50                 level[i,:] = bed[i,:]
     50                stage[i,:] = bed[i,:]
    5151               
    52         domain.set_quantity('level', level)
    53         self.initial_level = copy.copy(domain.quantities['level'].vertex_values)
     52        domain.set_quantity('stage', stage)
     53        self.initial_stage = copy.copy(domain.quantities['stage'].vertex_values)
    5454
    5555        domain.distribute_to_vertices_and_edges()   
     
    246246        sww = get_dataobject(self.domain)
    247247        sww.store_connectivity()
    248         sww.store_timestep('level')
     248        sww.store_timestep('stage')
    249249
    250250        #Check contents
     
    261261     
    262262
    263         Q = self.domain.quantities['level']     
     263        Q = self.domain.quantities['stage']     
    264264        Q0 = Q.vertex_values[:,0]
    265265        Q1 = Q.vertex_values[:,1]
     
    302302        sww = get_dataobject(self.domain)
    303303        sww.store_connectivity()
    304         sww.store_timestep('level')     
     304        sww.store_timestep('stage')     
    305305        self.domain.evolve_to_end(finaltime = 0.01)
    306         sww.store_timestep('level')
     306        sww.store_timestep('stage')
    307307
    308308
     
    319319
    320320        #Check values
    321         Q = self.domain.quantities['level']     
     321        Q = self.domain.quantities['stage']     
    322322        Q0 = Q.vertex_values[:,0]
    323323        Q1 = Q.vertex_values[:,1]
     
    359359        sww = get_dataobject(self.domain)
    360360        sww.store_connectivity()
    361         sww.store_timestep('level')
     361        sww.store_timestep('stage')
    362362     
    363363        self.domain.evolve_to_end(finaltime = 0.01)
    364         sww.store_timestep('level')
     364        sww.store_timestep('stage')
    365365
    366366
     
    380380        #Check values
    381381        #Check values
    382         Q = self.domain.quantities['level']     
     382        Q = self.domain.quantities['stage']     
    383383        Q0 = Q.vertex_values[:,0]
    384384        Q1 = Q.vertex_values[:,1]
     
    417417        #Evolution
    418418        for t in self.domain.evolve(yieldstep = 1.0, finaltime = 4.0):
    419             level = self.domain.quantities['level'].vertex_values
     419            stage = self.domain.quantities['stage'].vertex_values
    420420
    421421            #Get NetCDF
    422422            fid = NetCDFFile(self.domain.writer.filename, 'r')
    423             stage = fid.variables['stage']
     423            stage_file = fid.variables['stage']
    424424
    425425            if t == 0.0:
    426                 assert allclose(level, self.initial_level)
    427                 assert allclose(stage[:], level.flat)
     426                assert allclose(stage, self.initial_stage)
     427                assert allclose(stage_file[:], stage.flat)
    428428            else:
    429                 assert not allclose(level, self.initial_level)
    430                 assert not allclose(stage[:], level.flat)                 
     429                assert not allclose(stage, self.initial_stage)
     430                assert not allclose(stage_file[:], stage.flat)                 
    431431
    432432            fid.close()
     
    450450        sww = get_dataobject(self.domain)
    451451        sww.store_connectivity()
    452         sww.store_timestep('level')
     452        sww.store_timestep('stage')
    453453
    454454        #Check contents
  • inundation/ga/storm_surge/pyvolution/test_domain.py

    r700 r773  
    5353        vertices = [ [1,0,2], [1,2,4], [4,2,5], [3,1,4], [3,0,5], [3,0,4]]
    5454
    55         conserved_quantities = ['level', 'xmomentum', 'ymomentum']
     55        conserved_quantities = ['stage', 'xmomentum', 'ymomentum']
    5656        other_quantities = ['elevation', 'friction']
    5757       
     
    8282        domain = Domain(points, vertices, boundary=None,
    8383                        conserved_quantities =\
    84                         ['level', 'xmomentum', 'ymomentum'])
    85 
    86 
    87         domain.set_quantity('level', [[1,2,3], [5,5,5],
     84                        ['stage', 'xmomentum', 'ymomentum'])
     85
     86
     87        domain.set_quantity('stage', [[1,2,3], [5,5,5],
    8888                                      [0,0,9], [-6, 3, 3],
    8989                                      [0,0,0], [0,0,0]])       
     
    182182        domain = Domain(points, vertices, boundary,
    183183                        conserved_quantities =\
    184                         ['level', 'xmomentum', 'ymomentum'])       
    185         domain.check_integrity()
    186 
    187 
    188 
    189         domain.set_quantity('level', [[1,2,3], [5,5,5],
     184                        ['stage', 'xmomentum', 'ymomentum'])       
     185        domain.check_integrity()
     186
     187
     188
     189        domain.set_quantity('stage', [[1,2,3], [5,5,5],
    190190                                      [0,0,9], [-6, 3, 3]])
    191191
     
    196196        domain.update_boundary()
    197197
    198         assert domain.quantities['level'].boundary_values[0] == 5. #Dirichlet
    199         assert domain.quantities['level'].boundary_values[1] == 5. #Dirichlet
    200         assert domain.quantities['level'].boundary_values[2] ==\
     198        assert domain.quantities['stage'].boundary_values[0] == 5. #Dirichlet
     199        assert domain.quantities['stage'].boundary_values[1] == 5. #Dirichlet
     200        assert domain.quantities['stage'].boundary_values[2] ==\
    201201               domain.get_conserved_quantities(2, edge=0)[0] #Transmissive (4.5)
    202         assert domain.quantities['level'].boundary_values[3] ==\
     202        assert domain.quantities['stage'].boundary_values[3] ==\
    203203               domain.get_conserved_quantities(2, edge=1)[0] #Transmissive (4.5)
    204         assert domain.quantities['level'].boundary_values[4] ==\
     204        assert domain.quantities['stage'].boundary_values[4] ==\
    205205               domain.get_conserved_quantities(3, edge=1)[0] #Transmissive (-1.5)
    206         assert domain.quantities['level'].boundary_values[5] ==\
     206        assert domain.quantities['stage'].boundary_values[5] ==\
    207207               domain.get_conserved_quantities(3, edge=2)[0] #Transmissive (-1.5)         
    208208
     
    238238        domain = Domain(points, vertices, boundary,
    239239                        conserved_quantities =\
    240                         ['level', 'xmomentum', 'ymomentum'])               
    241         domain.check_integrity()
    242 
    243 
    244         domain.set_quantity('level', [[1,2,3], [5,5,5],
     240                        ['stage', 'xmomentum', 'ymomentum'])               
     241        domain.check_integrity()
     242
     243
     244        domain.set_quantity('stage', [[1,2,3], [5,5,5],
    245245                                      [0,0,9], [-6, 3, 3]])
    246246
    247         assert allclose( domain.quantities['level'].centroid_values,
     247        assert allclose( domain.quantities['stage'].centroid_values,
    248248                         [2,5,3,0] )
    249249                         
     
    258258
    259259        #First order extrapolation
    260         assert allclose( domain.quantities['level'].vertex_values,
     260        assert allclose( domain.quantities['stage'].vertex_values,
    261261                         [[ 2.,  2.,  2.],
    262262                          [ 5.,  5.,  5.],
     
    288288        domain = Domain(points, vertices, boundary,
    289289                        conserved_quantities =\
    290                         ['level', 'xmomentum', 'ymomentum'])               
    291         domain.check_integrity()
    292 
    293 
    294         domain.set_quantity('level', [1,2,3,4], 'centroids')
     290                        ['stage', 'xmomentum', 'ymomentum'])               
     291        domain.check_integrity()
     292
     293
     294        domain.set_quantity('stage', [1,2,3,4], 'centroids')
    295295        domain.set_quantity('xmomentum', [1,2,3,4], 'centroids')
    296296        domain.set_quantity('ymomentum', [1,2,3,4], 'centroids')
     
    342342        domain = Domain(points, vertices, boundary,
    343343                        conserved_quantities =\
    344                         ['level', 'xmomentum', 'ymomentum'])               
    345         domain.check_integrity()
    346 
    347         domain.set_quantity('level', [[1,2,3], [5,5,5],
     344                        ['stage', 'xmomentum', 'ymomentum'])               
     345        domain.check_integrity()
     346
     347        domain.set_quantity('stage', [[1,2,3], [5,5,5],
    348348                                      [0,0,9], [-6, 3, 3]])
    349349
    350         assert allclose( domain.quantities['level'].centroid_values,
     350        assert allclose( domain.quantities['stage'].centroid_values,
    351351                         [2,5,3,0] )
    352352                         
     
    361361
    362362        #First order extrapolation
    363         assert allclose( domain.quantities['level'].vertex_values,
     363        assert allclose( domain.quantities['stage'].vertex_values,
    364364                         [[ 2.,  2.,  2.],
    365365                          [ 5.,  5.,  5.],
  • inundation/ga/storm_surge/pyvolution/test_generic_boundary_conditions.py

    r648 r773  
    6666        domain.check_integrity()
    6767
    68         domain.conserved_quantities = ['level', 'ymomentum']       
    69         domain.quantities['level'] =\
     68        domain.conserved_quantities = ['stage', 'ymomentum']       
     69        domain.quantities['stage'] =\
    7070                                   Quantity(domain, [[1,2,3], [5,5,5],
    7171                                                     [0,0,9], [-6, 3, 3]])
     
    124124       
    125125        domain = Domain(points, elements)
    126         domain.conserved_quantities = ['level', 'ymomentum']
    127         domain.quantities['level'] =\
     126        domain.conserved_quantities = ['stage', 'ymomentum']
     127        domain.quantities['stage'] =\
    128128                                   Quantity(domain, [[1,2,3], [5,5,5],
    129129                                                     [0,0,9], [-6, 3, 3]])
     
    193193       
    194194        domain = Domain(points, elements)
    195         domain.conserved_quantities = ['level', 'xmomentum', 'ymomentum']
    196         domain.quantities['level'] =\
     195        domain.conserved_quantities = ['stage', 'xmomentum', 'ymomentum']
     196        domain.quantities['stage'] =\
    197197                                   Quantity(domain, [[1,2,3], [5,5,5],
    198198                                                     [0,0,9], [-6, 3, 3]])
  • inundation/ga/storm_surge/pyvolution/test_interpolate_sww.py

    r631 r773  
    4646
    4747        bed = domain.quantities['elevation'].vertex_values
    48         level = zeros(bed.shape, Float)
     48        stage = zeros(bed.shape, Float)
    4949
    5050        h = 0.3
    51         for i in range(level.shape[0]):
     51        for i in range(stage.shape[0]):
    5252            if i % 2 == 0:           
    53                 level[i,:] = bed[i,:] + h
     53                stage[i,:] = bed[i,:] + h
    5454            else:
    55                 level[i,:] = bed[i,:]
     55                stage[i,:] = bed[i,:]
    5656               
    57         domain.set_quantity('level', level)
     57        domain.set_quantity('stage', stage)
    5858
    5959        domain.distribute_to_vertices_and_edges()   
     
    8787        sww = get_dataobject(self.domain)
    8888        sww.store_connectivity()
    89         sww.store_timestep('level')
     89        sww.store_timestep('stage')
    9090        self.domain.time = 2.
    91         sww.store_timestep('level')
     91        sww.store_timestep('stage')
    9292
    9393        #Check contents
     
    154154        sww = get_dataobject(self.domain)
    155155        sww.store_connectivity()
    156         sww.store_timestep('level')
     156        sww.store_timestep('stage')
    157157        self.domain.time = 2.
    158         sww.store_timestep('level')
     158        sww.store_timestep('stage')
    159159
    160160        #print "self.domain.filename",self.domain.filename
  • inundation/ga/storm_surge/pyvolution/test_pmesh2domain.py

    r716 r773  
    4545# Vert att title  \n \
    4646elevation  \n \
    47 level  \n \
     47stage  \n \
    4848friction  \n \
    49492 # <triangle #> [<vertex #>] [<neigbouring triangle #>]  \n\
     
    8585                        answer)
    8686         
    87          #print domain.quantities['level'].vertex_values
     87         #print domain.quantities['stage'].vertex_values
    8888         answer = [[0., 12., 10.],
    8989                   [0., 10., 12.]]
    90          assert allclose(domain.quantities['level'].vertex_values,
     90         assert allclose(domain.quantities['stage'].vertex_values,
    9191                        answer)
    9292         
  • inundation/ga/storm_surge/pyvolution/test_quantity.py

    r765 r773  
    538538
    539539        bed = domain.quantities['elevation'].vertex_values
    540         level = zeros(bed.shape, Float)
     540        stage = zeros(bed.shape, Float)
    541541
    542542        h = 0.03
    543         for i in range(level.shape[0]):
     543        for i in range(stage.shape[0]):
    544544            if i % 2 == 0:           
    545                 level[i,:] = bed[i,:] + h
     545                stage[i,:] = bed[i,:] + h
    546546            else:
    547                 level[i,:] = bed[i,:]
     547                stage[i,:] = bed[i,:]
    548548               
    549         domain.set_quantity('level', level)
    550 
    551         level = domain.quantities['level']
    552 
    553         #Get smoothed level
    554         A, V = level.get_vertex_values(xy=False, smooth=True)
    555         Q = level.vertex_values
     549        domain.set_quantity('stage', stage)
     550
     551        stage = domain.quantities['stage']
     552
     553        #Get smoothed stage
     554        A, V = stage.get_vertex_values(xy=False, smooth=True)
     555        Q = stage.vertex_values
    556556
    557557       
     
    581581        assert allclose(V[7,:], [5,4,8])                       
    582582
    583         #Get smoothed level with XY
    584         X, Y, A1, V1 = level.get_vertex_values(xy=True, smooth=True)
     583        #Get smoothed stage with XY
     584        X, Y, A1, V1 = stage.get_vertex_values(xy=True, smooth=True)
    585585
    586586        assert allclose(A, A1)
     
    623623
    624624        bed = domain.quantities['elevation'].vertex_values
    625         level = zeros(bed.shape, Float)
     625        stage = zeros(bed.shape, Float)
    626626
    627627        h = 0.03
    628         for i in range(level.shape[0]):
     628        for i in range(stage.shape[0]):
    629629            if i % 2 == 0:           
    630                 level[i,:] = bed[i,:] + h
     630                stage[i,:] = bed[i,:] + h
    631631            else:
    632                 level[i,:] = bed[i,:]
     632                stage[i,:] = bed[i,:]
    633633               
    634         domain.set_quantity('level', level)
    635 
    636         #Get level
    637         level = domain.quantities['level']       
    638         A, V = level.get_vertex_values(xy=False, smooth=False)
    639         Q = level.vertex_values.flat
     634        domain.set_quantity('stage', stage)
     635
     636        #Get stage
     637        stage = domain.quantities['stage']       
     638        A, V = stage.get_vertex_values(xy=False, smooth=False)
     639        Q = stage.vertex_values.flat
    640640
    641641        for k in range(8):
     
    650650
    651651
    652         X, Y, A1, V1 = level.get_vertex_values(xy=True, smooth=False)
     652        X, Y, A1, V1 = stage.get_vertex_values(xy=True, smooth=False)
    653653
    654654       
  • inundation/ga/storm_surge/pyvolution/test_region.py

    r715 r773  
    7979                         
    8080        domain.set_quantity('elevation', 10.0)
    81         domain.set_quantity('level', 10.0)
    82         domain.set_region(Add_value_to_region('top', 'level', 1.0,initial_quantity='elevation'))
    83         #print domain.quantities['level'].get_values()
    84         assert allclose(domain.quantities['level'].get_values(),
     81        domain.set_quantity('stage', 10.0)
     82        domain.set_region(Add_value_to_region('top', 'stage', 1.0,initial_quantity='elevation'))
     83        #print domain.quantities['stage'].get_values()
     84        assert allclose(domain.quantities['stage'].get_values(),
    8585                        [[ 10., 10., 10.],
    8686                         [ 10., 10., 10.],
  • inundation/ga/storm_surge/pyvolution/test_shallow_water.py

    r767 r773  
    187187        domain.check_integrity()
    188188
    189         for name in ['level', 'xmomentum', 'ymomentum',
     189        for name in ['stage', 'xmomentum', 'ymomentum',
    190190                     'elevation', 'friction']:
    191191            assert domain.quantities.has_key(name)
     
    219219
    220220
    221         domain.set_quantity('level', [[1,2,3], [5,5,5],
     221        domain.set_quantity('stage', [[1,2,3], [5,5,5],
    222222                                      [0,0,9], [-6, 3, 3]])
    223223
     
    236236        domain.update_boundary()
    237237
    238         #Level
    239         assert domain.quantities['level'].boundary_values[0] == 2.5
    240         assert domain.quantities['level'].boundary_values[0] ==\
     238        #Stage
     239        assert domain.quantities['stage'].boundary_values[0] == 2.5
     240        assert domain.quantities['stage'].boundary_values[0] ==\
    241241               domain.get_conserved_quantities(0, edge=0)[0] #Reflective (2.5)
    242         assert domain.quantities['level'].boundary_values[1] == 5. #Dirichlet
    243         assert domain.quantities['level'].boundary_values[2] ==\
     242        assert domain.quantities['stage'].boundary_values[1] == 5. #Dirichlet
     243        assert domain.quantities['stage'].boundary_values[2] ==\
    244244               domain.get_conserved_quantities(2, edge=0)[0] #Transmissive (4.5)
    245         assert domain.quantities['level'].boundary_values[3] ==\
     245        assert domain.quantities['stage'].boundary_values[3] ==\
    246246               domain.get_conserved_quantities(2, edge=1)[0] #Transmissive (4.5)
    247         assert domain.quantities['level'].boundary_values[4] ==\
     247        assert domain.quantities['stage'].boundary_values[4] ==\
    248248               domain.get_conserved_quantities(3, edge=1)[0] #Transmissive (-1.5)
    249         assert domain.quantities['level'].boundary_values[5] ==\
     249        assert domain.quantities['stage'].boundary_values[5] ==\
    250250               domain.get_conserved_quantities(3, edge=2)[0] #Reflective (-1.5)
    251251
     
    295295
    296296
    297         domain.set_quantity('level', [[1,2,3], [5,5,5],
     297        domain.set_quantity('stage', [[1,2,3], [5,5,5],
    298298                                      [0,0,9], [-6, 3, 3]])
    299299
     
    317317    def test_compute_fluxes0(self):
    318318        #Do a full triangle and check that fluxes cancel out for
    319         #the constant level case
     319        #the constant stage case
    320320       
    321321        a = [0.0, 0.0]
     
    331331       
    332332        domain = Domain(points, vertices)       
    333         domain.set_quantity('level', [[2,2,2], [2,2,2],
     333        domain.set_quantity('stage', [[2,2,2], [2,2,2],
    334334                                      [2,2,2], [2,2,2]])
    335335        domain.check_integrity()
     
    387387        domain.compute_fluxes()
    388388
    389         for name in ['level', 'xmomentum', 'ymomentum']:
     389        for name in ['stage', 'xmomentum', 'ymomentum']:
    390390            #print name, domain.quantities[name].explicit_update
    391391            assert allclose(domain.quantities[name].explicit_update[1], 0)
     
    413413        val3 = 2.+8.0/3
    414414       
    415         domain.set_quantity('level', [[val0, val0, val0], [val1, val1, val1],
     415        domain.set_quantity('stage', [[val0, val0, val0], [val1, val1, val1],
    416416                                      [val2, val2, val2], [val3, val3, val3]])
    417417        domain.check_integrity()
     
    457457
    458458        #assert allclose(total_flux, domain.explicit_update[1,:])
    459         for i, name in enumerate(['level', 'xmomentum', 'ymomentum']):
     459        for i, name in enumerate(['stage', 'xmomentum', 'ymomentum']):
    460460            assert allclose(total_flux[i],
    461461                            domain.quantities[name].explicit_update[1])
     
    467467        #    [-35.68522449, 0., 69.68888889]])
    468468
    469         assert allclose(domain.quantities['level'].explicit_update,
     469        assert allclose(domain.quantities['stage'].explicit_update,
    470470                        [0., -0.68218178, -111.77316251, -35.68522449])
    471471        assert allclose(domain.quantities['xmomentum'].explicit_update,
     
    506506       
    507507       
    508         domain.set_quantity('level', [[val0, val0-1, val0-2],
     508        domain.set_quantity('stage', [[val0, val0-1, val0-2],
    509509                                      [val1, val1+1, val1],
    510510                                      [val2, val2-2, val2],
     
    551551       
    552552        domain.compute_fluxes()
    553         for i, name in enumerate(['level', 'xmomentum', 'ymomentum']):
     553        for i, name in enumerate(['stage', 'xmomentum', 'ymomentum']):
    554554            assert allclose(total_flux[i],
    555555                            domain.quantities[name].explicit_update[1])       
     
    577577        val3 = 2.+8.0/3
    578578
    579         zl=zr=-3.75 #Assume constant bed (must be less than level)
     579        zl=zr=-3.75 #Assume constant bed (must be less than stage)
    580580        domain.set_quantity('elevation', zl*ones( (4,3) ))
    581581       
    582582       
    583         domain.set_quantity('level', [[val0, val0-1, val0-2],
     583        domain.set_quantity('stage', [[val0, val0-1, val0-2],
    584584                                      [val1, val1+1, val1],
    585585                                      [val2, val2-2, val2],
     
    625625       
    626626        domain.compute_fluxes()
    627         for i, name in enumerate(['level', 'xmomentum', 'ymomentum']):
     627        for i, name in enumerate(['stage', 'xmomentum', 'ymomentum']):
    628628            assert allclose(total_flux[i],
    629629                            domain.quantities[name].explicit_update[1])
     
    652652        zl=zr=4  #Too large
    653653        domain.set_quantity('elevation', zl*ones( (4,3) ))
    654         domain.set_quantity('level', [[val0, val0-1, val0-2],
     654        domain.set_quantity('stage', [[val0, val0-1, val0-2],
    655655                                      [val1, val1+1, val1],
    656656                                      [val2, val2-2, val2],
     
    692692
    693693        h = 0.1
    694         def level(x,y):
     694        def stage(x,y):
    695695            return slope(x,y)+h
    696696
    697697        domain.set_quantity('elevation', slope)
    698         domain.set_quantity('level', level)
    699 
    700         initial_level = copy.copy(domain.quantities['level'].vertex_values)
     698        domain.set_quantity('stage', stage)
     699
     700        initial_stage = copy.copy(domain.quantities['stage'].vertex_values)
    701701
    702702        domain.set_boundary({'exterior': Reflective_boundary(domain)})
     
    704704        #Evolution
    705705        for t in domain.evolve(yieldstep = 1.0, finaltime = 2.0):
    706             level = domain.quantities['level'].vertex_values
     706            stage = domain.quantities['stage'].vertex_values
    707707
    708708            if t == 0.0:
    709                 assert allclose(level, initial_level)
     709                assert allclose(stage, initial_stage)
    710710            else:
    711                 assert not allclose(level, initial_level)
     711                assert not allclose(stage, initial_stage)
    712712               
    713713     
     
    738738
    739739        h = 0.1
    740         def level(x,y):
     740        def stage(x,y):
    741741            return slope(x,y)+h
    742742
    743743        domain.set_quantity('elevation', slope)
    744         domain.set_quantity('level', level)
     744        domain.set_quantity('stage', stage)
    745745
    746746        for name in domain.conserved_quantities:
     
    750750        domain.compute_forcing_terms()                                   
    751751
    752         assert allclose(domain.quantities['level'].explicit_update, 0)
     752        assert allclose(domain.quantities['stage'].explicit_update, 0)
    753753        assert allclose(domain.quantities['xmomentum'].explicit_update, -g*h*3)
    754754        assert allclose(domain.quantities['ymomentum'].explicit_update, 0)
     
    776776
    777777        h = 0.1
    778         def level(x,y):
     778        def stage(x,y):
    779779            return slope(x,y)+h
    780780
    781781        eta = 0.07
    782782        domain.set_quantity('elevation', slope)
    783         domain.set_quantity('level', level)
     783        domain.set_quantity('stage', stage)
    784784        domain.set_quantity('friction', eta)       
    785785
     
    790790        domain.compute_forcing_terms()                                   
    791791
    792         assert allclose(domain.quantities['level'].explicit_update, 0)
     792        assert allclose(domain.quantities['stage'].explicit_update, 0)
    793793        assert allclose(domain.quantities['xmomentum'].explicit_update, -g*h*3)
    794794        assert allclose(domain.quantities['ymomentum'].explicit_update, 0)
    795795
    796         assert allclose(domain.quantities['level'].semi_implicit_update, 0)
     796        assert allclose(domain.quantities['stage'].semi_implicit_update, 0)
    797797        assert allclose(domain.quantities['xmomentum'].semi_implicit_update, 0)
    798798        assert allclose(domain.quantities['ymomentum'].semi_implicit_update, 0)       
     
    803803
    804804        domain.compute_forcing_terms()                                   
    805         assert allclose(domain.quantities['level'].semi_implicit_update, 0)
     805        assert allclose(domain.quantities['stage'].semi_implicit_update, 0)
    806806        assert allclose(domain.quantities['xmomentum'].semi_implicit_update, S)
    807807        assert allclose(domain.quantities['ymomentum'].semi_implicit_update, 0)       
    808808
    809809        #A more complex example
    810         domain.quantities['level'].semi_implicit_update[:] = 0.0
     810        domain.quantities['stage'].semi_implicit_update[:] = 0.0
    811811        domain.quantities['xmomentum'].semi_implicit_update[:] = 0.0
    812812        domain.quantities['ymomentum'].semi_implicit_update[:] = 0.0       
     
    820820        domain.compute_forcing_terms()
    821821
    822         assert allclose(domain.quantities['level'].semi_implicit_update, 0)
     822        assert allclose(domain.quantities['stage'].semi_implicit_update, 0)
    823823        assert allclose(domain.quantities['xmomentum'].semi_implicit_update, 3*S)
    824824        assert allclose(domain.quantities['ymomentum'].semi_implicit_update, 4*S)       
     
    844844        #Flat surface with 1m of water
    845845        domain.set_quantity('elevation', 0)
    846         domain.set_quantity('level', 1.0)
     846        domain.set_quantity('stage', 1.0)
    847847        domain.set_quantity('friction', 0)       
    848848
     
    871871        S = const * sqrt(u**2 + v**2)
    872872
    873         assert allclose(domain.quantities['level'].explicit_update, 0)
     873        assert allclose(domain.quantities['stage'].explicit_update, 0)
    874874        assert allclose(domain.quantities['xmomentum'].explicit_update, S*u)
    875875        assert allclose(domain.quantities['ymomentum'].explicit_update, S*v)
     
    895895        #Flat surface with 1m of water
    896896        domain.set_quantity('elevation', 0)
    897         domain.set_quantity('level', 1.0)
     897        domain.set_quantity('stage', 1.0)
    898898        domain.set_quantity('friction', 0)       
    899899
     
    938938            S = const * sqrt(u**2 + v**2)
    939939
    940             assert allclose(domain.quantities['level'].explicit_update[k], 0)
     940            assert allclose(domain.quantities['stage'].explicit_update[k], 0)
    941941            assert allclose(domain.quantities['xmomentum'].explicit_update[k], S*u)
    942942            assert allclose(domain.quantities['ymomentum'].explicit_update[k], S*v)
     
    968968        #Flat surface with 1m of water
    969969        domain.set_quantity('elevation', 0)
    970         domain.set_quantity('level', 1.0)
     970        domain.set_quantity('stage', 1.0)
    971971        domain.set_quantity('friction', 0)       
    972972
     
    10241024
    10251025        for k in range(N):
    1026             assert allclose(domain.quantities['level'].explicit_update[k], 0)
     1026            assert allclose(domain.quantities['stage'].explicit_update[k], 0)
    10271027            assert allclose(domain.quantities['xmomentum'].explicit_update[k], S*u)
    10281028            assert allclose(domain.quantities['ymomentum'].explicit_update[k], S*v)
     
    10531053        #Flat surface with 1m of water
    10541054        domain.set_quantity('elevation', 0)
    1055         domain.set_quantity('level', 1.0)
     1055        domain.set_quantity('stage', 1.0)
    10561056        domain.set_quantity('friction', 0)       
    10571057
     
    11141114        val3 = 2.+8.0/3
    11151115
    1116         zl=zr=-3.75 #Assume constant bed (must be less than level)       
     1116        zl=zr=-3.75 #Assume constant bed (must be less than stage)       
    11171117        domain.set_quantity('elevation', zl*ones( (4,3) ))
    1118         domain.set_quantity('level', [[val0, val0-1, val0-2],
     1118        domain.set_quantity('stage', [[val0, val0-1, val0-2],
    11191119                                      [val1, val1+1, val1],
    11201120                                      [val2, val2-2, val2],
     
    11271127
    11281128        #Check that centroid values were distributed to vertices
    1129         C = domain.quantities['level'].centroid_values
     1129        C = domain.quantities['stage'].centroid_values
    11301130        for i in range(3):
    1131             assert allclose( domain.quantities['level'].vertex_values[:,i], C)
     1131            assert allclose( domain.quantities['stage'].vertex_values[:,i], C)
    11321132       
    11331133
     
    11561156        domain.set_quantity('elevation', [[0,0,0], [6,0,0],
    11571157                                          [6,6,6], [6,6,6]])
    1158         domain.set_quantity('level', [[val0, val0, val0],
     1158        domain.set_quantity('stage', [[val0, val0, val0],
    11591159                                      [val1, val1, val1],
    11601160                                      [val2, val2, val2],
     
    11621162
    11631163        E = domain.quantities['elevation'].vertex_values
    1164         L = domain.quantities['level'].vertex_values       
    1165 
    1166        
    1167         #Check that some levels are not above elevation (within eps)
     1164        L = domain.quantities['stage'].vertex_values       
     1165
     1166       
     1167        #Check that some stages are not above elevation (within eps)
    11681168        #- so that the limiter has something to work with
    11691169        assert not alltrue(alltrue(greater_equal(L,E-epsilon)))               
     
    11721172        domain.distribute_to_vertices_and_edges()                           
    11731173
    1174         #Check that all levels are above elevation (within eps)
     1174        #Check that all stages are above elevation (within eps)
    11751175        assert alltrue(alltrue(greater_equal(L,E-epsilon)))
    11761176
     
    11991199        val3 = 2.
    12001200
    1201         domain.set_quantity('level', [val0, val1, val2, val3], 'centroids')
    1202         L = domain.quantities['level'].vertex_values
     1201        domain.set_quantity('stage', [val0, val1, val2, val3], 'centroids')
     1202        L = domain.quantities['stage'].vertex_values
    12031203       
    12041204        #First order
     
    12301230       
    12311231        domain = Domain(points, vertices)
    1232         L = domain.quantities['level'].vertex_values   
    1233        
    1234         def level(x,y):
     1232        L = domain.quantities['stage'].vertex_values   
     1233       
     1234        def stage(x,y):
    12351235            return x**2
    12361236       
    1237         domain.set_quantity('level', level, 'centroids')
     1237        domain.set_quantity('stage', stage, 'centroids')
    12381238       
    1239         a, b = domain.quantities['level'].compute_gradients()           
     1239        a, b = domain.quantities['stage'].compute_gradients()           
    12401240        assert allclose(a[1], 3.33333334)
    12411241        assert allclose(b[1], 0.0)
     
    12671267       
    12681268        domain = Domain(points, vertices)
    1269         L = domain.quantities['level'].vertex_values   
    1270        
    1271         def level(x,y):
     1269        L = domain.quantities['stage'].vertex_values   
     1270       
     1271        def stage(x,y):
    12721272            return x**4+y**2
    12731273       
    1274         domain.set_quantity('level', level, 'centroids')
    1275         #print domain.quantities['level'].centroid_values               
     1274        domain.set_quantity('stage', stage, 'centroids')
     1275        #print domain.quantities['stage'].centroid_values               
    12761276       
    1277         a, b = domain.quantities['level'].compute_gradients()           
     1277        a, b = domain.quantities['stage'].compute_gradients()           
    12781278        assert allclose(a[1], 25.18518519)
    12791279        assert allclose(b[1], 3.33333333)
     
    13121312
    13131313        h = 0.1
    1314         def level(x,y):
     1314        def stage(x,y):
    13151315            return slope(x,y)+h
    13161316
    13171317        domain.set_quantity('elevation', slope)
    1318         domain.set_quantity('level', level, 'centroids')
     1318        domain.set_quantity('stage', stage, 'centroids')
    13191319
    13201320        #print domain.quantities['elevation'].centroid_values   
    1321         #print domain.quantities['level'].centroid_values
     1321        #print domain.quantities['stage'].centroid_values
    13221322       
    13231323        E = domain.quantities['elevation'].vertex_values
    1324         L = domain.quantities['level'].vertex_values
     1324        L = domain.quantities['stage'].vertex_values
    13251325
    13261326        #print E
     
    13571357
    13581358        h = 0.1
    1359         def level(x,y):
     1359        def stage(x,y):
    13601360            return slope(x,y)+h
    13611361
    13621362        domain.set_quantity('elevation', slope)
    1363         domain.set_quantity('level', level)
     1363        domain.set_quantity('stage', stage)
    13641364
    13651365        #print domain.quantities['elevation'].centroid_values   
    1366         #print domain.quantities['level'].centroid_values
     1366        #print domain.quantities['stage'].centroid_values
    13671367       
    13681368        E = domain.quantities['elevation'].vertex_values
    1369         L = domain.quantities['level'].vertex_values
     1369        L = domain.quantities['stage'].vertex_values
    13701370
    13711371        #print E
     
    14031403
    14041404        domain.set_quantity('elevation', slope)
    1405         domain.set_quantity('level',
     1405        domain.set_quantity('stage',
    14061406                            [0.01298164, 0.00365611, 0.01440365, -0.0381856437096],
    14071407                            'centroids')
     
    14141414       
    14151415        E = domain.quantities['elevation'].vertex_values
    1416         L = domain.quantities['level'].vertex_values
     1416        L = domain.quantities['stage'].vertex_values
    14171417        X = domain.quantities['xmomentum'].vertex_values       
    14181418        Y = domain.quantities['ymomentum'].vertex_values               
     
    14611461        assert allclose(domain.max_timestep, 0.0396825396825)
    14621462
    1463         assert allclose(domain.quantities['level'].centroid_values[:12],
     1463        assert allclose(domain.quantities['stage'].centroid_values[:12],
    14641464                        [0.00171396, 0.02656103, 0.00241523, 0.02656103,
    14651465                        0.00241523, 0.02656103, 0.00241523, 0.02656103,
     
    14671467
    14681468        domain.distribute_to_vertices_and_edges()
    1469         assert allclose(domain.quantities['level'].vertex_values[:12,0],
     1469        assert allclose(domain.quantities['stage'].vertex_values[:12,0],
    14701470                        [0.0001714, 0.02656103, 0.00024152,
    14711471                        0.02656103, 0.00024152, 0.02656103,
     
    14731473                        0.02656103, 0.00024152, 0.0272623])
    14741474
    1475         assert allclose(domain.quantities['level'].vertex_values[:12,1],
     1475        assert allclose(domain.quantities['stage'].vertex_values[:12,1],
    14761476                        [0.00315012, 0.02656103, 0.00024152, 0.02656103,
    14771477                         0.00024152, 0.02656103, 0.00024152, 0.02656103,
    14781478                         0.00024152, 0.02656103, 0.00040506, 0.0272623])
    14791479       
    1480         assert allclose(domain.quantities['level'].vertex_values[:12,2],
     1480        assert allclose(domain.quantities['stage'].vertex_values[:12,2],
    14811481                        [0.00182037, 0.02656103, 0.00676264,
    14821482                         0.02656103, 0.00676264, 0.02656103,
     
    15291529        #assert allclose(domain.min_timestep, 0.0396825396825)
    15301530        #assert allclose(domain.max_timestep, 0.0396825396825)
    1531         #print domain.quantities['level'].centroid_values
     1531        #print domain.quantities['stage'].centroid_values
    15321532
    15331533
     
    15671567
    15681568        for i in range(3):
    1569             #assert allclose(domain.quantities['level'].edge_values[:4,i],
     1569            #assert allclose(domain.quantities['stage'].edge_values[:4,i],
    15701570            #                [0.10730244,0.12337617,0.11200126,0.12605666])
    15711571
     
    16091609        assert allclose(domain.max_timestep, 0.0210448446782)
    16101610
    1611         #print domain.quantities['level'].vertex_values[:4,0]
     1611        #print domain.quantities['stage'].vertex_values[:4,0]
    16121612        #print domain.quantities['xmomentum'].vertex_values[:4,0]
    16131613        #print domain.quantities['ymomentum'].vertex_values[:4,0]
    16141614
    16151615        #FIXME: These numbers were from version before 25/10
    1616         #assert allclose(domain.quantities['level'].vertex_values[:4,0],
     1616        #assert allclose(domain.quantities['stage'].vertex_values[:4,0],
    16171617        #                [0.00101913,0.05352143,0.00104852,0.05354394])
    16181618       
     
    16991699
    17001700       
    1701                 domain.set_quantity('level', L, 'centroids')
     1701                domain.set_quantity('stage', L, 'centroids')
    17021702                domain.set_quantity('xmomentum', X, 'centroids')
    17031703                domain.set_quantity('ymomentum', Y, 'centroids')
     
    17141714            #Centroids were correct but not vertices.
    17151715            #Hence the check of distribute below.
    1716             assert allclose(domain.quantities['level'].centroid_values[:4],
     1716            assert allclose(domain.quantities['stage'].centroid_values[:4],
    17171717                            [0.00721206,0.05352143,0.01009108,0.05354394])
    17181718
     
    17471747
    17481748            #FIXME: These numbers were from version before 25/10
    1749             #assert allclose(domain.quantities['level'].vertex_values[:4,0],
     1749            #assert allclose(domain.quantities['stage'].vertex_values[:4,0],
    17501750            #                [0.00101913,0.05352143,0.00104852,0.05354394])
    17511751
     
    17981798
    17991799        #Initial condition
    1800         domain.set_quantity('level', Constant_height(x_slope, 0.05))
     1800        domain.set_quantity('stage', Constant_height(x_slope, 0.05))
    18011801        domain.check_integrity()
    18021802
     
    18341834
    18351835        #Initial condition
    1836         domain.set_quantity('level', Constant_height(x_slope, 0.05))
     1836        domain.set_quantity('stage', Constant_height(x_slope, 0.05))
    18371837        domain.check_integrity()
    18381838
     
    18421842
    18431843        #Data from earlier version of pyvolution
    1844         #print domain.quantities['level'].centroid_values
    1845        
    1846         assert allclose(domain.quantities['level'].centroid_values,
     1844        #print domain.quantities['stage'].centroid_values
     1845       
     1846        assert allclose(domain.quantities['stage'].centroid_values,
    18471847                        [-0.02998628, -0.01520652, -0.03043492,
    18481848                        -0.0149132, -0.03004706, -0.01476251,
     
    18961896
    18971897        #Initial condition
    1898         domain.set_quantity('level', Constant_height(x_slope, 0.05))
     1898        domain.set_quantity('stage', Constant_height(x_slope, 0.05))
    18991899        domain.check_integrity()
    19001900
    1901         assert allclose(domain.quantities['level'].centroid_values,
     1901        assert allclose(domain.quantities['stage'].centroid_values,
    19021902                        [0.01296296, 0.03148148, 0.01296296,
    19031903                        0.03148148, 0.01296296, 0.03148148,
     
    19261926
    19271927
    1928         #print domain.quantities['level'].extrapolate_second_order()
     1928        #print domain.quantities['stage'].extrapolate_second_order()
    19291929        #domain.distribute_to_vertices_and_edges()
    1930         #print domain.quantities['level'].vertex_values[:,0]       
     1930        #print domain.quantities['stage'].vertex_values[:,0]       
    19311931       
    19321932        #Evolution
     
    19361936
    19371937
    1938         #print domain.quantities['level'].centroid_values
    1939         assert allclose(domain.quantities['level'].centroid_values,
     1938        #print domain.quantities['stage'].centroid_values
     1939        assert allclose(domain.quantities['stage'].centroid_values,
    19401940                 [0.01290985, 0.02356019, 0.01619096, 0.02356019, 0.01619096,
    19411941                  0.02356019, 0.01619096, 0.02356019, 0.01619096, 0.02356019,
     
    19831983
    19841984        #Initial condition
    1985         domain.set_quantity('level', Constant_height(x_slope, 0.05))
     1985        domain.set_quantity('stage', Constant_height(x_slope, 0.05))
    19861986        domain.check_integrity()
    19871987
    1988         assert allclose(domain.quantities['level'].centroid_values,
     1988        assert allclose(domain.quantities['stage'].centroid_values,
    19891989                        [0.01296296, 0.03148148, 0.01296296,
    19901990                        0.03148148, 0.01296296, 0.03148148,
     
    20132013
    20142014
    2015         #print domain.quantities['level'].extrapolate_second_order()
     2015        #print domain.quantities['stage'].extrapolate_second_order()
    20162016        #domain.distribute_to_vertices_and_edges()
    2017         #print domain.quantities['level'].vertex_values[:,0]       
     2017        #print domain.quantities['stage'].vertex_values[:,0]       
    20182018       
    20192019        #Evolution
     
    20272027
    20282028
    2029         assert allclose(domain.quantities['level'].centroid_values,
     2029        assert allclose(domain.quantities['stage'].centroid_values,
    20302030                        [0.00855788, 0.01575204, 0.00994606, 0.01717072,
    20312031                         0.01005985, 0.01716362, 0.01005985, 0.01716299,
     
    20752075
    20762076        #Initial condition
    2077         domain.set_quantity('level', Constant_height(x_slope, 0.05))
     2077        domain.set_quantity('stage', Constant_height(x_slope, 0.05))
    20782078        domain.check_integrity()
    20792079
    2080         assert allclose(domain.quantities['level'].centroid_values,
     2080        assert allclose(domain.quantities['stage'].centroid_values,
    20812081                        [0.01296296, 0.03148148, 0.01296296,
    20822082                        0.03148148, 0.01296296, 0.03148148,
     
    21052105
    21062106
    2107         #print domain.quantities['level'].extrapolate_second_order()
     2107        #print domain.quantities['stage'].extrapolate_second_order()
    21082108        #domain.distribute_to_vertices_and_edges()
    2109         #print domain.quantities['level'].vertex_values[:,0]       
     2109        #print domain.quantities['stage'].vertex_values[:,0]       
    21102110       
    21112111        #Evolution
     
    21162116
    21172117       
    2118         assert allclose(domain.quantities['level'].centroid_values,
     2118        assert allclose(domain.quantities['stage'].centroid_values,
    21192119                 [0.00855788, 0.01575204, 0.00994606, 0.01717072, 0.01005985,
    21202120                  0.01716362, 0.01005985, 0.01716299, 0.01007098, 0.01736248,
     
    21632163
    21642164        #Initial condition
    2165         domain.set_quantity('level', Constant_height(x_slope, 0.05))
     2165        domain.set_quantity('stage', Constant_height(x_slope, 0.05))
    21662166        domain.check_integrity()
    21672167
    2168         assert allclose(domain.quantities['level'].centroid_values,
     2168        assert allclose(domain.quantities['stage'].centroid_values,
    21692169                        [0.01296296, 0.03148148, 0.01296296,
    21702170                        0.03148148, 0.01296296, 0.03148148,
     
    21932193
    21942194
    2195         #print domain.quantities['level'].extrapolate_second_order()
     2195        #print domain.quantities['stage'].extrapolate_second_order()
    21962196        #domain.distribute_to_vertices_and_edges()
    2197         #print domain.quantities['level'].vertex_values[:,0]       
     2197        #print domain.quantities['stage'].vertex_values[:,0]       
    21982198       
    21992199        #Evolution
     
    22022202
    22032203       
    2204         assert allclose(domain.quantities['level'].centroid_values,
     2204        assert allclose(domain.quantities['stage'].centroid_values,
    22052205     [-0.02907028, -0.01475478, -0.02973417, -0.01447186, -0.02932665, -0.01428285,
    22062206      -0.02901975, -0.0141361,  -0.02898816, -0.01418135, -0.02961409, -0.01403487,
     
    22792279
    22802280        #Initial condition
    2281         domain.set_quantity('level', Constant_height(x_slope, 0.05))
     2281        domain.set_quantity('stage', Constant_height(x_slope, 0.05))
    22822282        domain.check_integrity()
    22832283
     
    22862286            pass
    22872287
    2288         assert allclose(domain.quantities['level'].centroid_values[:4],
     2288        assert allclose(domain.quantities['stage'].centroid_values[:4],
    22892289                        [0.00206836, 0.01296714, 0.00363415, 0.01438924])
    22902290        assert allclose(domain.quantities['xmomentum'].centroid_values[:4],                     
     
    23242324        domain.set_boundary({'left': Bd, 'right': Br, 'bottom': Br, 'top': Br})
    23252325
    2326         domain.set_quantity('level', Constant_height(Z, 0.))
     2326        domain.set_quantity('stage', Constant_height(Z, 0.))
    23272327
    23282328        for t in domain.evolve(yieldstep = 0.02, finaltime = 0.2):
     
    23302330
    23312331
    2332         #print domain.quantities['level'].centroid_values
     2332        #print domain.quantities['stage'].centroid_values
    23332333
    23342334        #FIXME: These numbers were from version before 25/10       
    2335         #assert allclose(domain.quantities['level'].centroid_values,
     2335        #assert allclose(domain.quantities['stage'].centroid_values,
    23362336# [3.95822638e-002,  5.61022588e-002,  4.66437868e-002,  5.73081011e-002,
    23372337#  4.72394613e-002,  5.74684939e-002,  4.74309483e-002,  5.77458084e-002,
  • inundation/ga/storm_surge/pyvolution/wind_example_scalar.py

    r614 r773  
    2222#Set initial conditions
    2323domain.set_quantity('elevation', 0.0)
    24 domain.set_quantity('level', 1.0)
     24domain.set_quantity('stage', 1.0)
    2525domain.set_quantity('friction', 0.03)
    2626
  • inundation/ga/storm_surge/pyvolution/wind_example_variable.py

    r624 r773  
    2727h = 1.0
    2828domain.set_quantity('elevation', 0.0)
    29 domain.set_quantity('level', h)
     29domain.set_quantity('stage', h)
    3030domain.set_quantity('friction', 0.01)
    3131
Note: See TracChangeset for help on using the changeset viewer.