Changeset 9733


Ignore:
Timestamp:
May 4, 2015, 12:09:38 PM (9 years ago)
Author:
steve
Message:

Big update to version 2.0 where the DE0 flow algorithm is now the default

Location:
trunk/anuga_core
Files:
28 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/anuga/__init__.py

    r9726 r9733  
    2121#-----------------------------------------------------
    2222
    23 __version__ = '1.3.11'
     23__version__ = '2.0'
    2424
    2525__svn_revision__ = filter(str.isdigit, "$Revision$")
  • trunk/anuga_core/anuga/abstract_2d_finite_volumes/tests/test_gauge.py

    r9551 r9733  
    114114
    115115#        point1_answers_array = [[0.0,1.0,-5.0,3.0,4.0], [2.0,10.0,-5.0,3.0,4.0]]
    116         point1_answers_array = [[0.0,0.0,1.0,6.0,-5.0,3.0,4.0], [2.0,2.0/3600.,10.0,15.0,-5.0,3.0,4.0]]
     116#        point1_answers_array = [[0.0,0.0,1.0,6.0,-5.0,3.0,4.0], [2.0,2.0/3600.,10.0,15.0,-5.0,3.0,4.0]]
     117        point1_answers_array = [[0.0, 0.0, 1.0, 4.0, -3.0, 3.0, 4.0],  [2.0, 0.0005555555555555556, 10.0, 13.0, -3.0, 3.0, 4.0]]
    117118        point1_filename = 'gauge_point1.csv'
    118119        point1_handle = open(point1_filename)
     
    128129            assert num.allclose(line[i], point1_answers_array[i])
    129130
    130         point2_answers_array = [[0.0,0.0,1.0,1.5,-0.5,3.0,4.0], [2.0,2.0/3600.,10.0,10.5,-0.5,3.0,4.0]]
     131        #point2_answers_array = [[0.0,0.0,1.0,1.5,-0.5,3.0,4.0], [2.0,2.0/3600.,10.0,10.5,-0.5,3.0,4.0]]
     132
     133        point2_answers_array = [[0.0, 0.0, 1.0, 3.416666666666667, -2.416666666666667, 3.0, 4.0], [2.0, 0.0005555555555555556, 10.000000000000002, 12.416666666666668, -2.416666666666667, 3.0, 4.0] ]       
     134
     135
     136
    131137        point2_filename = 'gauge_point2.csv'
    132138        point2_handle = open(point2_filename)
     
    186192                            verbose=False)
    187193
    188         point1_answers_array = [[0.0,1.0,-5.0], [2.0,10.0,-5.0]]
     194        point1_answers_array = [[0.0, 1.0, -3.0], [2.0, 10.0, -3.0]]
    189195        point1_filename = 'gauge_point1.csv'
    190196        point1_handle = file(point1_filename)
     
    200206            assert num.allclose(line[i], point1_answers_array[i])
    201207
    202         point2_answers_array = [[0.0,1.0,-0.5], [2.0,10.0,-0.5]]
     208        point2_answers_array = [ [0.0, 1.0, -2.416666666666667], [2.0, 10.000000000000002, -2.416666666666667] ]
    203209        point2_filename = 'gauge_point2.csv'
    204210        point2_handle = file(point2_filename)
     
    211217            # note the 'hole' (element 1) below - skip the new 'hours' field
    212218            line.append([float(row[0]),float(row[2]),float(row[3])])
    213 #            print 'line',line[i],'point1',point1_answers_array[i]
     219            # print 'line',line[i],'point1',point1_answers_array[i]
    214220            assert num.allclose(line[i], point2_answers_array[i])
    215221                         
     
    256262
    257263#        point1_answers_array = [[0.0,1.0,-5.0,3.0,4.0], [2.0,10.0,-5.0,3.0,4.0]]
    258         point1_answers_array = [[2.0,2.0/3600.,1.0,6.0,-5.0,3.0,4.0], [3.0,3.0/3600.,10.0,15.0,-5.0,3.0,4.0]]
     264        point1_answers_array = [[2.0, 0.0005555555555555556, 1.0, 4.0, -3.0, 3.0, 4.0], [3.0, 0.0008333333333333334, 10.0, 13.0, -3.0, 3.0, 4.0] ]
    259265        point1_filename = 'gauge_point1.csv'
    260266        point1_handle = file(point1_filename)
     
    270276            assert num.allclose(line[i], point1_answers_array[i])
    271277
    272         point2_answers_array = [[2.0,2.0/3600.,1.0,1.5,-0.5,3.0,4.0], [3.0,3.0/3600.,10.0,10.5,-0.5,3.0,4.0]]
     278        point2_answers_array = [[2.0, 0.0005555555555555556, 1.0, 3.416666666666667, -2.416666666666667, 3.0, 4.0], [3.0, 0.0008333333333333334, 10.000000000000002, 12.416666666666668, -2.416666666666667, 3.0, 4.0]]
    273279        point2_filename = 'gauge_point2.csv'
    274280        point2_handle = file(point2_filename)
     
    372378                       output_centroids=True)
    373379
    374         point1_answers_array = [[0.0,0.0,1.0,3.0,-2.0,3.0,4.0], [2.0,2.0/3600.,10.0,12.0,-2.0,3.0,4.0]]
     380        #point1_answers_array = [[0.0,0.0,1.0,3.0,-2.0,3.0,4.0], [2.0,2.0/3600.,10.0,12.0,-2.0,3.0,4.0]]
     381        point1_answers_array = [[0.0, 0.0, 1.0, 3.6666666666666665, -2.6666666666666665, 3.0, 4.0], [2.0, 0.0005555555555555556, 10.0, 12.666666666666666, -2.6666666666666665, 3.0, 4.0]]       
    375382        point1_filename = 'gauge_point1.csv'
    376383        point1_handle = open(point1_filename)
     
    382389            line.append([float(row[0]),float(row[1]),float(row[2]),float(row[3]),
    383390                         float(row[4]),float(row[5]),float(row[6])])
    384 #           print 'assert line',line[i],'point1',point1_answers_array[i]
     391            #print 'assert line',line[i],'point1',point1_answers_array[i]
    385392            assert num.allclose(line[i], point1_answers_array[i])
    386393
    387         point2_answers_array = [[0.0,0.0,1.0,5.0,-4.0,3.0,4.0], [2.0,2.0/3600.,10.0,14.0,-4.0,3.0,4.0]]
     394        #point2_answers_array = [[0.0,0.0,1.0,5.0,-4.0,3.0,4.0], [2.0,2.0/3600.,10.0,14.0,-4.0,3.0,4.0]]
     395        point2_answers_array = [ [0.0, 0.0, 1.0, 4.333333333333333, -3.333333333333333, 3.0, 4.0], [2.0, 0.0005555555555555556, 10.0, 13.333333333333332, -3.333333333333333, 3.0, 4.0] ]       
    388396        point2_filename = 'gauge_point2.csv'
    389397        point2_handle = open(point2_filename)
     
    395403            line.append([float(row[0]),float(row[1]),float(row[2]),float(row[3]),
    396404                         float(row[4]),float(row[5]),float(row[6])])
    397 #           print i, 'assert line',line[i],'point2',point2_answers_array[i]
     405            #print i, 'assert line',line[i],'point2',point2_answers_array[i]
    398406            assert num.allclose(line[i], point2_answers_array[i])
    399407                         
     
    492500        point1_answers_array = [[0.0,1.0,-5.0], [2.0,10.0,-5.0],[4.0,10.0,-5.0],
    493501                                [6.0,20.0,-5.0], [0.0,1.0,-5.0]]
     502
     503        point1_answers_array = [[0.0, 1.0, -3.0], [2.0, 10.0, -3.0],
     504                               [4.0, 10.0, -3.0], [6.0, 20.0, -3.0]]
     505
    494506        point1_filename = 'gauge_point1.csv'
    495507        point1_handle = file(point1_filename)
     
    506518            assert num.allclose(line[i], point1_answers_array[i])
    507519
    508         point2_answers_array = [[0.0,1.0,-0.5], [2.0,10.0,-0.5],[4.0,10.0,-0.5],
    509                                 [6.0,20.0,-0.5], [0.0,1.0,-0.5]]
     520        #point2_answers_array = [[0.0,1.0,-0.5], [2.0,10.0,-0.5],[4.0,10.0,-0.5],
     521        #                        [6.0,20.0,-0.5], [0.0,1.0,-0.5]]
     522        point2_answers_array = [[0.0, 1.0, -2.416666666666667],
     523                                [2.0, 10.000000000000002, -2.416666666666667],
     524                                [4.0, 10.000000000000002, -2.416666666666667],
     525                                [6.0, 20.000000000000004, -2.416666666666667]]
     526
     527
     528
     529           
    510530        point2_filename = 'gauge_point2.csv'
    511531        point2_handle = file(point2_filename)
     
    517537            # note the 'hole' (element 1) below - skip the new 'hours' field
    518538            line.append([float(row[0]),float(row[2]),float(row[3])])
    519             #print 'line',line[i],'point2',point2_answers_array[i]
     539            #print 'line',line[i],'point2'#,point2_answers_array[i]
    520540            assert num.allclose(line[i], point2_answers_array[i])
    521541                         
  • trunk/anuga_core/anuga/config.py

    r9697 r9733  
    122122
    123123#flow_algorithm = '1_0'    # 1st order euler and conservative piecewise constant spatial reconstruction
    124 flow_algorithm = '1_5'  # 1st order euler and conservative piecewise linear spatial reconstruction
     124#flow_algorithm = '1_5'  # 1st order euler and conservative piecewise linear spatial reconstruction
    125125#flow_algorithm = '1_75' # 1st order euler and more aggressive piecewise linear spatial reconstruction
    126126#flow_algorithm = '2_0'    # 2nd order TVD scheme and more aggressive piecewise linear spatial reconstruction
    127127#flow_algorithm = '2.5'  # 3rd order TVD scheme and more aggressive piecewise linear spatial reconstruction
    128128#flow_algorithm = 'tsunami' # 2nd order space and time, well balanced inc at wet-dry fronts, porosity-type alg
    129 #flow_algorithm = 'DE0' # 1st order time 2nd order space, discontinuous elevation, well balanced + better shallow flows than 'tsunami'
     129flow_algorithm = 'DE0' # 1st order time 2nd order space, discontinuous elevation, well balanced + better shallow flows than 'tsunami'
    130130#flow_algorithm = 'DE1' # 2nd order space and time, discontinuous elevation, well balanced + better shallow flows than 'tsunami'
    131131
  • trunk/anuga_core/anuga/damage_modelling/tests/test_inundation_damage.py

    r9562 r9733  
    2020
    2121import numpy as num
    22 
     22from pprint import pprint
    2323
    2424def elevation_function(x, y):
     
    311311        #print "struct_loss",struct_loss
    312312        struct_loss = [float(x) for x in struct_loss]
    313         assert num.allclose(struct_loss,[10,150,16.9,0])
     313        assert num.allclose(struct_loss, [10.0, 150.0, 66.553333478768664, 0.0])
    314314        depth = csv_handle.get_column(EventDamageModel.MAX_DEPTH_TITLE)
    315315        #print "depth",depth
    316316        depth = [float(x) for x in depth]
    317         assert num.allclose(depth,[5.5,4.5,0.1,-0.3])
     317        assert num.allclose(depth,[3.00000001192092, 2.9166666785875957, 2.2666666785875957, -0.3])
    318318        os.remove(sww.filename)
    319319        os.remove(csv_file)
     
    398398        #print "struct_loss",struct_loss
    399399        struct_loss = [float(x) for x in struct_loss]
    400         assert num.allclose(struct_loss,[10,150,16.9,0])       
     400        #pprint(struct_loss)
     401        assert num.allclose(struct_loss,[10.0, 150.0, 66.55333347876866, 0.0])       
    401402        depth = csv_handle.get_column(EventDamageModel.MAX_DEPTH_TITLE)
    402403        #print "depth",depth
    403404        depth = [float(x) for x in depth]
    404         assert num.allclose(depth,[5.5,4.5,0.1,-0.3])
     405        assert num.allclose(depth, [3.000000011920929, 2.9166666785875957, 2.2666666785875957, -0.3])
    405406       
    406407        # Test another file
     
    409410        #print "struct_loss",struct_loss
    410411        struct_loss = [float(x) for x in struct_loss]
    411         assert num.allclose(struct_loss,[10,150,16.9,0])       
     412
     413        #pprint(struct_loss)
     414        assert num.allclose(struct_loss, [10.0, 150.0, 66.553333478768664, 0.0])       
    412415        depth = csv_handle.get_column(EventDamageModel.MAX_DEPTH_TITLE)
    413416        #print "depth",depth
    414417        depth = [float(x) for x in depth]
    415         assert num.allclose(depth,[5.5,4.5,0.1,-0.3])
     418        assert num.allclose(depth,[3.000000011920929, 2.9166666785875957, 2.2666666785875957, -0.3])
    416419        os.remove(sww.filename)
    417420        os.remove(csv_file)
  • trunk/anuga_core/anuga/file_conversion/tests/test_2pts.py

    r9550 r9733  
    1919from anuga.file_conversion.sww2pts import sww2pts
    2020
     21from pprint import pprint
    2122
    2223class Test_2Pts(unittest.TestCase):
     
    227228                data_points = points,
    228229                NODATA_value = NODATA_value)
    229         ref_point_values = [-0.5, -0.5, -1, -1, -1, -1, -1.5, -1.5]   #At centroids
    230 
    231        
     230        #ref_point_values = [-0.5, -0.5, -1, -1, -1, -1, -1.5, -1.5]   #At centroids
     231
     232        ref_point_values = [-0.72222223, -0.72222223, -1.00000002, -1.00000002,
     233                            -1.00000002, -1.00000002, -1.27777779, -1.27777779]
    232234        point_values = Geospatial_data(ptsfile).get_attributes()
    233235        #print 'P', point_values
  • trunk/anuga_core/anuga/file_conversion/tests/test_sww2dem.py

    r9562 r9733  
    2323from anuga.file_conversion.sww2dem import sww2dem, sww2dem_batch
    2424
     25from pprint import pprint
     26
    2527class Test_Sww2Dem(unittest.TestCase):
    2628    def setUp(self):
     
    9597
    9698        self.domain.set_datadir('.')
     99        self.domain.set_flow_algorithm('1_5')
    97100        self.domain.format = 'sww'
    98101        self.domain.smooth = True
     
    274277
    275278
    276 
    277     def test_sww2dem_larger(self):
     279    def test_sww2dem_larger_de0(self):
    278280        """Test that sww information can be converted correctly to asc/prj
    279281        format readable by e.g. ArcView. Here:
     
    308310        domain.default_order = 2
    309311
    310         domain.set_name('datatest')
     312        domain.set_name('datatest_de0')
    311313
    312314        prjfile = domain.get_name() + '_elevation.prj'
     
    319321        domain.geo_reference = Geo_reference(56, 308500, 6189000)
    320322
     323
     324        # FIXME: de0 algorithm doesn't recreate a linear function!
     325        domain.set_quantity('elevation', lambda x,y: -x-y)
     326        domain.set_quantity('stage', 0)
     327
     328        B = Transmissive_boundary(domain)
     329        domain.set_boundary( {'left': B, 'right': B, 'top': B, 'bottom': B})
     330
     331        #
     332        sww = SWW_file(domain)
     333        sww.store_connectivity()
     334        sww.store_timestep()
     335       
     336        domain.tight_slope_limiters = 1
     337        domain.evolve_to_end(finaltime = 0.01)
     338        sww.store_timestep()
     339
     340        cellsize = 10.0  #10m grid
     341
     342       
     343        #Export to ascii/prj files
     344        sww2dem(domain.get_name() + '.sww',
     345                domain.get_name() + '_elevation.asc',
     346                quantity = 'elevation',
     347                cellsize = cellsize,
     348                number_of_decimal_places = 3,
     349                verbose = self.verbose,
     350                block_size=2)
     351
     352
     353        #Check prj (meta data)
     354        prjid = open(prjfile)
     355        lines = prjid.readlines()
     356        prjid.close()
     357
     358        L = lines[0].strip().split()
     359        assert L[0].strip().lower() == 'projection'
     360        assert L[1].strip().lower() == 'utm'
     361
     362        L = lines[1].strip().split()
     363        assert L[0].strip().lower() == 'zone'
     364        assert L[1].strip().lower() == '56'
     365
     366        L = lines[2].strip().split()
     367        assert L[0].strip().lower() == 'datum'
     368        assert L[1].strip().lower() == 'wgs84'
     369
     370        L = lines[3].strip().split()
     371        assert L[0].strip().lower() == 'zunits'
     372        assert L[1].strip().lower() == 'no'
     373
     374        L = lines[4].strip().split()
     375        assert L[0].strip().lower() == 'units'
     376        assert L[1].strip().lower() == 'meters'
     377
     378        L = lines[5].strip().split()
     379        assert L[0].strip().lower() == 'spheroid'
     380        assert L[1].strip().lower() == 'wgs84'
     381
     382        L = lines[6].strip().split()
     383        assert L[0].strip().lower() == 'xshift'
     384        assert L[1].strip().lower() == '500000'
     385
     386        L = lines[7].strip().split()
     387        assert L[0].strip().lower() == 'yshift'
     388        assert L[1].strip().lower() == '10000000'
     389
     390        L = lines[8].strip().split()
     391        assert L[0].strip().lower() == 'parameters'
     392
     393
     394        #Check asc file
     395        ascid = open(ascfile)
     396        lines = ascid.readlines()
     397        ascid.close()
     398
     399        L = lines[0].strip().split()
     400        assert L[0].strip().lower() == 'ncols'
     401        assert L[1].strip().lower() == '11'
     402
     403        L = lines[1].strip().split()
     404        assert L[0].strip().lower() == 'nrows'
     405        assert L[1].strip().lower() == '11'
     406
     407        L = lines[2].strip().split()
     408        assert L[0].strip().lower() == 'xllcorner'
     409        assert num.allclose(float(L[1].strip().lower()), 308500)
     410
     411        L = lines[3].strip().split()
     412        assert L[0].strip().lower() == 'yllcorner'
     413        assert num.allclose(float(L[1].strip().lower()), 6189000)
     414
     415        L = lines[4].strip().split()
     416        assert L[0].strip().lower() == 'cellsize'
     417        assert num.allclose(float(L[1].strip().lower()), cellsize)
     418
     419        L = lines[5].strip().split()
     420        assert L[0].strip() == 'NODATA_value'
     421        assert L[1].strip().lower() == '-9999'
     422
     423        #Check grid values (FIXME: Use same strategy for other sww2dem tests)
     424
     425        V = [-1.000e+02, -1.067e+02, -1.133e+02, -1.200e+02, -1.267e+02, -1.333e+02, -1.367e+02, -1.400e+02, -1.433e+02, -1.467e+02, -1.500e+02,
     426             -9.333e+01, -1.000e+02, -1.067e+02, -1.133e+02, -1.200e+02, -1.267e+02, -1.300e+02, -1.333e+02, -1.367e+02, -1.400e+02, -1.467e+02,
     427             -8.667e+01, -9.333e+01, -1.000e+02, -1.067e+02, -1.133e+02, -1.200e+02, -1.233e+02, -1.267e+02, -1.300e+02, -1.367e+02, -1.433e+02,
     428             -8.000e+01, -8.667e+01, -9.333e+01, -1.000e+02, -1.067e+02, -1.133e+02, -1.167e+02, -1.200e+02, -1.267e+02, -1.333e+02, -1.400e+02,
     429             -7.333e+01, -8.000e+01, -8.667e+01, -9.333e+01, -1.000e+02, -1.067e+02, -1.100e+02, -1.167e+02, -1.233e+02, -1.300e+02, -1.367e+02,
     430             -6.667e+01, -7.333e+01, -8.000e+01, -8.667e+01, -9.333e+01, -1.000e+02, -1.067e+02, -1.133e+02, -1.200e+02, -1.267e+02, -1.333e+02,
     431             -6.333e+01, -7.000e+01, -7.667e+01, -8.333e+01, -9.000e+01, -9.333e+01, -1.000e+02, -1.067e+02, -1.133e+02, -1.200e+02, -1.267e+02,
     432             -6.000e+01, -6.667e+01, -7.333e+01, -8.000e+01, -8.333e+01, -8.667e+01, -9.333e+01, -1.000e+02, -1.067e+02, -1.133e+02, -1.200e+02,
     433             -5.667e+01, -6.333e+01, -7.000e+01, -7.333e+01, -7.667e+01, -8.000e+01, -8.667e+01, -9.333e+01, -1.000e+02, -1.067e+02, -1.133e+02,
     434             -5.333e+01, -6.000e+01, -6.333e+01, -6.667e+01, -7.000e+01, -7.333e+01, -8.000e+01, -8.667e+01, -9.333e+01, -1.000e+02, -1.067e+02,
     435             -5.000e+01, -5.333e+01, -5.667e+01, -6.000e+01, -6.333e+01, -6.667e+01, -7.333e+01, -8.000e+01, -8.667e+01, -9.333e+01, -1.000e+02 ]   
     436       
     437        for i, line in enumerate(lines[6:]):
     438            for j, value in enumerate( line.split() ):
     439                assert num.allclose(float(value), V[i*11+j],
     440                                    atol=1.0e-12, rtol=1.0e-12)
     441
     442                # Note: Equality can be obtained in this case,
     443                # but it is better to use allclose.
     444                #assert float(value) == -(10-i+j)*cellsize
     445
     446
     447        #fid.close()
     448
     449        #Cleanup
     450        #os.remove(prjfile)
     451        #os.remove(ascfile)
     452        #os.remove(swwfile)
     453       
     454
     455    def test_sww2dem_larger_1_5(self):
     456        """Test that sww information can be converted correctly to asc/prj
     457        format readable by e.g. ArcView. Here:
     458
     459        ncols         11
     460        nrows         11
     461        xllcorner     308500
     462        yllcorner     6189000
     463        cellsize      10.000000
     464        NODATA_value  -9999
     465        -100 -110 -120 -130 -140 -150 -160 -170 -180 -190 -200
     466         -90 -100 -110 -120 -130 -140 -150 -160 -170 -180 -190
     467         -80  -90 -100 -110 -120 -130 -140 -150 -160 -170 -180
     468         -70  -80  -90 -100 -110 -120 -130 -140 -150 -160 -170
     469         -60  -70  -80  -90 -100 -110 -120 -130 -140 -150 -160
     470         -50  -60  -70  -80  -90 -100 -110 -120 -130 -140 -150
     471         -40  -50  -60  -70  -80  -90 -100 -110 -120 -130 -140
     472         -30  -40  -50  -60  -70  -80  -90 -100 -110 -120 -130
     473         -20  -30  -40  -50  -60  -70  -80  -90 -100 -110 -120
     474         -10  -20  -30  -40  -50  -60  -70  -80  -90 -100 -110
     475           0  -10  -20  -30  -40  -50  -60  -70  -80  -90 -100
     476
     477        """
     478
     479        import time, os
     480
     481        #Create basic mesh (100m x 100m)
     482        points, vertices, boundary = rectangular(2, 2, 100, 100)
     483
     484        #Create shallow water domain
     485        domain = Domain(points, vertices, boundary)
     486        domain.set_flow_algorithm('1_5')
     487        domain.default_order = 2
     488
     489        domain.set_name('datatest_1_5')
     490
     491        prjfile = domain.get_name() + '_elevation.prj'
     492        ascfile = domain.get_name() + '_elevation.asc'
     493        swwfile = domain.get_name() + '.sww'
     494
     495        domain.set_datadir('.')
     496        domain.format = 'sww'
     497        domain.smooth = True
     498        domain.geo_reference = Geo_reference(56, 308500, 6189000)
     499
    321500        #
    322501        domain.set_quantity('elevation', lambda x,y: -x-y)
     
    338517        cellsize = 10  #10m grid
    339518
    340 
    341         #Check contents
    342         #Get NetCDF
    343 
    344         fid = NetCDFFile(sww.filename, netcdf_mode_r)
    345 
    346         # Get the variables
    347         x = fid.variables['x'][:]
    348         y = fid.variables['y'][:]
    349         z = fid.variables['elevation'][:]
    350         time = fid.variables['time'][:]
    351         stage = fid.variables['stage'][:]
    352519
    353520
     
    443610
    444611
    445         fid.close()
    446 
    447612        #Cleanup
    448         os.remove(prjfile)
    449         os.remove(ascfile)
    450         os.remove(swwfile)
     613        #os.remove(prjfile)
     614        #os.remove(ascfile)
     615        #os.remove(swwfile)
    451616
    452617
     
    668833        #Create shallow water domain
    669834        domain = Domain(points, vertices, boundary)
    670         domain.default_order = 2
     835        domain.set_flow_algorithm('1_5')
    671836
    672837        domain.set_name('datatest')
     
    11591324        #Create shallow water domain
    11601325        domain = Domain(points, vertices)
     1326        domain.set_flow_algorithm('1_5')
    11611327        domain.default_order=2
    11621328
     
    12851451
    12861452
    1287     def test_sww2ers_simple(self):
     1453    def test_sww2ers_simple_1_5(self):
    12881454        """Test that sww information can be converted correctly to ers
    12891455        format
     
    12971463        #Setup
    12981464        self.domain.set_name('datatest')
     1465        self.domain.set_flow_algorithm('1_5')
    12991466
    13001467        headerfile = self.domain.get_name() + '.ers'
     
    13631530
    13641531
     1532
    13651533        ref_grid = [-1,    -1.25, -1.5,  -1.75, -2.0,
    13661534                    -0.75, -1.0,  -1.25, -1.5,  -1.75,
     
    13701538
    13711539
    1372         #print grid.reshape((5,5))
     1540       
     1541        #pprint(grid)
    13731542        assert num.allclose(grid, ref_grid)
    13741543
     
    13811550        os.remove(self.domain.get_name() + '_elevation')
    13821551        os.remove(self.domain.get_name() + '_elevation.ers')
     1552 
     1553 
     1554    def test_sww2ers_simple_de0(self):
     1555        """Test that sww information can be converted correctly to ers
     1556        format
     1557        """
     1558
     1559        import time, os
     1560
     1561
     1562        NODATA_value = 1758323
     1563
     1564        #Setup
     1565        self.domain.set_name('datatest')
     1566
     1567        headerfile = self.domain.get_name() + '.ers'
     1568        swwfile = self.domain.get_name() + '.sww'
     1569
     1570        self.domain.set_datadir('.')
     1571        self.domain.format = 'sww'
     1572        self.domain.smooth = True
     1573        self.domain.set_quantity('elevation', lambda x,y: -x-y)
     1574
     1575        self.domain.geo_reference = Geo_reference(56,308500,6189000)
     1576
     1577        sww = SWW_file(self.domain)
     1578        sww.store_connectivity()
     1579        sww.store_timestep()
     1580
     1581        #self.domain.tight_slope_limiters = 1
     1582        self.domain.evolve_to_end(finaltime = 0.01)
     1583        sww.store_timestep()
     1584
     1585        cellsize = 0.25
     1586        #Check contents
     1587        #Get NetCDF
     1588
     1589        fid = NetCDFFile(sww.filename, netcdf_mode_r)
     1590
     1591        # Get the variables
     1592        x = fid.variables['x'][:]
     1593        y = fid.variables['y'][:]
     1594        z = fid.variables['elevation'][:]
     1595        time = fid.variables['time'][:]
     1596        stage = fid.variables['stage'][:]
     1597
     1598
     1599        #Export to ers files
     1600        outname = self.domain.get_name() + '_elevation.ers'
     1601        sww2dem(self.domain.get_name() + '.sww',
     1602                outname,
     1603                quantity = 'elevation',
     1604                cellsize = cellsize,
     1605                number_of_decimal_places = 9,
     1606                NODATA_value = NODATA_value,
     1607                verbose = self.verbose)
     1608
     1609        #Check header data
     1610        from anuga.abstract_2d_finite_volumes.ermapper_grids import read_ermapper_header, read_ermapper_data
     1611
     1612        header = read_ermapper_header(outname)
     1613
     1614        assert header['projection'].lower() == '"utm-56"'
     1615        assert header['datum'].lower() == '"wgs84"'
     1616        assert header['units'].lower() == '"meters"'
     1617        assert header['value'].lower() == '"elevation"'
     1618        assert header['xdimension'] == '0.25'
     1619        assert header['ydimension'] == '0.25'
     1620        assert float(header['eastings']) == 308500.0   #xllcorner
     1621        assert float(header['northings']) == 6189000.0 #yllcorner
     1622        assert int(header['nroflines']) == 5
     1623        assert int(header['nrofcellsperline']) == 5
     1624        assert int(header['nullcellvalue']) == NODATA_value
     1625        #FIXME - there is more in the header
     1626
     1627
     1628        #Check grid data
     1629        grid = read_ermapper_data(self.domain.get_name() + '_elevation')
     1630
     1631
     1632        ref_grid = [-1.        , -1.08333325, -1.16666663, -1.33333325, -1.5       ,
     1633                    -0.91666663, -1.        , -1.08333325, -1.25      , -1.33333325,
     1634                    -0.83333331, -0.91666663, -1.        , -1.08333325, -1.16666663,
     1635                    -0.66666663, -0.75      , -0.91666663, -1.        , -1.08333325,
     1636                    -0.5       , -0.66666663, -0.83333331, -0.91666663, -1.        ],
     1637
    13831638       
     1639        #pprint(grid)
     1640       
     1641        assert num.allclose(grid, ref_grid)
     1642
     1643        fid.close()
     1644
     1645        #Cleanup
     1646        #FIXME the file clean-up doesn't work (eg Permission Denied Error)
     1647        #Done (Ole) - it was because sww2ers didn't close it's sww file
     1648        os.remove(sww.filename)
     1649        os.remove(self.domain.get_name() + '_elevation')
     1650        os.remove(self.domain.get_name() + '_elevation.ers')
     1651       
    13841652    def test_export_grid_parallel(self):
    13851653        """Test that sww information can be converted correctly to asc/prj
     
    13951663
    13961664        self.domain.set_datadir('.')
     1665        self.domain.set_flow_algorithm('1_5')
    13971666        self.domain.format = 'sww'
    13981667        self.domain.smooth = True
     
    15321801
    15331802        self.domain.set_datadir('.')
     1803        self.domain.set_flow_algorithm('1_5')
    15341804        self.domain.smooth = True
    15351805        self.domain.set_quantity('elevation', lambda x,y: -x-y)
     
    16131883
    16141884        self.domain.set_datadir('.')
     1885        self.domain.set_flow_algorithm('1_5')
    16151886        self.domain.smooth = True
    16161887        self.domain.set_quantity('elevation', lambda x,y: -x-y)
     
    17492020
    17502021        self.domain.set_datadir('.')
     2022        self.domain.set_flow_algorithm('1_5')
    17512023        self.domain.format = 'sww'
    17522024        self.domain.smooth = True
  • trunk/anuga_core/anuga/fit_interpolate/tests/test_interpolate.py

    r9562 r9733  
    3131from anuga.pmesh.mesh import Mesh
    3232from anuga.file.netcdf import NetCDFFile
     33
     34from pprint import pprint
    3335
    3436def distance(x, y):
     
    17951797        # Create shallow water domain
    17961798        domain = Domain(mesh_file)
     1799        domain.set_flow_algorithm('1_5')
    17971800        os.remove(mesh_file)
    17981801       
  • trunk/anuga_core/anuga/operators/tests/test_erosion_operators.py

    r9445 r9733  
    1515from anuga.operators.erosion_operators import Erosion_operator
    1616
     17from pprint import pprint
     18
    1719import numpy as num
    1820import warnings
     
    3032
    3133
    32     def test_erosion_operator_simple(self):
     34    def test_erosion_operator_simple_1_5(self):
    3335        from anuga.config import rho_a, rho_w, eta_w
    3436        from math import pi, cos, sin
     
    4648
    4749        domain = Domain(points, vertices)
    48 
     50        domain.set_flow_algorithm('1_5')
     51       
    4952        #Flat surface with 1m of water
    5053        domain.set_quantity('elevation', 0.5)
     
    98101        assert num.allclose(domain.quantities['xmomentum'].centroid_values, 2.0)
    99102        assert num.allclose(domain.quantities['ymomentum'].centroid_values, 3.0)
     103
     104
     105    def test_erosion_operator_simple_de0(self):
     106        from anuga.config import rho_a, rho_w, eta_w
     107        from math import pi, cos, sin
     108
     109        a = [0.0, 0.0]
     110        b = [0.0, 2.0]
     111        c = [2.0, 0.0]
     112        d = [0.0, 4.0]
     113        e = [2.0, 2.0]
     114        f = [4.0, 0.0]
     115
     116        points = [a, b, c, d, e, f]
     117        #             bac,     bce,     ecf,     dbe
     118        vertices = [[1,0,2], [1,2,4], [4,2,5], [3,1,4]]
     119
     120        domain = Domain(points, vertices)
     121
     122        #Flat surface with 1m of water
     123        domain.set_quantity('elevation', 0.5)
     124        domain.set_quantity('stage', 1.0)
     125        domain.set_quantity('friction', 0)
     126        domain.set_quantity('xmomentum',2.0)
     127        domain.set_quantity('ymomentum',3.0)
     128
     129        Stage = domain.quantities['stage'].centroid_values
     130        Elevation = domain.quantities['elevation'].centroid_values
     131
     132        Height = Stage - Elevation
     133
     134        sum1 = num.sum(Height)
     135
     136        Br = Reflective_boundary(domain)
     137        domain.set_boundary({'exterior': Br})
     138
     139
     140#        print domain.quantities['stage'].centroid_values
     141#        print domain.quantities['xmomentum'].centroid_values
     142#        print domain.quantities['ymomentum'].centroid_values
     143
     144        # Apply operator to these triangles
     145        indices = [0,1,3]
     146
     147
     148        operator = Erosion_operator(domain, indices=indices, logging=True)
     149
     150        # Apply Operator
     151        domain.timestep = 2.0
     152        operator()
     153
     154        elev_ex  = [ 0. ,  0. ,  0.5,  0. ]
     155        stage_ex = [ 0.5,  0.5,  1. ,  0.5]
     156
     157
     158
     159       
     160        Stage = domain.quantities['stage'].centroid_values
     161        Elevation = domain.quantities['elevation'].centroid_values
     162
     163        Height = Stage - Elevation
     164
     165        sum2 = num.sum(Height)
     166       
     167        #pprint( domain.quantities['elevation'].centroid_values )
     168        #pprint( domain.quantities['stage'].centroid_values )
     169        #print domain.quantities['xmomentum'].centroid_values
     170        #print domain.quantities['ymomentum'].centroid_values
     171
     172        assert sum1 == sum2
     173        assert num.allclose(domain.quantities['stage'].centroid_values, stage_ex)
     174        assert num.allclose(domain.quantities['xmomentum'].centroid_values, 2.0)
     175        assert num.allclose(domain.quantities['ymomentum'].centroid_values, 3.0)       
    100176
    101177
  • trunk/anuga_core/anuga/operators/tests/test_kinematic_viscosity_operator.py

    r9487 r9733  
    55from anuga.operators.kinematic_viscosity_operator import Kinematic_viscosity_operator
    66
     7from pprint import pprint
    78import numpy as num
    89from math import sqrt
     
    800801        assert num.allclose(vh.centroid_values, v.centroid_values*h.centroid_values )
    801802
    802     def test_kinematic_operator_default(self):
     803    def test_kinematic_operator_default_1_5(self):
    803804
    804805        from anuga import rectangular_cross_domain
     
    809810        domain = rectangular_cross_domain(m1,n1)
    810811
    811         #domain.set_flow_algorithm('2_0')
     812        domain.set_flow_algorithm('1_5')
    812813
    813814        #
     
    939940        assert num.allclose(w.centroid_values, wc, rtol=2.0e-3)
    940941
     942
     943    def test_kinematic_operator_default(self):
     944
     945        from anuga import rectangular_cross_domain
     946        from anuga import Reflective_boundary
     947
     948        m1 = 10
     949        n1 = 10
     950        domain = rectangular_cross_domain(m1,n1)
     951
     952        #
     953        domain.set_quantity('elevation', expression='x')
     954        domain.set_quantity('friction', 0.03)
     955        domain.set_quantity('stage',expression='elevation + 2*(x-0.5)')
     956        domain.set_quantity('xmomentum', expression='2*x+3*y')
     957        domain.set_quantity('ymomentum', expression='5*x+7*y')
     958
     959        B = Reflective_boundary(domain)
     960        domain.set_boundary( {'left': B, 'right': B, 'top': B, 'bottom': B})
     961
     962        # kill off the wave with viscosity
     963        kv = Kinematic_viscosity_operator(domain)
     964
     965
     966        # let's make timestep large so that the final solution will look like
     967        #the solution of hte elliptic problem. In this case u -> 1, v -> 2.
     968
     969
     970        for t in domain.evolve(yieldstep = 1.0, finaltime = 10.0):
     971            #domain.write_time()
     972            #domain.print_operator_timestepping_statistics()
     973            pass
     974
     975#
     976        w  = domain.quantities['stage']
     977        uh = domain.quantities['xmomentum']
     978        vh = domain.quantities['ymomentum']
     979
     980
     981        #pprint(w.centroid_values)
     982
     983
     984        wc = [ 0.70708499,  0.70708621,  0.70708739,  0.70708592,  0.70708113,
     985        0.70708436,  0.70708375,  0.70708134,  0.70707501,  0.70707913,
     986        0.70707721,  0.70707394,  0.70706646,  0.70707106,  0.7070687 ,
     987        0.70706476,  0.70705719,  0.70706151,  0.70705891,  0.70705455,
     988        0.70704706,  0.70705106,  0.70704916,  0.70704428,  0.70703703,
     989        0.70704066,  0.70703903,  0.7070339 ,  0.70702799,  0.70703089,
     990        0.7070303 ,  0.70702564,  0.70702151,  0.70702355,  0.70702397,
     991        0.70702031,  0.70701839,  0.70701905,  0.70702107,  0.7070194 ,
     992        0.70709027,  0.70709487,  0.70709941,  0.70709437,  0.70708654,
     993        0.70709293,  0.70709501,  0.70708947,  0.70707992,  0.70708703,
     994        0.70708836,  0.70708163,  0.70707074,  0.70707825,  0.70707864,
     995        0.70707138,  0.70706083,  0.70706806,  0.70706835,  0.70706081,
     996        0.70705083,  0.707057  ,  0.70705712,  0.70704999,  0.70704048,
     997        0.70704607,  0.70704625,  0.70703935,  0.70703156,  0.70703616,
     998        0.70703718,  0.70703054,  0.70702507,  0.70702802,  0.70703008,
     999        0.70702449,  0.70702214,  0.70702318,  0.7070272 ,  0.7070235 ,
     1000        0.70710676,  0.70711548,  0.70712417,  0.70711463,  0.70710228,
     1001        0.70711276,  0.70711859,  0.7071085 ,  0.70709499,  0.70710565,
     1002        0.70710958,  0.70709958,  0.70708503,  0.70709598,  0.70709863,
     1003        0.70708794,  0.70707407,  0.70708442,  0.70708659,  0.70707544,
     1004        0.70706157,  0.70707155,  0.70707373,  0.70706302,  0.70705048,
     1005        0.70705952,  0.70706168,  0.70705157,  0.70704142,  0.70704862,
     1006        0.70705162,  0.70704216,  0.70703415,  0.70703963,  0.70704439,
     1007        0.70703587,  0.70703088,  0.70703425,  0.70704138,  0.70703513,
     1008        0.70713645,  0.70714954,  0.70716232,  0.70714793,  0.70713056,
     1009        0.70714553,  0.70715518,  0.70713986,  0.70712065,  0.70713624,
     1010        0.70714367,  0.70712812,  0.70710867,  0.70712372,  0.70712926,
     1011        0.70711412,  0.70709613,  0.70710986,  0.70711457,  0.70709938,
     1012        0.70708183,  0.70709482,  0.70709942,  0.70708498,  0.70706838,
     1013        0.70708094,  0.70708603,  0.70707212,  0.7070582 ,  0.7070688 ,
     1014        0.70707538,  0.70706281,  0.70705122,  0.7070608 ,  0.7070685 ,
     1015        0.70705631,  0.70704792,  0.70705483,  0.70706486,  0.70705531,
     1016        0.70718   ,  0.70719823,  0.70721617,  0.70719615,  0.7071729 ,
     1017        0.70719352,  0.70720804,  0.70718662,  0.70716074,  0.70718253,
     1018        0.70719468,  0.70717278,  0.70714572,  0.70716734,  0.70717659,
     1019        0.70715531,  0.7071299 ,  0.70714964,  0.70715813,  0.70713672,
     1020        0.70711249,  0.70713105,  0.70713951,  0.70711991,  0.70709744,
     1021        0.70711495,  0.70712439,  0.70710586,  0.70708626,  0.70710178,
     1022        0.70711248,  0.70709512,  0.70707906,  0.70709283,  0.70710466,
     1023        0.70708817,  0.70707441,  0.70708663,  0.70710054,  0.70708614,
     1024        0.70724108,  0.70726706,  0.70729195,  0.70726351,  0.70723292,
     1025        0.70726031,  0.7072815 ,  0.70725218,  0.70721887,  0.7072471 ,
     1026        0.70726445,  0.70723489,  0.70719979,  0.70722813,  0.70724321,
     1027        0.70721483,  0.70718005,  0.7072073 ,  0.70721893,  0.70719146,
     1028        0.70715956,  0.7071841 ,  0.70719678,  0.70717142,  0.70714207,
     1029        0.7071646 ,  0.70717743,  0.70715424,  0.70712796,  0.70714878,
     1030        0.70716287,  0.70714105,  0.70711978,  0.70713804,  0.70715526,
     1031        0.70713402,  0.70711483,  0.7071321 ,  0.70715154,  0.70713215,
     1032        0.70732504,  0.7073667 ,  0.70742884,  0.70736225,  0.70731461,
     1033        0.70735815,  0.70741174,  0.70734535,  0.70729534,  0.7073381 ,
     1034        0.70738346,  0.70732086,  0.70727156,  0.70731057,  0.70734823,
     1035        0.7072925 ,  0.70724546,  0.70728082,  0.70731384,  0.7072646 ,
     1036        0.7072214 ,  0.70725274,  0.70728508,  0.7072405 ,  0.70720083,
     1037        0.70722955,  0.70726458,  0.70722164,  0.70718575,  0.70721333,
     1038        0.70725167,  0.70720856,  0.70717715,  0.70720336,  0.70724394,
     1039        0.7072014 ,  0.70717247,  0.70719816,  0.70724117,  0.70719918,
     1040        0.71675646,  0.75004659,  0.78337382,  0.75004739,  0.71675772,
     1041        0.75004786,  0.78337446,  0.75004804,  0.71675836,  0.75004825,
     1042        0.78337474,  0.75004834,  0.71675882,  0.75004847,  0.7833749 ,
     1043        0.75004855,  0.71675951,  0.75004875,  0.78337515,  0.75004887,
     1044        0.71676052,  0.75004917,  0.78337553,  0.75004932,  0.71676144,
     1045        0.7500496 ,  0.78337589,  0.75004969,  0.71676167,  0.75004975,
     1046        0.78337597,  0.75004976,  0.71676168,  0.75004975,  0.78337596,
     1047        0.75004977,  0.71676169,  0.75004982,  0.78337604,  0.75004916,
     1048        0.81671751,  0.85002885,  0.88335646,  0.85002953,  0.81671814,
     1049        0.85002995,  0.8833571 ,  0.85003018,  0.8167184 ,  0.85003028,
     1050        0.88335726,  0.85003035,  0.81671855,  0.85003041,  0.88335736,
     1051        0.85003048,  0.81671876,  0.85003058,  0.8833575 ,  0.8500307 ,
     1052        0.81671909,  0.85003088,  0.88335777,  0.85003104,  0.81671941,
     1053        0.85003122,  0.88335804,  0.85003131,  0.81671948,  0.85003133,
     1054        0.88335807,  0.85003133,  0.81671948,  0.85003132,  0.88335805,
     1055        0.85003132,  0.81671948,  0.85003132,  0.88335804,  0.85003083,
     1056        0.91669795,  0.95000946,  0.98333814,  0.95001028,  0.91669869,
     1057        0.95001047,  0.98333839,  0.95001059,  0.91669887,  0.95001062,
     1058        0.98333842,  0.95001065,  0.91669897,  0.95001067,  0.98333845,
     1059        0.95001071,  0.91669912,  0.95001074,  0.98333849,  0.95001081,
     1060        0.91669939,  0.95001087,  0.98333857,  0.95001098,  0.91669968,
     1061        0.95001106,  0.98333868,  0.95001112,  0.91669971,  0.95001111,
     1062        0.98333867,  0.9500111 ,  0.91669969,  0.9500111 ,  0.98333867,
     1063        0.9500111 ,  0.91669964,  0.9500111 ,  0.98333867,  0.95001047]
     1064
     1065
     1066        assert num.allclose(w.centroid_values, wc, rtol=2.0e-3)
     1067
     1068       
    9411069    def test_kinematic_operator_quantity(self):
    9421070
     
    12641392        #print uh.boundary_values
    12651393
    1266         #print 'w'
    1267         #print w.centroid_values
    1268 
    1269         #from pprint import pprint
     1394
    12701395        #pprint(w.centroid_values)
    12711396
    12721397
    1273         wc = num.array([
    1274         0.70714365,  0.70714416,  0.70714295,  0.70714222,  0.70714486,
    1275         0.70714507,  0.70714374,  0.70714601,  0.70714492,  0.70714425,
    1276         0.70714595,  0.70714437,  0.70714797,  0.70714691,  0.70714697,
    1277         0.70714845,  0.70714793,  0.70714793,  0.70715033,  0.70714852,
    1278         0.70715244,  0.70715018,  0.70715176,  0.70715224,  0.70715211,
    1279         0.70715265,  0.70715351,  0.7071531 ,  0.70715433,  0.70715309,
    1280         0.70715351,  0.70715472,  0.70715429,  0.70715433,  0.70715487,
    1281         0.70715523,  0.7071545 ,  0.70715446,  0.70715317,  0.70715564,
    1282         0.70714142,  0.70714198,  0.70714079,  0.70714299,  0.70714482,
    1283         0.70714378,  0.70714344,  0.70714377,  0.7071443 ,  0.70714533,
    1284         0.70714579,  0.70714574,  0.70714906,  0.70714717,  0.70714819,
    1285         0.70714822,  0.70714976,  0.70714952,  0.70715093,  0.70715077,
    1286         0.70715217,  0.70715094,  0.70715291,  0.70715188,  0.70715352,
    1287         0.70715278,  0.707154  ,  0.70715429,  0.70715376,  0.70715309,
    1288         0.70715446,  0.70715422,  0.70715366,  0.70715453,  0.70715413,
    1289         0.70715539,  0.70715385,  0.70715412,  0.70715154,  0.70715306,
    1290         0.70714038,  0.70713905,  0.7071358 ,  0.70713972,  0.70714303,
    1291         0.7071419 ,  0.70714066,  0.70714219,  0.7071459 ,  0.70714505,
    1292         0.70714639,  0.70714648,  0.70714833,  0.70714827,  0.70715147,
    1293         0.70715013,  0.70715194,  0.70715133,  0.70715542,  0.70715345,
    1294         0.70715296,  0.70715417,  0.70715676,  0.70715521,  0.70715526,
    1295         0.7071548 ,  0.70715717,  0.70715512,  0.70715381,  0.70715523,
    1296         0.70715556,  0.70715486,  0.70715482,  0.70715338,  0.70715307,
    1297         0.70715381,  0.70715132,  0.70715182,  0.70714789,  0.70715086,
    1298         0.70713443,  0.70713559,  0.70713539,  0.70713615,  0.70714057,
    1299         0.70713978,  0.70714091,  0.70714102,  0.70714618,  0.70714338,
    1300         0.70714803,  0.70714858,  0.7071519 ,  0.70715029,  0.70715343,
    1301         0.70715461,  0.70715589,  0.70715519,  0.7071565 ,  0.70715796,
    1302         0.70715738,  0.70715845,  0.7071601 ,  0.70715829,  0.70715711,
    1303         0.70715903,  0.70716011,  0.70715714,  0.7071565 ,  0.70715756,
    1304         0.70715885,  0.7071556 ,  0.70715386,  0.70715406,  0.70715653,
    1305         0.70715532,  0.70714813,  0.7071515 ,  0.70715242,  0.70715269,
    1306         0.70713191,  0.70712961,  0.70712505,  0.70712841,  0.70714097,
    1307         0.70713808,  0.70713862,  0.7071431 ,  0.70714966,  0.7071463 ,
    1308         0.70715775,  0.70715666,  0.70715566,  0.7071554 ,  0.7071632 ,
    1309         0.70716353,  0.70715928,  0.70716244,  0.70716736,  0.70716495,
    1310         0.70716301,  0.70716635,  0.70717088,  0.70716792,  0.70716369,
    1311         0.70717007,  0.7071741 ,  0.70716769,  0.70716166,  0.70716991,
    1312         0.70717294,  0.70716167,  0.70715775,  0.70716057,  0.70715687,
    1313         0.70715535,  0.70715014,  0.70714766,  0.70714559,  0.70714992,
    1314         0.7071149 ,  0.70708741,  0.706984  ,  0.70711096,  0.70714367,
    1315         0.70714831,  0.70713519,  0.7071811 ,  0.70716622,  0.70716603,
    1316         0.70714155,  0.7071748 ,  0.70716885,  0.70716897,  0.70713548,
    1317         0.70716966,  0.70716924,  0.70716978,  0.70713561,  0.7071717 ,
    1318         0.70717389,  0.7071726 ,  0.70713926,  0.70717593,  0.70718002,
    1319         0.70717761,  0.70714428,  0.70718053,  0.70718062,  0.70718719,
    1320         0.70715731,  0.70718271,  0.70716238,  0.7071992 ,  0.70715496,
    1321         0.70716834,  0.70713531,  0.70713099,  0.70700665,  0.7071098 ,
    1322         0.70634397,  0.70524618,  0.70297607,  0.70514658,  0.70658259,
    1323         0.70506628,  0.70244401,  0.70497884,  0.70657086,  0.70498266,
    1324         0.70239779,  0.70496243,  0.7065572 ,  0.7049646 ,  0.70239608,
    1325         0.70496008,  0.70655538,  0.70496125,  0.70239685,  0.70496177,
    1326         0.70655883,  0.70496295,  0.70239957,  0.70496624,  0.70656625,
    1327         0.70496724,  0.70240482,  0.7049756 ,  0.70658803,  0.70497608,
    1328         0.70241139,  0.70500006,  0.70660425,  0.70499778,  0.70246225,
    1329         0.70508764,  0.70636798,  0.70516922,  0.70299639,  0.70526838,
    1330         0.71780931,  0.7506157 ,  0.78399529,  0.75061024,  0.71769206,
    1331         0.75059929,  0.78398287,  0.75059279,  0.71768281,  0.75059112,
    1332         0.78397863,  0.75059025,  0.71768261,  0.75058996,  0.78397777,
    1333         0.75058981,  0.71768268,  0.75058969,  0.78397749,  0.75058967,
    1334         0.7176832 ,  0.75058972,  0.78397772,  0.75058986,  0.71768421,
    1335         0.7505901 ,  0.78397859,  0.75059043,  0.71768534,  0.7505909 ,
    1336         0.78398028,  0.750592  ,  0.71769545,  0.75059388,  0.78398545,
    1337         0.75060056,  0.71781337,  0.75061163,  0.78399848,  0.75061714,
    1338         0.81739069,  0.85076296,  0.8841241 ,  0.85076174,  0.81738381,
    1339         0.85075988,  0.88412183,  0.85075808,  0.81738087,  0.85075718,
    1340         0.88412031,  0.85075635,  0.81737996,  0.85075599,  0.88411952,
    1341         0.85075563,  0.81737963,  0.85075548,  0.88411919,  0.8507555 ,
    1342         0.81738003,  0.85075569,  0.88411972,  0.85075629,  0.81738134,
    1343         0.85075692,  0.88412133,  0.85075812,  0.81738361,  0.85075914,
    1344         0.88412387,  0.85076103,  0.81738807,  0.85076269,  0.88412739,
    1345         0.85076547,  0.81739598,  0.85076786,  0.88413107,  0.85076949,
    1346         0.91748914,  0.95083916,  0.98417801,  0.95083906,  0.91748809,
    1347         0.95083882,  0.98417779,  0.95083863,  0.91748731,  0.95083843,
    1348         0.98417752,  0.9508382 ,  0.91748674,  0.950838  ,  0.9841771 ,
    1349         0.95083776,  0.91748646,  0.95083764,  0.98417686,  0.95083771,
    1350         0.91748702,  0.95083794,  0.98417744,  0.95083859,  0.91748864,
    1351         0.95083927,  0.98417906,  0.95084046,  0.91749107,  0.95084145,
    1352         0.98418138,  0.95084291,  0.91749397,  0.95084401,  0.98418384,
    1353         0.95084538,  0.91749653,  0.95084626,  0.98418563,  0.95084686])
    1354 
    1355 
    1356         #print max(w.centroid_values - wc)
     1398        wc = [ 0.70708499,  0.70708621,  0.70708739,  0.70708592,  0.70708113,
     1399        0.70708436,  0.70708375,  0.70708134,  0.70707501,  0.70707913,
     1400        0.70707721,  0.70707394,  0.70706646,  0.70707106,  0.7070687 ,
     1401        0.70706476,  0.70705719,  0.70706151,  0.70705891,  0.70705455,
     1402        0.70704706,  0.70705106,  0.70704916,  0.70704428,  0.70703703,
     1403        0.70704066,  0.70703903,  0.7070339 ,  0.70702799,  0.70703089,
     1404        0.7070303 ,  0.70702564,  0.70702151,  0.70702355,  0.70702397,
     1405        0.70702031,  0.70701839,  0.70701905,  0.70702107,  0.7070194 ,
     1406        0.70709027,  0.70709487,  0.70709941,  0.70709437,  0.70708654,
     1407        0.70709293,  0.70709501,  0.70708947,  0.70707992,  0.70708703,
     1408        0.70708836,  0.70708163,  0.70707074,  0.70707825,  0.70707864,
     1409        0.70707138,  0.70706083,  0.70706806,  0.70706835,  0.70706081,
     1410        0.70705083,  0.707057  ,  0.70705712,  0.70704999,  0.70704048,
     1411        0.70704607,  0.70704625,  0.70703935,  0.70703156,  0.70703616,
     1412        0.70703718,  0.70703054,  0.70702507,  0.70702802,  0.70703008,
     1413        0.70702449,  0.70702214,  0.70702318,  0.7070272 ,  0.7070235 ,
     1414        0.70710676,  0.70711548,  0.70712417,  0.70711463,  0.70710228,
     1415        0.70711276,  0.70711859,  0.7071085 ,  0.70709499,  0.70710565,
     1416        0.70710958,  0.70709958,  0.70708503,  0.70709598,  0.70709863,
     1417        0.70708794,  0.70707407,  0.70708442,  0.70708659,  0.70707544,
     1418        0.70706157,  0.70707155,  0.70707373,  0.70706302,  0.70705048,
     1419        0.70705952,  0.70706168,  0.70705157,  0.70704142,  0.70704862,
     1420        0.70705162,  0.70704216,  0.70703415,  0.70703963,  0.70704439,
     1421        0.70703587,  0.70703088,  0.70703425,  0.70704138,  0.70703513,
     1422        0.70713645,  0.70714954,  0.70716232,  0.70714793,  0.70713056,
     1423        0.70714553,  0.70715518,  0.70713986,  0.70712065,  0.70713624,
     1424        0.70714367,  0.70712812,  0.70710867,  0.70712372,  0.70712926,
     1425        0.70711412,  0.70709613,  0.70710986,  0.70711457,  0.70709938,
     1426        0.70708183,  0.70709482,  0.70709942,  0.70708498,  0.70706838,
     1427        0.70708094,  0.70708603,  0.70707212,  0.7070582 ,  0.7070688 ,
     1428        0.70707538,  0.70706281,  0.70705122,  0.7070608 ,  0.7070685 ,
     1429        0.70705631,  0.70704792,  0.70705483,  0.70706486,  0.70705531,
     1430        0.70718   ,  0.70719823,  0.70721617,  0.70719615,  0.7071729 ,
     1431        0.70719352,  0.70720804,  0.70718662,  0.70716074,  0.70718253,
     1432        0.70719468,  0.70717278,  0.70714572,  0.70716734,  0.70717659,
     1433        0.70715531,  0.7071299 ,  0.70714964,  0.70715813,  0.70713672,
     1434        0.70711249,  0.70713105,  0.70713951,  0.70711991,  0.70709744,
     1435        0.70711495,  0.70712439,  0.70710586,  0.70708626,  0.70710178,
     1436        0.70711248,  0.70709512,  0.70707906,  0.70709283,  0.70710466,
     1437        0.70708817,  0.70707441,  0.70708663,  0.70710054,  0.70708614,
     1438        0.70724108,  0.70726706,  0.70729195,  0.70726351,  0.70723292,
     1439        0.70726031,  0.7072815 ,  0.70725218,  0.70721887,  0.7072471 ,
     1440        0.70726445,  0.70723489,  0.70719979,  0.70722813,  0.70724321,
     1441        0.70721483,  0.70718005,  0.7072073 ,  0.70721893,  0.70719146,
     1442        0.70715956,  0.7071841 ,  0.70719678,  0.70717142,  0.70714207,
     1443        0.7071646 ,  0.70717743,  0.70715424,  0.70712796,  0.70714878,
     1444        0.70716287,  0.70714105,  0.70711978,  0.70713804,  0.70715526,
     1445        0.70713402,  0.70711483,  0.7071321 ,  0.70715154,  0.70713215,
     1446        0.70732504,  0.7073667 ,  0.70742884,  0.70736225,  0.70731461,
     1447        0.70735815,  0.70741174,  0.70734535,  0.70729534,  0.7073381 ,
     1448        0.70738346,  0.70732086,  0.70727156,  0.70731057,  0.70734823,
     1449        0.7072925 ,  0.70724546,  0.70728082,  0.70731384,  0.7072646 ,
     1450        0.7072214 ,  0.70725274,  0.70728508,  0.7072405 ,  0.70720083,
     1451        0.70722955,  0.70726458,  0.70722164,  0.70718575,  0.70721333,
     1452        0.70725167,  0.70720856,  0.70717715,  0.70720336,  0.70724394,
     1453        0.7072014 ,  0.70717247,  0.70719816,  0.70724117,  0.70719918,
     1454        0.71675646,  0.75004659,  0.78337382,  0.75004739,  0.71675772,
     1455        0.75004786,  0.78337446,  0.75004804,  0.71675836,  0.75004825,
     1456        0.78337474,  0.75004834,  0.71675882,  0.75004847,  0.7833749 ,
     1457        0.75004855,  0.71675951,  0.75004875,  0.78337515,  0.75004887,
     1458        0.71676052,  0.75004917,  0.78337553,  0.75004932,  0.71676144,
     1459        0.7500496 ,  0.78337589,  0.75004969,  0.71676167,  0.75004975,
     1460        0.78337597,  0.75004976,  0.71676168,  0.75004975,  0.78337596,
     1461        0.75004977,  0.71676169,  0.75004982,  0.78337604,  0.75004916,
     1462        0.81671751,  0.85002885,  0.88335646,  0.85002953,  0.81671814,
     1463        0.85002995,  0.8833571 ,  0.85003018,  0.8167184 ,  0.85003028,
     1464        0.88335726,  0.85003035,  0.81671855,  0.85003041,  0.88335736,
     1465        0.85003048,  0.81671876,  0.85003058,  0.8833575 ,  0.8500307 ,
     1466        0.81671909,  0.85003088,  0.88335777,  0.85003104,  0.81671941,
     1467        0.85003122,  0.88335804,  0.85003131,  0.81671948,  0.85003133,
     1468        0.88335807,  0.85003133,  0.81671948,  0.85003132,  0.88335805,
     1469        0.85003132,  0.81671948,  0.85003132,  0.88335804,  0.85003083,
     1470        0.91669795,  0.95000946,  0.98333814,  0.95001028,  0.91669869,
     1471        0.95001047,  0.98333839,  0.95001059,  0.91669887,  0.95001062,
     1472        0.98333842,  0.95001065,  0.91669897,  0.95001067,  0.98333845,
     1473        0.95001071,  0.91669912,  0.95001074,  0.98333849,  0.95001081,
     1474        0.91669939,  0.95001087,  0.98333857,  0.95001098,  0.91669968,
     1475        0.95001106,  0.98333868,  0.95001112,  0.91669971,  0.95001111,
     1476        0.98333867,  0.9500111 ,  0.91669969,  0.9500111 ,  0.98333867,
     1477        0.9500111 ,  0.91669964,  0.9500111 ,  0.98333867,  0.95001047]
    13571478
    13581479        assert num.allclose(w.centroid_values, wc, rtol=2.0e-3)
     
    13621483
    13631484if __name__ == "__main__":
    1364     suite = unittest.makeSuite(Test_kinematic_viscosity, 'test')
     1485    suite = unittest.makeSuite(Test_kinematic_viscosity, 'test_')
    13651486    runner = unittest.TextTestRunner()
    13661487    runner.run(suite)
  • trunk/anuga_core/anuga/operators/tests/test_set_elevation_operator.py

    r9551 r9733  
    1515from anuga.operators.set_elevation_operator import *
    1616
     17from pprint import pprint
    1718import numpy as num
    1819import warnings
     
    2930
    3031
    31     def test_set_elevation_operator_simple(self):
     32    def test_set_elevation_operator_simple_1_5(self):
    3233        from anuga.config import rho_a, rho_w, eta_w
    3334        from math import pi, cos, sin
     
    4546
    4647        domain = Domain(points, vertices)
     48        domain.set_flow_algorithm('1_5')
    4749
    4850        #Flat surface with 1m of water
     
    100102        assert num.allclose(domain.quantities['ymomentum'].centroid_values, 0.0)
    101103
    102  
    103     def test_set_elevation_operator_negative(self):
     104
     105    def test_set_elevation_operator_simple_de0(self):
    104106        from anuga.config import rho_a, rho_w, eta_w
    105107        from math import pi, cos, sin
     
    119121
    120122        #Flat surface with 1m of water
    121         domain.set_quantity('elevation', lambda x,y : -2*x)
     123        domain.set_quantity('elevation', 0)
    122124        domain.set_quantity('stage', 1.0)
    123125        domain.set_quantity('friction', 0)
    124126
    125 
    126127        stage_c = domain.quantities['stage'].centroid_values
    127128        elev_c = domain.quantities['elevation'].centroid_values
     
    131132        integral0 = num.sum(height_c)
    132133
    133 
    134134        Br = Reflective_boundary(domain)
    135135        domain.set_boundary({'exterior': Br})
    136136
    137 #        print domain.quantities['elevation'].centroid_values
    138 #        print domain.quantities['stage'].centroid_values
    139 #        print domain.quantities['xmomentum'].centroid_values
    140 #        print domain.quantities['ymomentum'].centroid_values
     137
     138#        pprint( domain.quantities['stage'].centroid_values )
     139#        pprint( domain.quantities['xmomentum'].centroid_values )
     140#        pprint( domain.quantities['ymomentum'].centroid_values )
    141141
    142142        # Apply operator to these triangles
    143143        indices = [0,1,3]
    144144
    145 
    146 
    147         #Catchment_Rain_Polygon = read_polygon(join('CatchmentBdy.csv'))
    148         #rainfall = file_function(join('1y120m.tms'), quantities=['rainfall'])
    149         elev = -5.0
     145        elev = 3.0
    150146
    151147
    152148        operator = Set_elevation_operator(domain, elevation=elev, indices=indices)
    153 
    154 
     149       
    155150        # Apply Operator
    156151        domain.timestep = 2.0
    157152        operator()
    158        
     153
     154
    159155        height_c = stage_c - elev_c
     156
    160157        integral1 = num.sum(height_c)
     158
    161159        assert integral0 == integral1
    162160
    163         elev_ex  = [-4.88888889, -4.77777778, -5.77777778, -4.88888889]
    164         stage_ex = [-2.55555556, -1.11111111,  0.55555556, -2.55555556]
    165 
    166 
    167 #        print domain.quantities['elevation'].centroid_values
    168 #        print domain.quantities['stage'].centroid_values
    169 #        print domain.quantities['xmomentum'].centroid_values
    170 #        print domain.quantities['ymomentum'].centroid_values
    171 
    172         assert num.allclose(domain.quantities['elevation'].centroid_values, elev_ex)
    173         assert num.allclose(domain.quantities['stage'].centroid_values, stage_ex)
    174         assert num.allclose(domain.quantities['xmomentum'].centroid_values, 0.0)
    175         assert num.allclose(domain.quantities['ymomentum'].centroid_values, 0.0)
    176 
    177 
    178     def test_set_elevation_operator_small_function(self):
     161        stage_ex = [ 4.,  4.,  1.,  4.]
     162
     163        elev_ex = [ 3.,  3.,  0.,  3.]
     164       
     165
     166        #pprint( domain.quantities['elevation'].centroid_values )
     167        #pprint( domain.quantities['stage'].centroid_values )
     168        #pprint( domain.quantities['xmomentum'].centroid_values )
     169        #pprint( domain.quantities['ymomentum'].centroid_values )
     170
     171        assert num.allclose(domain.quantities['elevation'].centroid_values, elev_ex)
     172        assert num.allclose(domain.quantities['stage'].centroid_values, stage_ex)
     173        assert num.allclose(domain.quantities['xmomentum'].centroid_values, 0.0)
     174        assert num.allclose(domain.quantities['ymomentum'].centroid_values, 0.0)       
     175
     176 
     177    def test_set_elevation_operator_negative_1_5(self):
    179178        from anuga.config import rho_a, rho_w, eta_w
    180179        from math import pi, cos, sin
     
    187186        f = [4.0, 0.0]
    188187
    189 
    190 
    191 
    192 
    193188        points = [a, b, c, d, e, f]
    194189        #             bac,     bce,     ecf,     dbe
     
    196191
    197192        domain = Domain(points, vertices)
    198 
     193        domain.set_flow_algorithm('1_5')
     194
     195        #Flat surface with 1m of water
     196        domain.set_quantity('elevation', lambda x,y : -2*x)
     197        domain.set_quantity('stage', 1.0)
     198        domain.set_quantity('friction', 0)
     199
     200
     201        stage_c = domain.quantities['stage'].centroid_values
     202        elev_c = domain.quantities['elevation'].centroid_values
     203
     204        height_c = stage_c - elev_c
     205
     206        integral0 = num.sum(height_c)
     207
     208
     209        Br = Reflective_boundary(domain)
     210        domain.set_boundary({'exterior': Br})
     211
     212#        print domain.quantities['elevation'].centroid_values
     213#        print domain.quantities['stage'].centroid_values
     214#        print domain.quantities['xmomentum'].centroid_values
     215#        print domain.quantities['ymomentum'].centroid_values
     216
     217        # Apply operator to these triangles
     218        indices = [0,1,3]
     219
     220
     221
     222        #Catchment_Rain_Polygon = read_polygon(join('CatchmentBdy.csv'))
     223        #rainfall = file_function(join('1y120m.tms'), quantities=['rainfall'])
     224        elev = -5.0
     225
     226
     227        operator = Set_elevation_operator(domain, elevation=elev, indices=indices)
     228
     229
     230        # Apply Operator
     231        domain.timestep = 2.0
     232        operator()
     233       
     234        height_c = stage_c - elev_c
     235        integral1 = num.sum(height_c)
     236        assert integral0 == integral1
     237
     238        elev_ex  = [-4.88888889, -4.77777778, -5.77777778, -4.88888889]
     239        stage_ex = [-2.55555556, -1.11111111,  0.55555556, -2.55555556]
     240
     241
     242#        print domain.quantities['elevation'].centroid_values
     243#        print domain.quantities['stage'].centroid_values
     244#        print domain.quantities['xmomentum'].centroid_values
     245#        print domain.quantities['ymomentum'].centroid_values
     246
     247        assert num.allclose(domain.quantities['elevation'].centroid_values, elev_ex)
     248        assert num.allclose(domain.quantities['stage'].centroid_values, stage_ex)
     249        assert num.allclose(domain.quantities['xmomentum'].centroid_values, 0.0)
     250        assert num.allclose(domain.quantities['ymomentum'].centroid_values, 0.0)
     251
     252
     253    def test_set_elevation_operator_negative_de0(self):
     254        from anuga.config import rho_a, rho_w, eta_w
     255        from math import pi, cos, sin
     256
     257        a = [0.0, 0.0]
     258        b = [0.0, 2.0]
     259        c = [2.0, 0.0]
     260        d = [0.0, 4.0]
     261        e = [2.0, 2.0]
     262        f = [4.0, 0.0]
     263
     264        points = [a, b, c, d, e, f]
     265        #             bac,     bce,     ecf,     dbe
     266        vertices = [[1,0,2], [1,2,4], [4,2,5], [3,1,4]]
     267
     268        domain = Domain(points, vertices)
     269
     270        #Flat surface with 1m of water
     271        domain.set_quantity('elevation', lambda x,y : -2*x)
     272        domain.set_quantity('stage', 1.0)
     273        domain.set_quantity('friction', 0)
     274
     275
     276        stage_c = domain.quantities['stage'].centroid_values
     277        elev_c = domain.quantities['elevation'].centroid_values
     278
     279        height_c = stage_c - elev_c
     280
     281        integral0 = num.sum(height_c)
     282
     283
     284        Br = Reflective_boundary(domain)
     285        domain.set_boundary({'exterior': Br})
     286
     287#        print domain.quantities['elevation'].centroid_values
     288#        print domain.quantities['stage'].centroid_values
     289#        print domain.quantities['xmomentum'].centroid_values
     290#        print domain.quantities['ymomentum'].centroid_values
     291
     292        # Apply operator to these triangles
     293        indices = [0,1,3]
     294
     295
     296
     297        #Catchment_Rain_Polygon = read_polygon(join('CatchmentBdy.csv'))
     298        #rainfall = file_function(join('1y120m.tms'), quantities=['rainfall'])
     299        elev = -5.0
     300
     301
     302        operator = Set_elevation_operator(domain, elevation=elev, indices=indices)
     303
     304
     305        # Apply Operator
     306        domain.timestep = 2.0
     307        operator()
     308       
     309        height_c = stage_c - elev_c
     310        integral1 = num.sum(height_c)
     311        assert integral0 == integral1
     312
     313       
     314        elev_ex = [-5.        , -5.        , -5.33333333, -5.        ]
     315        stage_ex = [-2.66666667, -1.33333333,  1.        , -2.66666667]
     316
     317
     318#        pprint( domain.quantities['elevation'].centroid_values )
     319#        pprint( domain.quantities['stage'].centroid_values )
     320#        pprint( domain.quantities['xmomentum'].centroid_values )
     321#        pprint( domain.quantities['ymomentum'].centroid_values )
     322
     323        assert num.allclose(domain.quantities['elevation'].centroid_values, elev_ex)
     324        assert num.allclose(domain.quantities['stage'].centroid_values, stage_ex)
     325        assert num.allclose(domain.quantities['xmomentum'].centroid_values, 0.0)
     326        assert num.allclose(domain.quantities['ymomentum'].centroid_values, 0.0)       
     327
     328
     329    def test_set_elevation_operator_small_function_1_5(self):
     330        from anuga.config import rho_a, rho_w, eta_w
     331        from math import pi, cos, sin
     332
     333        a = [0.0, 0.0]
     334        b = [0.0, 2.0]
     335        c = [2.0, 0.0]
     336        d = [0.0, 4.0]
     337        e = [2.0, 2.0]
     338        f = [4.0, 0.0]
     339
     340
     341
     342
     343
     344        points = [a, b, c, d, e, f]
     345        #             bac,     bce,     ecf,     dbe
     346        vertices = [[1,0,2], [1,2,4], [4,2,5], [3,1,4]]
     347
     348        domain = Domain(points, vertices)
     349        domain.set_flow_algorithm('1_5')
     350       
    199351        #Flat surface with 1m of water
    200352        domain.set_quantity('elevation', 0.0)
     
    259411
    260412
     413    def test_set_elevation_operator_small_function_de0(self):
     414        from anuga.config import rho_a, rho_w, eta_w
     415        from math import pi, cos, sin
     416
     417        a = [0.0, 0.0]
     418        b = [0.0, 2.0]
     419        c = [2.0, 0.0]
     420        d = [0.0, 4.0]
     421        e = [2.0, 2.0]
     422        f = [4.0, 0.0]
     423
     424
     425
     426
     427
     428        points = [a, b, c, d, e, f]
     429        #             bac,     bce,     ecf,     dbe
     430        vertices = [[1,0,2], [1,2,4], [4,2,5], [3,1,4]]
     431
     432        domain = Domain(points, vertices)
     433
     434        #Flat surface with 1m of water
     435        domain.set_quantity('elevation', 0.0)
     436        domain.set_quantity('stage', 1.0)
     437        domain.set_quantity('friction', 0)
     438
     439        Br = Reflective_boundary(domain)
     440        domain.set_boundary({'exterior': Br})
     441
     442
     443#        print domain.quantities['stage'].centroid_values
     444#        print domain.quantities['xmomentum'].centroid_values
     445#        print domain.quantities['ymomentum'].centroid_values
     446
     447        # Apply operator to these triangles
     448        indices = [0,1,3]
     449
     450
     451        def elev(t):
     452            if t < 10.0:
     453                return 5.0
     454            else:
     455                return 7.0
     456
     457        operator = Set_elevation_operator(domain, elevation=elev, indices=indices)
     458
     459        # Apply Operator at time t=1.0
     460        domain.set_time(1.0)
     461        operator()
     462
     463
     464        elev_ex  = [ 5.,  5.,  0.,  5.]
     465        stage_ex = [ 6.,  6.,  1.,  6.]
     466
     467        #pprint( domain.quantities['elevation'].centroid_values)
     468        #pprint( domain.quantities['stage'].centroid_values)
     469        #pprint( domain.quantities['xmomentum'].centroid_values)
     470        #pprint( domain.quantities['ymomentum'].centroid_values)
     471
     472        assert num.allclose(domain.quantities['elevation'].centroid_values, elev_ex)
     473        assert num.allclose(domain.quantities['stage'].centroid_values, stage_ex)
     474        assert num.allclose(domain.quantities['xmomentum'].centroid_values, 0.0)
     475        assert num.allclose(domain.quantities['ymomentum'].centroid_values, 0.0)
     476
     477        # Apply Operator at time t=15.0
     478        domain.set_time(15.0)
     479        operator()
     480
     481        elev_ex = [ 7.,  7.,  0.,  7.]
     482        stage_ex = [ 8.,  8.,  1.,  8.]
     483
     484        #pprint( domain.quantities['elevation'].centroid_values )
     485        #pprint( domain.quantities['stage'].centroid_values )
     486#        print domain.quantities['xmomentum'].centroid_values
     487#        print domain.quantities['ymomentum'].centroid_values
     488
     489        assert num.allclose(domain.quantities['elevation'].centroid_values, elev_ex)
     490        assert num.allclose(domain.quantities['stage'].centroid_values, stage_ex)
     491        assert num.allclose(domain.quantities['xmomentum'].centroid_values, 0.0)
     492        assert num.allclose(domain.quantities['ymomentum'].centroid_values, 0.0)       
     493
     494
    261495
    262496    def test_set_polygonal_elevation_operator_large_function(self):
     
    305539
    306540
    307         elev_ex = [ 0.        ,  0.        ,  0.41666667,  0.41666667,  0.        ,
    308         0.41666667,  1.25      ,  0.83333333,  0.        ,  0.83333333,
    309         1.25      ,  0.41666667,  0.        ,  0.41666667,  0.41666667,
    310         0.        ,  0.41666667,  0.        ,  0.83333333,  1.25      ,
    311         2.91666667,  2.91666667,  4.16666667,  4.16666667,  2.91666667,
    312         4.16666667,  4.16666667,  2.91666667,  0.41666667,  1.25      ,
    313         0.83333333,  0.        ,  0.83333333,  0.        ,  0.41666667,
    314         1.25      ,  4.16666667,  2.91666667,  2.91666667,  4.16666667,
    315         4.16666667,  4.16666667,  2.91666667,  2.91666667,  0.83333333,
    316         1.25      ,  0.41666667,  0.        ,  0.41666667,  0.        ,
    317         0.        ,  0.41666667,  1.25      ,  0.41666667,  0.        ,
    318         0.83333333,  1.25      ,  0.83333333,  0.        ,  0.41666667,
    319         0.41666667,  0.41666667,  0.        ,  0.        ]
    320 
    321         stage_ex = [ 1.        ,  1.        ,  1.41666667,  1.41666667,  1.        ,
    322         1.41666667,  2.25      ,  1.83333333,  1.        ,  1.83333333,
    323         2.25      ,  1.41666667,  1.        ,  1.41666667,  1.41666667,
    324         1.        ,  1.41666667,  1.        ,  1.83333333,  2.25      ,
    325         3.91666667,  3.91666667,  5.16666667,  5.16666667,  3.91666667,
    326         5.16666667,  5.16666667,  3.91666667,  1.41666667,  2.25      ,
    327         1.83333333,  1.        ,  1.83333333,  1.        ,  1.41666667,
    328         2.25      ,  5.16666667,  3.91666667,  3.91666667,  5.16666667,
    329         5.16666667,  5.16666667,  3.91666667,  3.91666667,  1.83333333,
    330         2.25      ,  1.41666667,  1.        ,  1.41666667,  1.        ,
    331         1.        ,  1.41666667,  2.25      ,  1.41666667,  1.        ,
    332         1.83333333,  2.25      ,  1.83333333,  1.        ,  1.41666667,
    333         1.41666667,  1.41666667,  1.        ,  1.        ]
    334 
    335 
    336 
    337 
    338 
    339 #        from pprint import pprint
     541        elev_ex = [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
     542        0.,  0.,  0.,  0.,  0.,  0.,  0.,  5.,  5.,  5.,  5.,  5.,  5.,
     543        5.,  5.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  5.,  5.,  5.,
     544        5.,  5.,  5.,  5.,  5.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
     545        0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]
     546
     547
     548        stage_ex = [ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
     549        1.,  1.,  1.,  1.,  1.,  1.,  1.,  6.,  6.,  6.,  6.,  6.,  6.,
     550        6.,  6.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  6.,  6.,  6.,
     551        6.,  6.,  6.,  6.,  6.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
     552        1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.]
     553
     554
    340555#        pprint (domain.quantities['elevation'].centroid_values)
    341556#        pprint (domain.quantities['stage'].centroid_values)
     
    355570
    356571
    357         elev_ex = [ 0.        ,  0.        ,  0.89583333,  0.89583333,  0.        ,
    358         0.89583333,  2.47916667,  1.58333333,  0.        ,  1.58333333,
    359         2.47916667,  0.89583333,  0.        ,  0.89583333,  0.89583333,
    360         0.        ,  0.89583333,  0.        ,  1.58333333,  2.47916667,
    361         4.8125    ,  4.8125    ,  6.25      ,  6.25      ,  4.8125    ,
    362         6.25      ,  6.25      ,  4.8125    ,  0.89583333,  2.47916667,
    363         1.58333333,  0.        ,  1.58333333,  0.        ,  0.89583333,
    364         2.47916667,  6.25      ,  4.8125    ,  4.8125    ,  6.25      ,
    365         6.25      ,  6.25      ,  4.8125    ,  4.8125    ,  1.58333333,
    366         2.47916667,  0.89583333,  0.        ,  0.89583333,  0.        ,
    367         0.        ,  0.89583333,  2.47916667,  0.89583333,  0.        ,
    368         1.58333333,  2.47916667,  1.58333333,  0.        ,  0.89583333,
    369         0.89583333,  0.89583333,  0.        ,  0.        ]
    370 
    371         stage_ex = [ 1.        ,  1.        ,  1.89583333,  1.89583333,  1.        ,
    372         1.89583333,  3.47916667,  2.58333333,  1.        ,  2.58333333,
    373         3.47916667,  1.89583333,  1.        ,  1.89583333,  1.89583333,
    374         1.        ,  1.89583333,  1.        ,  2.58333333,  3.47916667,
    375         5.8125    ,  5.8125    ,  7.25      ,  7.25      ,  5.8125    ,
    376         7.25      ,  7.25      ,  5.8125    ,  1.89583333,  3.47916667,
    377         2.58333333,  1.        ,  2.58333333,  1.        ,  1.89583333,
    378         3.47916667,  7.25      ,  5.8125    ,  5.8125    ,  7.25      ,
    379         7.25      ,  7.25      ,  5.8125    ,  5.8125    ,  2.58333333,
    380         3.47916667,  1.89583333,  1.        ,  1.89583333,  1.        ,
    381         1.        ,  1.89583333,  3.47916667,  1.89583333,  1.        ,
    382         2.58333333,  3.47916667,  2.58333333,  1.        ,  1.89583333,
    383         1.89583333,  1.89583333,  1.        ,  1.        ]
    384 
     572        elev_ex = [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
     573        0.,  0.,  0.,  0.,  0.,  0.,  0.,  7.,  7.,  7.,  7.,  7.,  7.,
     574        7.,  7.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  7.,  7.,  7.,
     575        7.,  7.,  7.,  7.,  7.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
     576        0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]
     577
     578
     579
     580        stage_ex = [ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
     581        1.,  1.,  1.,  1.,  1.,  1.,  1.,  8.,  8.,  8.,  8.,  8.,  8.,
     582        8.,  8.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  8.,  8.,  8.,
     583        8.,  8.,  8.,  8.,  8.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
     584        1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.]
     585       
    385586#        pprint (domain.quantities['elevation'].centroid_values)
    386587#        pprint (domain.quantities['stage'].centroid_values)
     
    444645
    445646
    446         elev_ex = [ 0.        ,  0.        ,  0.41666667,  0.41666667,  0.        ,
    447         0.41666667,  1.25      ,  0.83333333,  0.        ,  0.83333333,
    448         1.25      ,  0.41666667,  0.        ,  0.41666667,  0.41666667,
    449         0.        ,  0.41666667,  0.        ,  0.83333333,  1.25      ,
    450         2.91666667,  2.91666667,  4.16666667,  4.16666667,  2.91666667,
    451         4.16666667,  4.16666667,  2.91666667,  0.41666667,  1.25      ,
    452         0.83333333,  0.        ,  0.83333333,  0.        ,  0.41666667,
    453         1.25      ,  4.16666667,  2.91666667,  2.91666667,  4.16666667,
    454         4.16666667,  4.16666667,  2.91666667,  2.91666667,  0.83333333,
    455         1.25      ,  0.41666667,  0.        ,  0.41666667,  0.        ,
    456         0.        ,  0.41666667,  1.25      ,  0.41666667,  0.        ,
    457         0.83333333,  1.25      ,  0.83333333,  0.        ,  0.41666667,
    458         0.41666667,  0.41666667,  0.        ,  0.        ]
    459 
    460         stage_ex = [ 1.        ,  1.        ,  1.41666667,  1.41666667,  1.        ,
    461         1.41666667,  2.25      ,  1.83333333,  1.        ,  1.83333333,
    462         2.25      ,  1.41666667,  1.        ,  1.41666667,  1.41666667,
    463         1.        ,  1.41666667,  1.        ,  1.83333333,  2.25      ,
    464         3.91666667,  3.91666667,  5.16666667,  5.16666667,  3.91666667,
    465         5.16666667,  5.16666667,  3.91666667,  1.41666667,  2.25      ,
    466         1.83333333,  1.        ,  1.83333333,  1.        ,  1.41666667,
    467         2.25      ,  5.16666667,  3.91666667,  3.91666667,  5.16666667,
    468         5.16666667,  5.16666667,  3.91666667,  3.91666667,  1.83333333,
    469         2.25      ,  1.41666667,  1.        ,  1.41666667,  1.        ,
    470         1.        ,  1.41666667,  2.25      ,  1.41666667,  1.        ,
    471         1.83333333,  2.25      ,  1.83333333,  1.        ,  1.41666667,
    472         1.41666667,  1.41666667,  1.        ,  1.        ]
    473 
    474 
    475 
    476 
    477 
    478 #        from pprint import pprint
     647        elev_ex = [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
     648        0.,  0.,  0.,  0.,  0.,  0.,  0.,  5.,  5.,  5.,  5.,  5.,  5.,
     649        5.,  5.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  5.,  5.,  5.,
     650        5.,  5.,  5.,  5.,  5.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
     651        0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]
     652       
     653
     654        stage_ex = [ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
     655        1.,  1.,  1.,  1.,  1.,  1.,  1.,  6.,  6.,  6.,  6.,  6.,  6.,
     656        6.,  6.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  6.,  6.,  6.,
     657        6.,  6.,  6.,  6.,  6.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
     658        1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.]
     659       
     660
    479661#        pprint (domain.quantities['elevation'].centroid_values)
    480662#        pprint (domain.quantities['stage'].centroid_values)
     
    499681
    500682
    501         elev_ex = [ 0.        ,  0.        ,  0.89583333,  0.89583333,  0.        ,
    502         0.89583333,  2.47916667,  1.58333333,  0.        ,  1.58333333,
    503         2.47916667,  0.89583333,  0.        ,  0.89583333,  0.89583333,
    504         0.        ,  0.89583333,  0.        ,  1.58333333,  2.47916667,
    505         4.8125    ,  4.8125    ,  6.25      ,  6.25      ,  4.8125    ,
    506         6.25      ,  6.25      ,  4.8125    ,  0.89583333,  2.47916667,
    507         1.58333333,  0.        ,  1.58333333,  0.        ,  0.89583333,
    508         2.47916667,  6.25      ,  4.8125    ,  4.8125    ,  6.25      ,
    509         6.25      ,  6.25      ,  4.8125    ,  4.8125    ,  1.58333333,
    510         2.47916667,  0.89583333,  0.        ,  0.89583333,  0.        ,
    511         0.        ,  0.89583333,  2.47916667,  0.89583333,  0.        ,
    512         1.58333333,  2.47916667,  1.58333333,  0.        ,  0.89583333,
    513         0.89583333,  0.89583333,  0.        ,  0.        ]
    514 
    515         stage_ex = [ 1.        ,  1.        ,  1.89583333,  1.89583333,  1.        ,
    516         1.89583333,  3.47916667,  2.58333333,  1.        ,  2.58333333,
    517         3.47916667,  1.89583333,  1.        ,  1.89583333,  1.89583333,
    518         1.        ,  1.89583333,  1.        ,  2.58333333,  3.47916667,
    519         5.8125    ,  5.8125    ,  7.25      ,  7.25      ,  5.8125    ,
    520         7.25      ,  7.25      ,  5.8125    ,  1.89583333,  3.47916667,
    521         2.58333333,  1.        ,  2.58333333,  1.        ,  1.89583333,
    522         3.47916667,  7.25      ,  5.8125    ,  5.8125    ,  7.25      ,
    523         7.25      ,  7.25      ,  5.8125    ,  5.8125    ,  2.58333333,
    524         3.47916667,  1.89583333,  1.        ,  1.89583333,  1.        ,
    525         1.        ,  1.89583333,  3.47916667,  1.89583333,  1.        ,
    526         2.58333333,  3.47916667,  2.58333333,  1.        ,  1.89583333,
    527         1.89583333,  1.89583333,  1.        ,  1.        ]
    528 
     683        elev_ex = [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
     684        0.,  0.,  0.,  0.,  0.,  0.,  0.,  7.,  7.,  7.,  7.,  7.,  7.,
     685        7.,  7.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  7.,  7.,  7.,
     686        7.,  7.,  7.,  7.,  7.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
     687        0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]
     688       
     689
     690        stage_ex = [ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
     691        1.,  1.,  1.,  1.,  1.,  1.,  1.,  8.,  8.,  8.,  8.,  8.,  8.,
     692        8.,  8.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  8.,  8.,  8.,
     693        8.,  8.,  8.,  8.,  8.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
     694        1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.]
     695       
     696           
    529697#        pprint (domain.quantities['elevation'].centroid_values)
    530698#        pprint (domain.quantities['stage'].centroid_values)
     
    580748
    581749
     750
     751        elev_ex = [ 0.,  0.,  5.,  5.,  5.,  5.,  5.,  5.,  5.,  5.,  5.,  5.,  0.,
     752        5.,  5.,  0.,  5.,  5.,  5.,  5.,  5.,  5.,  5.,  5.,  5.,  5.,
     753        5.,  5.,  5.,  5.,  5.,  5.,  5.,  5.,  5.,  5.,  5.,  5.,  5.,
     754        5.,  5.,  5.,  5.,  5.,  5.,  5.,  5.,  5.,  5.,  0.,  0.,  5.,
     755        5.,  5.,  5.,  5.,  5.,  5.,  5.,  5.,  5.,  5.,  0.,  0.]
     756
     757       
     758        stage_ex = [ 1.,  1.,  6.,  6.,  6.,  6.,  6.,  6.,  6.,  6.,  6.,  6.,  1.,
     759        6.,  6.,  1.,  6.,  6.,  6.,  6.,  6.,  6.,  6.,  6.,  6.,  6.,
     760        6.,  6.,  6.,  6.,  6.,  6.,  6.,  6.,  6.,  6.,  6.,  6.,  6.,
     761        6.,  6.,  6.,  6.,  6.,  6.,  6.,  6.,  6.,  6.,  1.,  1.,  6.,
     762        6.,  6.,  6.,  6.,  6.,  6.,  6.,  6.,  6.,  6.,  1.,  1.]
     763       
     764
     765
     766#        pprint (domain.quantities['elevation'].centroid_values)
     767#        pprint (domain.quantities['stage'].centroid_values)
     768#        print domain.quantities['xmomentum'].centroid_values
     769#        print domain.quantities['ymomentum'].centroid_values
     770
     771        assert num.allclose(domain.quantities['elevation'].centroid_values, elev_ex)
     772        assert num.allclose(domain.quantities['stage'].centroid_values, stage_ex)
     773        assert num.allclose(domain.quantities['xmomentum'].centroid_values, 0.0)
     774        assert num.allclose(domain.quantities['ymomentum'].centroid_values, 0.0)
     775
     776        # Apply Operator at time t=15.0
     777        domain.set_time(15.0)
     778        operator()
     779
     780
     781
     782
     783        elev_ex = [ 0.,  0.,  7.,  7.,  7.,  7.,  7.,  7.,  7.,  7.,  7.,  7.,  0.,
     784        7.,  7.,  0.,  7.,  7.,  7.,  7.,  7.,  7.,  7.,  7.,  7.,  7.,
     785        7.,  7.,  7.,  7.,  7.,  7.,  7.,  7.,  7.,  7.,  7.,  7.,  7.,
     786        7.,  7.,  7.,  7.,  7.,  7.,  7.,  7.,  7.,  7.,  0.,  0.,  7.,
     787        7.,  7.,  7.,  7.,  7.,  7.,  7.,  7.,  7.,  7.,  0.,  0.]
     788
     789       
     790        stage_ex = [ 1.,  1.,  8.,  8.,  8.,  8.,  8.,  8.,  8.,  8.,  8.,  8.,  1.,
     791        8.,  8.,  1.,  8.,  8.,  8.,  8.,  8.,  8.,  8.,  8.,  8.,  8.,
     792        8.,  8.,  8.,  8.,  8.,  8.,  8.,  8.,  8.,  8.,  8.,  8.,  8.,
     793        8.,  8.,  8.,  8.,  8.,  8.,  8.,  8.,  8.,  8.,  1.,  1.,  8.,
     794        8.,  8.,  8.,  8.,  8.,  8.,  8.,  8.,  8.,  8.,  1.,  1.]
     795       
     796#        pprint (domain.quantities['elevation'].centroid_values)
     797#        pprint (domain.quantities['stage'].centroid_values)
     798#        pprint (domain.quantities['xmomentum'].centroid_values)
     799#        pprint (domain.quantities['ymomentum'].centroid_values)
     800
     801        assert num.allclose(domain.quantities['elevation'].centroid_values, elev_ex)
     802        assert num.allclose(domain.quantities['stage'].centroid_values, stage_ex)
     803        assert num.allclose(domain.quantities['xmomentum'].centroid_values, 0.0)
     804        assert num.allclose(domain.quantities['ymomentum'].centroid_values, 0.0)
     805
     806    def test_set_elevation_operator_center_radius_1_5(self):
     807        from math import pi, cos, sin
     808
     809
     810        length = 2.0
     811        width = 2.0
     812        dx = dy = 0.5
     813        domain = rectangular_cross_domain(int(length/dx), int(width/dy),
     814                                              len1=length, len2=width)
     815
     816
     817        domain.set_flow_algorithm('1_5')
     818        #Flat surface with 1m of water
     819        domain.set_quantity('elevation', 0.0)
     820        domain.set_quantity('stage', 1.0)
     821        domain.set_quantity('friction', 0)
     822
     823        R = Reflective_boundary(domain)
     824        domain.set_boundary( {'left': R, 'right': R, 'bottom': R, 'top': R} )
     825
     826        from pprint import pprint
     827        #pprint(domain.quantities['stage'].centroid_values)
     828#        print domain.quantities['xmomentum'].centroid_values
     829#        print domain.quantities['ymomentum'].centroid_values
     830
     831        # Apply operator to these triangles
     832
     833
     834        def elev(t):
     835            if t < 10.0:
     836                return 5.0
     837            else:
     838                return 7.0
     839
     840        operator = Set_elevation_operator(domain, elevation=elev, center=[1.0,1.0], radius=1.0)
     841
     842        # Apply Operator at time t=1.0
     843        domain.set_time(1.0)
     844        operator()
     845
     846
     847        #pprint(domain.quantities['elevation'].centroid_values)
    582848
    583849        elev_ex = [ 2.08333333,  2.08333333,  3.75      ,  3.75      ,  4.58333333,
     
    598864
    599865
     866        #pprint(domain.quantities['stage'].centroid_values)
     867       
    600868        stage_ex = [ 3.08333333,  3.08333333,  4.75      ,  4.75      ,  5.58333333,
    601869        5.58333333,  6.        ,  6.        ,  5.58333333,  6.        ,
     
    614882
    615883
    616 
    617 
    618884#        from pprint import pprint
    619885#        pprint (domain.quantities['elevation'].centroid_values)
     
    675941        assert num.allclose(domain.quantities['ymomentum'].centroid_values, 0.0)
    676942
    677     def test_set_elevation_operator_center_radius(self):
    678         from math import pi, cos, sin
    679 
    680 
    681         length = 2.0
    682         width = 2.0
    683         dx = dy = 0.5
    684         domain = rectangular_cross_domain(int(length/dx), int(width/dy),
    685                                               len1=length, len2=width)
    686 
    687 
    688         #Flat surface with 1m of water
    689         domain.set_quantity('elevation', 0.0)
    690         domain.set_quantity('stage', 1.0)
    691         domain.set_quantity('friction', 0)
    692 
    693         R = Reflective_boundary(domain)
    694         domain.set_boundary( {'left': R, 'right': R, 'bottom': R, 'top': R} )
    695 
    696         from pprint import pprint
    697         #pprint(domain.quantities['stage'].centroid_values)
    698 #        print domain.quantities['xmomentum'].centroid_values
    699 #        print domain.quantities['ymomentum'].centroid_values
    700 
    701         # Apply operator to these triangles
    702 
    703 
    704         def elev(t):
    705             if t < 10.0:
    706                 return 5.0
    707             else:
    708                 return 7.0
    709 
    710         operator = Set_elevation_operator(domain, elevation=elev, center=[1.0,1.0], radius=1.0)
    711 
    712         # Apply Operator at time t=1.0
    713         domain.set_time(1.0)
    714         operator()
    715 
    716 
    717         #pprint(domain.quantities['elevation'].centroid_values)
    718 
    719         elev_ex = [ 2.08333333,  2.08333333,  3.75      ,  3.75      ,  4.58333333,
    720         4.58333333,  5.        ,  5.        ,  4.58333333,  5.        ,
    721         5.        ,  4.58333333,  2.08333333,  3.75      ,  3.75      ,
    722         2.08333333,  4.58333333,  4.58333333,  5.        ,  5.        ,
    723         5.        ,  5.        ,  5.        ,  5.        ,  5.        ,
    724         5.        ,  5.        ,  5.        ,  4.58333333,  5.        ,
    725         5.        ,  4.58333333,  5.        ,  4.58333333,  4.58333333,
    726         5.        ,  5.        ,  5.        ,  5.        ,  5.        ,
    727         5.        ,  5.        ,  5.        ,  5.        ,  5.        ,
    728         5.        ,  4.58333333,  4.58333333,  3.75      ,  2.08333333,
    729         2.08333333,  3.75      ,  5.        ,  4.58333333,  4.58333333,
    730         5.        ,  5.        ,  5.        ,  4.58333333,  4.58333333,
    731         3.75      ,  3.75      ,  2.08333333,  2.08333333]
    732 
    733 
    734 
    735 
    736         #pprint(domain.quantities['stage'].centroid_values)
    737        
    738         stage_ex = [ 3.08333333,  3.08333333,  4.75      ,  4.75      ,  5.58333333,
    739         5.58333333,  6.        ,  6.        ,  5.58333333,  6.        ,
    740         6.        ,  5.58333333,  3.08333333,  4.75      ,  4.75      ,
    741         3.08333333,  5.58333333,  5.58333333,  6.        ,  6.        ,
    742         6.        ,  6.        ,  6.        ,  6.        ,  6.        ,
    743         6.        ,  6.        ,  6.        ,  5.58333333,  6.        ,
    744         6.        ,  5.58333333,  6.        ,  5.58333333,  5.58333333,
    745         6.        ,  6.        ,  6.        ,  6.        ,  6.        ,
    746         6.        ,  6.        ,  6.        ,  6.        ,  6.        ,
    747         6.        ,  5.58333333,  5.58333333,  4.75      ,  3.08333333,
    748         3.08333333,  4.75      ,  6.        ,  5.58333333,  5.58333333,
    749         6.        ,  6.        ,  6.        ,  5.58333333,  5.58333333,
    750         4.75      ,  4.75      ,  3.08333333,  3.08333333]
    751 
    752 
    753 
    754 #        from pprint import pprint
    755 #        pprint (domain.quantities['elevation'].centroid_values)
    756 #        pprint (domain.quantities['stage'].centroid_values)
    757 #        print domain.quantities['xmomentum'].centroid_values
    758 #        print domain.quantities['ymomentum'].centroid_values
    759 
    760         assert num.allclose(domain.quantities['elevation'].centroid_values, elev_ex)
    761         assert num.allclose(domain.quantities['stage'].centroid_values, stage_ex)
    762         assert num.allclose(domain.quantities['xmomentum'].centroid_values, 0.0)
    763         assert num.allclose(domain.quantities['ymomentum'].centroid_values, 0.0)
    764 
    765         # Apply Operator at time t=15.0
    766         domain.set_time(15.0)
    767         operator()
    768 
    769 
    770 
    771 
    772         elev_ex = [ 3.64583333,  3.64583333,  5.97916667,  5.97916667,  6.72916667,
    773         6.72916667,  7.        ,  7.        ,  6.72916667,  7.        ,
    774         7.        ,  6.72916667,  3.64583333,  5.97916667,  5.97916667,
    775         3.64583333,  6.72916667,  6.72916667,  7.        ,  7.        ,
    776         7.        ,  7.        ,  7.        ,  7.        ,  7.        ,
    777         7.        ,  7.        ,  7.        ,  6.72916667,  7.        ,
    778         7.        ,  6.72916667,  7.        ,  6.72916667,  6.72916667,
    779         7.        ,  7.        ,  7.        ,  7.        ,  7.        ,
    780         7.        ,  7.        ,  7.        ,  7.        ,  7.        ,
    781         7.        ,  6.72916667,  6.72916667,  5.97916667,  3.64583333,
    782         3.64583333,  5.97916667,  7.        ,  6.72916667,  6.72916667,
    783         7.        ,  7.        ,  7.        ,  6.72916667,  6.72916667,
    784         5.97916667,  5.97916667,  3.64583333,  3.64583333]
    785 
    786 
    787         stage_ex = [ 4.64583333,  4.64583333,  6.97916667,  6.97916667,  7.72916667,
    788         7.72916667,  8.        ,  8.        ,  7.72916667,  8.        ,
    789         8.        ,  7.72916667,  4.64583333,  6.97916667,  6.97916667,
    790         4.64583333,  7.72916667,  7.72916667,  8.        ,  8.        ,
    791         8.        ,  8.        ,  8.        ,  8.        ,  8.        ,
    792         8.        ,  8.        ,  8.        ,  7.72916667,  8.        ,
    793         8.        ,  7.72916667,  8.        ,  7.72916667,  7.72916667,
    794         8.        ,  8.        ,  8.        ,  8.        ,  8.        ,
    795         8.        ,  8.        ,  8.        ,  8.        ,  8.        ,
    796         8.        ,  7.72916667,  7.72916667,  6.97916667,  4.64583333,
    797         4.64583333,  6.97916667,  8.        ,  7.72916667,  7.72916667,
    798         8.        ,  8.        ,  8.        ,  7.72916667,  7.72916667,
    799         6.97916667,  6.97916667,  4.64583333,  4.64583333]
    800 
    801 
    802 #        from pprint import pprint
    803 #        pprint (domain.quantities['elevation'].centroid_values)
    804 #        pprint (domain.quantities['stage'].centroid_values)
    805 #        pprint (domain.quantities['xmomentum'].centroid_values)
    806 #        pprint (domain.quantities['ymomentum'].centroid_values)
    807 
    808         assert num.allclose(domain.quantities['elevation'].centroid_values, elev_ex)
    809         assert num.allclose(domain.quantities['stage'].centroid_values, stage_ex)
    810         assert num.allclose(domain.quantities['xmomentum'].centroid_values, 0.0)
    811         assert num.allclose(domain.quantities['ymomentum'].centroid_values, 0.0)
    812 
    813943        operator = Set_elevation(domain, elevation=0.0)
    814944
  • trunk/anuga_core/anuga/shallow_water/shallow_water_domain.py

    r9720 r9733  
    218218                            ghost_layer_width=ghost_layer_width)
    219219
    220         self._set_defaults()
    221 
    222 
     220        #-------------------------------
     221        # Operator Data Structures
     222        #-------------------------------
     223        self.fractional_step_operators = []
     224        self.kv_operator = None
     225
     226
     227
     228        #-------------------------------
     229        # Set flow defaults
     230        #-------------------------------
     231        self.set_flow_algorithm()
     232       
     233       
    223234        #-------------------------------
    224235        # Forcing Terms
     
    228239        #-------------------------------
    229240        self.forcing_terms.append(manning_friction_implicit)
    230 
    231 
    232         #-------------------------------
    233         # Operators
    234         #-------------------------------
    235         self.fractional_step_operators = []
    236         self.kv_operator = None
    237 
    238241       
    239242
     
    242245        #-------------------------------
    243246        self.set_store(True)
    244         self.set_store_centroids(False)
     247        self.set_store_centroids(True)
    245248        self.set_store_vertices_uniquely(False)
    246249        self.quantities_to_be_stored = {'elevation': 1,
     
    324327        self.allow_timestep_increase=num.zeros(1).astype(int)+1
    325328
    326     def _set_defaults(self):
     329    def _set_config_defaults(self):
    327330        """Set the default values in this routine. That way we can inherit class
    328331        and just redefine the defaults for the new class
     
    342345        from anuga.config import distribute_to_vertices_and_edges_method
    343346        from anuga.config import sloped_mannings_function
    344         from anuga.config import flow_algorithm
    345        
     347       
    346348
    347349        # Early algorithms need elevation to remain continuous
     
    369371        self.set_sloped_mannings_function(sloped_mannings_function)
    370372        self.set_compute_fluxes_method(compute_fluxes_method)
    371         self.set_flow_algorithm(flow_algorithm)
    372373
    373374        self.set_distribute_to_vertices_and_edges_method(distribute_to_vertices_and_edges_method)
     375       
     376        self.set_store_centroids(False)
    374377
    375378
     
    400403        parameters['optimised_gradient_limiter']        = self.optimised_gradient_limiter
    401404        parameters['extrapolate_velocity_second_order'] = self.extrapolate_velocity_second_order
     405
     406       
    402407       
    403408        return parameters
     
    421426        """
    422427
     428        self._set_config_defaults()
     429       
    423430        self.set_CFL(1.0)
    424431        #self.set_use_kinematic_viscosity(False)
     
    507514            print '##########################################################################'
    508515
     516    def _set_1_5_defaults(self):
     517        """Set up the defaults for running the flow_algorithm "1_5"
     518           so that users can revert back to old default algorithm
     519        """       
     520
     521        self._set_config_defaults()
     522       
     523        self.set_timestepping_method(1)
     524        self.set_default_order(2)
     525        beta_w      = 1.0
     526        beta_w_dry  = 0.2
     527        beta_uh     = 1.0
     528        beta_uh_dry = 0.2
     529        beta_vh     = 1.0
     530        beta_vh_dry = 0.2
     531        self.set_betas(beta_w, beta_w_dry, beta_uh, beta_uh_dry, beta_vh, beta_vh_dry)
     532        self.set_CFL(1.0)
     533        self.set_compute_fluxes_method('wb_2')
     534        self.set_extrapolate_velocity()
     535
     536    def _set_2_0_defaults(self):
     537        """Set up the defaults for running the flow_algorithm "2_0"
     538           so that users can revert back to old default algorithm
     539        """ 
     540             
     541        self._set_config_defaults()       
     542       
     543        self.set_timestepping_method(2)
     544        self.set_default_order(2)
     545        beta_w      = 1.9
     546        beta_w_dry  = 0.2
     547        beta_uh     = 1.9
     548        beta_uh_dry = 0.2
     549        beta_vh     = 1.9
     550        beta_vh_dry = 0.2
     551        self.set_betas(beta_w, beta_w_dry, beta_uh, beta_uh_dry, beta_vh, beta_vh_dry)
     552        self.set_CFL(1.0)
     553        self.set_compute_fluxes_method('wb_2')
     554        self.set_extrapolate_velocity()
     555
     556    def _set_DE0_defaults(self):
     557        """Set up the defaults for running the flow_algorithm "DE0"
     558           A 'discontinuous elevation' method
     559        """
     560
     561        self._set_config_defaults()       
     562       
     563        self.set_CFL(0.9)
     564        self.set_use_kinematic_viscosity(False)
     565        #self.timestepping_method='rk2'#'rk3'#'euler'#'rk2'
     566        self.set_timestepping_method('euler')
     567       
     568        self.set_using_discontinuous_elevation(True)
     569        self.set_compute_fluxes_method('DE')
     570        self.set_distribute_to_vertices_and_edges_method('DE')
     571       
     572        # Don't place any restriction on the minimum storable height
     573        self.minimum_storable_height=-99999999999.0
     574        self.minimum_allowed_height=1.0e-12
     575
     576        self.use_edge_limiter=True
     577        self.set_default_order(2)
     578        self.set_extrapolate_velocity()
     579       
     580        self.beta_w=0.5
     581        self.beta_w_dry=0.0
     582        self.beta_uh=0.5
     583        self.beta_uh_dry=0.0
     584        self.beta_vh=0.5
     585        self.beta_vh_dry=0.0
     586       
     587
     588        #self.set_quantities_to_be_stored({'stage': 2, 'xmomentum': 2,
     589        #         'ymomentum': 2, 'elevation': 2, 'height':2})
     590        #self.set_quantities_to_be_stored({'stage': 2, 'xmomentum': 2,
     591        #         'ymomentum': 2, 'elevation': 1})
     592        self.set_store_centroids(True)
     593
     594        self.optimise_dry_cells=False
     595
     596        # We need the edge_coordinates for the extrapolation
     597        self.edge_coordinates=self.get_edge_midpoint_coordinates()
     598
     599        # By default vertex values are NOT stored uniquely
     600        # for storage efficiency. We may override this (but not so important since
     601        # centroids are stored anyway
     602        # self.set_store_vertices_smoothly(False)
     603
     604        self.maximum_allowed_speed=0.0
     605
     606        if self.processor == 0 and self.verbose:
     607            print '##########################################################################'
     608            print '#'
     609            print '# Using discontinuous elevation solver DE0'
     610            print '#'
     611            print '# First order timestepping'
     612            print '#'
     613            print '# Make sure you use centroid values when reporting on important output quantities'
     614            print '#'
     615            print '##########################################################################'
     616
     617
    509618    def _set_DE1_defaults(self):
    510619        """Set up the defaults for running the flow_algorithm "DE1"
    511620           A 'discontinuous elevation' method
    512621        """
     622       
     623        self._set_config_defaults()
     624       
    513625        self.set_CFL(1.0)
    514626        self.set_use_kinematic_viscosity(False)
     
    566678            print '##########################################################################'
    567679
    568     def _set_DE0_defaults(self):
    569         """Set up the defaults for running the flow_algorithm "DE0"
    570            A 'discontinuous elevation' method
    571         """
    572         self.set_CFL(0.9)
    573         self.set_use_kinematic_viscosity(False)
    574         #self.timestepping_method='rk2'#'rk3'#'euler'#'rk2'
    575         self.set_timestepping_method('euler')
    576        
    577         self.set_using_discontinuous_elevation(True)
    578         self.set_compute_fluxes_method('DE')
    579         self.set_distribute_to_vertices_and_edges_method('DE')
    580        
    581         # Don't place any restriction on the minimum storable height
    582         self.minimum_storable_height=-99999999999.0
    583         self.minimum_allowed_height=1.0e-12
    584 
    585         self.use_edge_limiter=True
    586         self.set_default_order(2)
    587         self.set_extrapolate_velocity()
    588        
    589         self.beta_w=0.5
    590         self.beta_w_dry=0.0
    591         self.beta_uh=0.5
    592         self.beta_uh_dry=0.0
    593         self.beta_vh=0.5
    594         self.beta_vh_dry=0.0
    595        
    596 
    597         #self.set_quantities_to_be_stored({'stage': 2, 'xmomentum': 2,
    598         #         'ymomentum': 2, 'elevation': 2, 'height':2})
    599         #self.set_quantities_to_be_stored({'stage': 2, 'xmomentum': 2,
    600         #         'ymomentum': 2, 'elevation': 1})
    601         self.set_store_centroids(True)
    602 
    603         self.optimise_dry_cells=False
    604 
    605         # We need the edge_coordinates for the extrapolation
    606         self.edge_coordinates=self.get_edge_midpoint_coordinates()
    607 
    608         # By default vertex values are NOT stored uniquely
    609         # for storage efficiency. We may override this (but not so important since
    610         # centroids are stored anyway
    611         # self.set_store_vertices_smoothly(False)
    612 
    613         self.maximum_allowed_speed=0.0
    614 
    615         if self.processor == 0 and self.verbose:
    616             print '##########################################################################'
    617             print '#'
    618             print '# Using discontinuous elevation solver DE0'
    619             print '#'
    620             print '# First order timestepping'
    621             print '#'
    622             print '# Make sure you use centroid values when reporting on important output quantities'
    623             print '#'
    624             print '##########################################################################'
    625 
    626 
    627680    def _set_DE2_defaults(self):
    628681        """Set up the defaults for running the flow_algorithm "DE2"
    629682           A 'discontinuous elevation' method
    630683        """
     684       
     685        self._set_config_defaults()
     686       
    631687        self.set_CFL(1.0)
    632688        self.set_use_kinematic_viscosity(False)
     
    688744           A 'discontinuous elevation' method
    689745        """
     746       
     747        self._set_config_defaults()
    690748       
    691749        self.set_CFL(0.9)
     
    9421000        return self.using_discontinuous_elevation
    9431001
    944     def set_flow_algorithm(self, flag=1.5):
     1002    def set_flow_algorithm(self, flag='DE0'):
    9451003        """Set combination of slope limiting and time stepping
    9461004
     
    9761034
    9771035        if self.flow_algorithm == '1_0':
     1036           
     1037            self._set_config_defaults()
     1038           
    9781039            self.set_timestepping_method(1)
    9791040            self.set_default_order(1)
     
    9811042
    9821043        if self.flow_algorithm == '1_5':
    983             self.set_timestepping_method(1)
    984             self.set_default_order(2)
    985             beta_w      = 1.0
    986             beta_w_dry  = 0.2
    987             beta_uh     = 1.0
    988             beta_uh_dry = 0.2
    989             beta_vh     = 1.0
    990             beta_vh_dry = 0.2
    991             self.set_betas(beta_w, beta_w_dry, beta_uh, beta_uh_dry, beta_vh, beta_vh_dry)
    992             self.set_CFL(1.0)
    993             self.set_compute_fluxes_method('wb_2')
    994             self.set_extrapolate_velocity()
    995 
    996 
     1044            self._set_1_5_defaults()
    9971045
    9981046        if self.flow_algorithm == '1_75':
     1047           
     1048            self._set_config_defaults()
     1049           
    9991050            self.set_timestepping_method(1)
    10001051            self.set_default_order(2)
     
    10121063
    10131064        if self.flow_algorithm == '2_0_limited':
     1065            self._set_config_defaults()
     1066           
    10141067            self.set_timestepping_method(2)
    10151068            self.set_default_order(2)
     
    10291082
    10301083        if self.flow_algorithm == '2_0':
    1031             self.set_timestepping_method(2)
    1032             self.set_default_order(2)
    1033             beta_w      = 1.9
    1034             beta_w_dry  = 0.2
    1035             beta_uh     = 1.9
    1036             beta_uh_dry = 0.2
    1037             beta_vh     = 1.9
    1038             beta_vh_dry = 0.2
    1039             self.set_betas(beta_w, beta_w_dry, beta_uh, beta_uh_dry, beta_vh, beta_vh_dry)
    1040             self.set_CFL(1.0)
    1041             self.set_compute_fluxes_method('wb_2')
    1042             self.set_extrapolate_velocity()
     1084            self._set_2_0_defaults()
    10431085
    10441086
     
    10541096
    10551097
     1098        if self.flow_algorithm == '2_5':
    10561099           
    1057 
    1058         if self.flow_algorithm == '2_5':
     1100            self._set_config_defaults()
     1101           
    10591102            self.set_timestepping_method(3)
    10601103            self.set_default_order(2)
     
    17391782
    17401783
     1784
    17411785        if self.compute_fluxes_method == 'tsunami':
    17421786
     
    18421886        # Compute edge values by interpolation
    18431887        for name in self.conserved_quantities:
    1844             Q = domain.quantities[name]
     1888            Q = self.quantities[name]
    18451889            Q.interpolate_from_vertices_to_edges()
    18461890
  • trunk/anuga_core/anuga/shallow_water/tests/test_DE1_domain.py

    r9457 r9733  
    5858            return stge
    5959
    60         domain.set_quantity('elevation',topography)     # Use function for elevation
     60        domain.set_quantity('elevation',topography)
    6161        domain.get_quantity('elevation').smooth_vertex_values()
    62         domain.set_quantity('friction',0.03)            # Constant friction
     62        domain.set_quantity('friction',0.03)
    6363
    6464
    65         domain.set_quantity('stage', stagefun)             # Constant negative initial stage
     65        domain.set_quantity('stage', stagefun)
    6666        domain.get_quantity('stage').smooth_vertex_values()
    6767
     
    7070        # Setup boundary conditions
    7171        #--------------------------
    72         Br=anuga.Reflective_boundary(domain)                 # Solid reflective wall
    73         Bd=anuga.Dirichlet_boundary([-0.1*scale_me,0.,0.])   # Constant boundary values -- not used in this example
     72        Br=anuga.Reflective_boundary(domain) # Solid reflective wall
    7473
    7574        #----------------------------------------------
    7675        # Associate boundary tags with boundary objects
    7776        #----------------------------------------------
    78         domain.set_boundary({'left': Br, 'right': Bd, 'top': Br, 'bottom':Br})
     77        domain.set_boundary({'left': Br, 'right': Br, 'top': Br, 'bottom':Br})
    7978
    8079        #------------------------------
  • trunk/anuga_core/anuga/shallow_water/tests/test_data_manager.py

    r9566 r9733  
    8282        # Create shallow water domain
    8383        domain = Domain(points, vertices, boundary)
     84        domain.set_flow_algorithm('1_5')
    8485        domain.default_order = 2
    8586
     
    379380        # Get the variables
    380381        extrema = fid.variables['stage-elevation.extrema'][:]
    381         assert num.allclose(extrema, [0.00, 0.30])
     382        assert num.allclose(extrema, [0.00, 0.30]) or \
     383            num.allclose(extrema, [ 0., 0.3222025])
    382384
    383385        loc = fid.variables['stage-elevation.min_location'][:]
     
    388390
    389391        time = fid.variables['stage-elevation.max_time'][:]
    390         assert num.allclose(time, 0.0)               
     392        assert num.allclose(time, 0.0) or \
     393            num.allclose(time, 0.35077909)             
    391394
    392395        extrema = fid.variables['xmomentum.extrema'][:]
     
    399402            num.allclose(extrema, [-0.06062178, 0.46691909])or \
    400403            num.allclose(extrema, [-0.06062178, 0.47503704]) or \
    401             num.allclose(extrema, [-0.06062178,  0.47518688])
     404            num.allclose(extrema, [-0.06062178,  0.47518688]) or \
     405            num.allclose(extrema, [-0.06062178,  0.49014235])
    402406
    403407
    404408       
    405409        extrema = fid.variables['ymomentum.extrema'][:]
    406         assert num.allclose(extrema,[0.00, 0.0625786]) or num.allclose(extrema,[0.00, 0.06062178])
     410        assert num.allclose(extrema,[0.00, 0.0625786]) or \
     411            num.allclose(extrema,[0.00, 0.06062178])
    407412
    408413        time_interval = fid.variables['extrema.time_interval'][:]
  • trunk/anuga_core/anuga/shallow_water/tests/test_forcing.py

    r9550 r9733  
    19381938
    19391939        domain = Domain(points, vertices)
     1940        domain.set_flow_algorithm('1_5')
    19401941
    19411942        B = Reflective_boundary(domain)
  • trunk/anuga_core/anuga/shallow_water/tests/test_shallow_water_domain.py

    r9590 r9733  
    4141import numpy as num
    4242from anuga.config import g
     43
     44from pprint import pprint
    4345
    4446# Get gateway to C implementation of flux function for direct testing
     
    12171219
    12181220        domain = Domain(points, vertices)
     1221        domain.set_flow_algorithm('1_5')
     1222       
    12191223        val0 = 2. + 2.0/3
    12201224        val1 = 4. + 4.0/3
     
    16051609
    16061610        initial_runup_height = -0.4
    1607         final_runup_height = -0.3
     1611        final_runup_height = -0.0166
    16081612
    16091613        #--------------------------------------------------------------
     
    17041708                    get_values(location='centroids', indices=indices)
    17051709
     1710
    17061711        assert num.alltrue(z < final_runup_height)
    17071712
    17081713        q = domain.get_maximum_inundation_elevation()
     1714       
    17091715        # First order accuracy
    17101716        assert num.allclose(q, final_runup_height, rtol=1.0/N)
     
    20592065
    20602066
    2061 
    2062         """G0 = [-0.20000000000000001,
    2063          -0.20000000000000004,
    2064          -0.20000000000000004,
    2065          -0.19999453835141251,
    2066          -0.19319799751291397,
    2067          -0.17750651562090569,
    2068          -0.16893844755349452,
    2069          -0.16174219622271432,
    2070          -0.15738814562154693,
    2071          -0.15596303365735167,
    2072          -0.16027854500220781,
    2073          -0.17507867843670505,
    2074          -0.19832263662898142,
    2075          -0.19900000000000004,
    2076          -0.19900000000000004,
    2077          -0.19900000000000004,
    2078          -0.19900000000000004,
    2079          -0.19900000000000004,
    2080          -0.19900000000000004,
    2081          -0.19900000000000004,
    2082          -0.19900000000000004,
    2083          -0.19900000000000004,
    2084          -0.19767868682206283,
    2085          -0.19687567124664665,
    2086          -0.19666422310398421,
    2087          -0.19729096593315859,
    2088          -0.19831819935088907,
    2089          -0.19900000000000004,
    2090          -0.19900000000000004,
    2091          -0.19900000000000004,
    2092          -0.19900000000000004,
    2093          -0.19900000000000004,
    2094          -0.19900000000000004,
    2095          -0.19900000000000004,
    2096          -0.19900000000000004,
    2097          -0.19900000000000004,
    2098          -0.19900000000000004,
    2099          -0.19900000000000004,
    2100          -0.19900000000000004,
    2101          -0.19900000000000004,
    2102          -0.19900000000000004,
    2103          -0.19900000000000004,
    2104          -0.19900000000000004,
    2105          -0.19900000000000004,
    2106          -0.19900000000000004,
    2107          -0.19900000000000004,
    2108          -0.19900000000000004,
    2109          -0.19900000000000004,
    2110          -0.19900000000000004,
    2111          -0.19900000000000004,
    2112          -0.19900000000000004]
    2113 
    2114         G1 = [-0.29999999999999993,
    2115          -0.29999999999999993,
    2116          -0.29999999999974741,
    2117          -0.25655184326925784,
    2118          -0.23607365150688375,
    2119          -0.22060470280065439,
    2120          -0.20658478008674655,
    2121          -0.19462986266678681,
    2122          -0.18521738996144282,
    2123          -0.17756121352139798,
    2124          -0.17233749491005507,
    2125          -0.1712956664313367,
    2126          -0.1786597293542449,
    2127          -0.1937585796358344,
    2128          -0.20486593001254461,
    2129          -0.20883092570906642,
    2130          -0.20948598211963404,
    2131          -0.20840918177311216,
    2132          -0.20624642184378159,
    2133          -0.20386992195073114,
    2134          -0.20196200969671524,
    2135          -0.2003680059436023,
    2136          -0.19913895200710305,
    2137          -0.19872505809510066,
    2138          -0.19865049383721478,
    2139          -0.19861940471319109,
    2140          -0.19857910737448811,
    2141          -0.19882738746416151,
    2142          -0.19941164593215152,
    2143          -0.19994979987005621,
    2144          -0.20022621204091368,
    2145          -0.20033273634696372,
    2146          -0.20036220690635007,
    2147          -0.20032201547848974,
    2148          -0.20025054737589318,
    2149          -0.20017566832960457,
    2150          -0.20010462288767275,
    2151          -0.20003871009136917,
    2152          -0.19998743159398452,
    2153          -0.19995576625739447,
    2154          -0.19994040222198753,
    2155          -0.19993749430280855,
    2156          -0.19994832598749798,
    2157          -0.19996540806224108,
    2158          -0.19998392093500064,
    2159          -0.1999955071373305,
    2160          -0.20000281224527261,
    2161          -0.20000724819698293,
    2162          -0.20000935062519012,
    2163          -0.20000950818516791,
    2164          -0.20000810944442041]
    2165 
    2166         G2 = [-0.40000000000000002,
    2167          -0.39999895696346582,
    2168          -0.32568110018727908,
    2169          -0.29907708428553403,
    2170          -0.2786009505303666,
    2171          -0.25987582247319052,
    2172          -0.2428057134814012,
    2173          -0.22792664773510524,
    2174          -0.21397167728054034,
    2175          -0.20118675085997051,
    2176          -0.19045469486976135,
    2177          -0.18180268563472596,
    2178          -0.17632952791678072,
    2179          -0.17727306236851409,
    2180          -0.18722541998822487,
    2181          -0.19688915477765775,
    2182          -0.20203736689010016,
    2183          -0.20407309593437742,
    2184          -0.20486633503759055,
    2185          -0.20473424560999298,
    2186          -0.20412279581913698,
    2187          -0.20301857036748713,
    2188          -0.2017806431678453,
    2189          -0.20068747943008935,
    2190          -0.19992600557153342,
    2191          -0.1995062235981491,
    2192          -0.19926309274823031,
    2193          -0.19903138907525339,
    2194          -0.19895844357121742,
    2195          -0.19911626585912107,
    2196          -0.19958805281888423,
    2197          -0.19992293282077914,
    2198          -0.20007789231281825,
    2199          -0.20015517627005933,
    2200          -0.20018922366231637,
    2201          -0.20018896961934285,
    2202          -0.20015999326878847,
    2203          -0.20012046348746981,
    2204          -0.20008374454150596,
    2205          -0.20004746237736903,
    2206          -0.20001184811224043,
    2207          -0.19998690532737742,
    2208          -0.19997239606855052,
    2209          -0.19996679122539063,
    2210          -0.19997101658812005,
    2211          -0.19997654274614057,
    2212          -0.19998325749054122,
    2213          -0.19998870636735944,
    2214          -0.1999945783201045,
    2215          -0.2000001122979029,
    2216          -0.20000391742733065]
    2217 
    2218         G3 = [-0.45000000000000001,
    2219          -0.38570821631542007,
    2220          -0.33445609854849945,
    2221          -0.31194399537449147,
    2222          -0.29121540920171246,
    2223          -0.27264915058975564,
    2224          -0.25696760292455723,
    2225          -0.24125037490603554,
    2226          -0.22602489518606639,
    2227          -0.21200870424655954,
    2228          -0.19944192935736443,
    2229          -0.1884363642536889,
    2230          -0.17999147022068837,
    2231          -0.17687259909018951,
    2232          -0.18032163923637945,
    2233          -0.19023343819555927,
    2234          -0.19786918193554509,
    2235          -0.20196413165817956,
    2236          -0.20392124528429492,
    2237          -0.20467680867992613,
    2238          -0.20450486624345682,
    2239          -0.20387006704677624,
    2240          -0.20273160306653418,
    2241          -0.20160449898178423,
    2242          -0.20055538624062036,
    2243          -0.1998756424343941,
    2244          -0.19949188004563942,
    2245          -0.19923489555486798,
    2246          -0.19900659614298902,
    2247          -0.19896146023773087,
    2248          -0.19926597384148315,
    2249          -0.19967163193265489,
    2250          -0.19993811205477383,
    2251          -0.20007950765886118,
    2252          -0.20015224748338489,
    2253          -0.20018241326490299,
    2254          -0.200173369910536,
    2255          -0.20015068096987812,
    2256          -0.20011629620386123,
    2257          -0.20008000536128195,
    2258          -0.20004095597836022,
    2259          -0.20000836818672965,
    2260          -0.19998640850712732,
    2261          -0.19997249969767958,
    2262          -0.19996919097058674,
    2263          -0.19997220924620313,
    2264          -0.19997721929322593,
    2265          -0.19998325323373869,
    2266          -0.19998936947290488,
    2267          -0.1999955774924328,
    2268          -0.20000089452320738]"""
    2269 
    2270         # Padarn Note: Had to recapture these values due to
    2271         # discontinous solution across triangles.
    2272 #         G0 = [-0.20000000000000001, -0.20000000000000001, -0.20000000000000001, -0.19999999999999796, -0.19366052942614873, -0.17095089962807258, -0.16160204303319078, -0.15408895029840949, -0.1510979203847328, -0.15133112178196553, -0.15835472765392108, -0.18569659643143716, -0.19908965623736327, -0.19922833709771592, -0.19931557816504925, -0.19932303861837861, -0.19933000708711507, -0.19935583991543809, -0.19936692892680249, -0.19935230160694392, -0.19931935201933715, -0.19926996738775724, -0.1991181046924847, -0.19840559751088083, -0.19826942226153124, -0.19870463899592516, -0.19899082137379193, -0.19906419702481717, -0.19911153269042875, -0.19914309948321862, -0.19916599414210229, -0.19918242199624048, -0.19919348915246521, -0.1992000584620775, -0.19920293104601064, -0.1992028039410742, -0.19920033038499094, -0.1991963476164732, -0.19919176289931786, -0.19918733491442833, -0.19918361870859322, -0.19918094184567439, -0.19917937430684979, -0.19917880017791922, -0.19917900895000618, -0.19917973172669712, -0.19918069314439982, -0.19918165880839511, -0.19918247164608133, -0.19918306343867859, -0.19918343551158485]
    2273 #         G1 = [-0.29999999999999999, -0.29999999999999999, -0.29999787308813713, -0.26009808484031144, -0.2418845586287697, -0.22486001383264759, -0.2102291162103011, -0.19760335578192481, -0.18785837933085528, -0.17949650500100409, -0.17351178638915865, -0.17143383812020274, -0.17711706906796765, -0.19170094015084826, -0.20356939641102084, -0.20792079009438488, -0.20888082700225205, -0.20804991510030546, -0.20614151199351344, -0.20417148767655752, -0.20227799542360556, -0.20076216457981186, -0.19941022505664835, -0.19893663715126081, -0.19879385908350813, -0.19873968646451995, -0.19862185067990634, -0.19878530977550612, -0.19931044400195741, -0.19987479535981245, -0.20017585851961026, -0.20029826596318906, -0.20033249671779177, -0.20030311824375119, -0.20024904858978917, -0.20018289036868386, -0.20011573290424994, -0.20005187176834871, -0.19999983539549759, -0.19996486538394306, -0.19994835161369234, -0.19994173023214443, -0.19994949288920186, -0.19996450420493606, -0.19997961090604774, -0.19999101298658653, -0.19999928716924006, -0.20000514883661674, -0.20000753826790424, -0.20000831246075287, -0.20000804045780354]
    2274 #         G2 = [-0.40000000000000002, -0.39485513391845123, -0.33052977667729549, -0.3028223948514604, -0.28249047680934852, -0.26514162555000503, -0.24853938114200283, -0.23396663695843428, -0.21963021411159989, -0.20635073514824825, -0.19498717025566023, -0.18527426183381737, -0.17835542228712603, -0.17687259909018957, -0.18417692946736233, -0.19399194278026588, -0.20020562083713012, -0.20303629527311887, -0.20433278648768435, -0.20469912432572637, -0.20440890127579819, -0.2033959353778384, -0.20217866270937604, -0.2011136057275523, -0.20020557924453047, -0.1996863524971639, -0.19939414458902166, -0.19916264278834239, -0.19897640574528022, -0.19901356459403857, -0.1994318881104829, -0.19981287025410718, -0.20001542830722555, -0.2001183929807667, -0.20016843873478737, -0.20018549351685921, -0.20017118480430318, -0.20013746156392301, -0.20009852135884051, -0.20006134364128739, -0.20002509112940928, -0.1999968457994499, -0.19997976325195507, -0.19996995238171597, -0.19996919097058674, -0.19997390756244093, -0.19998044246288149, -0.19998608422560143, -0.19999195215326226, -0.1999978304771563, -0.20000238825155431]
    2275 #         G3 = [-0.45000000000000001, -0.3620809958626805, -0.33528249446150854, -0.31277203812178328, -0.29437307561287712, -0.27524017405256634, -0.25918804336323964, -0.24319184797937951, -0.22774289384310045, -0.21352862433699857, -0.20064463522791637, -0.18929326191522972, -0.18044723993451484, -0.17628655968511073, -0.17930721410643954, -0.18923094779562907, -0.19724591245682999, -0.20166573058443202, -0.2038082032698228, -0.20466826016561171, -0.20464589263442667, -0.20404611055002439, -0.20287503951157798, -0.20173128555056058, -0.20065385404412175, -0.19992946804934769, -0.19951847568518588, -0.19925503462561842, -0.19901508479082602, -0.19896094635324843, -0.19922129890389756, -0.19963261323978704, -0.19991757810875543, -0.20006881120589534, -0.20014801444913613, -0.20018228498252508, -0.20017995371351449, -0.20015833910384462, -0.20012315552138019, -0.20008511535535514, -0.20004505811354539, -0.20001092786760588, -0.19998840080018679, -0.19997317054460126, -0.19996841388081493, -0.19997075416051524, -0.19997597548007362, -0.199982459025875, -0.19998869291084412, -0.19999492522112805, -0.2000005389717803]
    2276 
    2277 
    22782067#         import pprint
    22792068#         pprint.pprint(gauge_values[0])
     
    22812070#         pprint.pprint(gauge_values[2])
    22822071#         pprint.pprint(gauge_values[3])
    2283        
    2284         # Steve Note: Had to recapture these values when changed minimum
    2285         # depth to 1e-5 from 1e-2
    2286         G0 =[-0.20000000000000001,
    2287              -0.20000000000000001,
    2288              -0.20000000000000001,
    2289              -0.19999999999975571,
    2290              -0.18988178846179604,
    2291              -0.17202752181254799,
    2292              -0.16184927069756147,
    2293              -0.15447427003963532,
    2294              -0.15134604044920894,
    2295              -0.15121214442067427,
    2296              -0.15729593498673056,
    2297              -0.18444803072391186,
    2298              -0.19897723870464665,
    2299              -0.19946748591622693,
    2300              -0.19965324440222218,
    2301              -0.19974226494508832,
    2302              -0.19979493245553043,
    2303              -0.19982992349781228,
    2304              -0.19985492962550819,
    2305              -0.19986011823497563,
    2306              -0.19982427181108517,
    2307              -0.19977829453990836,
    2308              -0.19969933105264723,
    2309              -0.19933478184887382,
    2310              -0.19908701974710796,
    2311              -0.1991122019688315,
    2312              -0.19933687900076719,
    2313              -0.19956438036006474,
    2314              -0.19964643837749627,
    2315              -0.19968080173622152,
    2316              -0.19970228204312851,
    2317              -0.19971668380044438,
    2318              -0.19972509864520363,
    2319              -0.1997284230953868,
    2320              -0.19972777734435748,
    2321              -0.1997243402238664,
    2322              -0.19971923284364987,
    2323              -0.19971358688324789,
    2324              -0.19970841723657659,
    2325              -0.19970438274281699,
    2326              -0.19970178392918134,
    2327              -0.19970060769114967,
    2328              -0.19970061942879483,
    2329              -0.19970149512056937,
    2330              -0.19970290206594571,
    2331              -0.19970450887363042,
    2332              -0.19970603756801092,
    2333              -0.19970729787126312,
    2334              -0.19970819315303368,
    2335              -0.19970872263443096,
    2336              -0.19970895206445305]
    2337        
    2338         G1 =[-0.29999999999999993,
    2339              -0.29999999999999993,
    2340              -0.29994665806891319,
    2341              -0.26156624055721978,
    2342              -0.24228946871160703,
    2343              -0.22525179314100155,
    2344              -0.21064600996686109,
    2345              -0.19802580280551524,
    2346              -0.18822080312951647,
    2347              -0.17989304207238235,
    2348              -0.1737787841442423,
    2349              -0.17101020849441434,
    2350              -0.17552243464104153,
    2351              -0.19044410425683495,
    2352              -0.20315031750993523,
    2353              -0.20800447806966432,
    2354              -0.20914674233499347,
    2355              -0.20840973965149348,
    2356              -0.20645586655529197,
    2357              -0.20446070726503779,
    2358              -0.20253776199306373,
    2359              -0.20089888487436869,
    2360              -0.19942070397896128,
    2361              -0.19882636291510805,
    2362              -0.19863435760174683,
    2363              -0.19859589547851822,
    2364              -0.19871324831780313,
    2365              -0.19896153409299208,
    2366              -0.19929101642103167,
    2367              -0.19978095241861879,
    2368              -0.20009611843246811,
    2369              -0.20025341966667765,
    2370              -0.20030517631740913,
    2371              -0.20030097147555179,
    2372              -0.20025544022466765,
    2373              -0.20019242849291077,
    2374              -0.20012511951226167,
    2375              -0.20006231744607678,
    2376              -0.20000929650382945,
    2377              -0.19996991626112592,
    2378              -0.19994954285057842,
    2379              -0.19994110318261829,
    2380              -0.19994593261169274,
    2381              -0.19995805453783461,
    2382              -0.19997239171603962,
    2383              -0.1999851239268273,
    2384              -0.19999545075989858,
    2385              -0.20000247108990088,
    2386              -0.20000662864334429,
    2387              -0.20000785942667668,
    2388              -0.20000785897946052]
    2389        
    2390         G2 =[-0.40000000000000002,
    2391              -0.39484448073320716,
    2392              -0.33062074643274886,
    2393              -0.30287652707477603,
    2394              -0.2825480880218833,
    2395              -0.26523626836316666,
    2396              -0.24864151027521733,
    2397              -0.23413987359170474,
    2398              -0.21992613202379763,
    2399              -0.20673982327387549,
    2400              -0.1953935095563058,
    2401              -0.18569256119020347,
    2402              -0.1784743938104299,
    2403              -0.17614476601723417,
    2404              -0.18297334487767014,
    2405              -0.19332207213801186,
    2406              -0.19994944360907599,
    2407              -0.20295867433277723,
    2408              -0.20438390762128253,
    2409              -0.20483055968313624,
    2410              -0.20458234173150452,
    2411              -0.20362712628571863,
    2412              -0.20239702335678736,
    2413              -0.20122218044707815,
    2414              -0.20019265196711289,
    2415              -0.19963052412223553,
    2416              -0.19930392910999506,
    2417              -0.1991132628497134,
    2418              -0.19906386530654854,
    2419              -0.19915472993425432,
    2420              -0.19940532410477915,
    2421              -0.19973302086783307,
    2422              -0.19995587988634531,
    2423              -0.2000842532676039,
    2424              -0.20015142800313682,
    2425              -0.2001789974511067,
    2426              -0.20017422101502547,
    2427              -0.20014456415241635,
    2428              -0.20010501501183611,
    2429              -0.20006605963347596,
    2430              -0.2000299862502686,
    2431              -0.19999924245971099,
    2432              -0.19997923386648156,
    2433              -0.19996842317611191,
    2434              -0.19996600417033178,
    2435              -0.19996926380173255,
    2436              -0.1999759818453084,
    2437              -0.19998309574817558,
    2438              -0.19999011562775873,
    2439              -0.19999586742374367,
    2440              -0.20000086181337628]
    2441        
    2442         G3 =[-0.45000000000000001,
    2443              -0.36241645700478942,
    2444              -0.33530596783943928,
    2445              -0.31278981248914817,
    2446              -0.29440300085363885,
    2447              -0.27527997093416101,
    2448              -0.25927059443379757,
    2449              -0.24332688518124004,
    2450              -0.22799100860023558,
    2451              -0.21388179461501408,
    2452              -0.20106337781936812,
    2453              -0.18974763932370953,
    2454              -0.1807322048435733,
    2455              -0.17571713128315394,
    2456              -0.17782997817263854,
    2457              -0.18835936686253887,
    2458              -0.19679287106896859,
    2459              -0.20147640477217035,
    2460              -0.20379668328420394,
    2461              -0.20476472209180963,
    2462              -0.20478634164151174,
    2463              -0.20424126725883512,
    2464              -0.20311268984439232,
    2465              -0.20189874472299799,
    2466              -0.20069559254582961,
    2467              -0.19989251874014566,
    2468              -0.19945175127842604,
    2469              -0.19916690396480519,
    2470              -0.19905500276142735,
    2471              -0.19908650772563102,
    2472              -0.19923460881098506,
    2473              -0.19956432739225624,
    2474              -0.19984636776484146,
    2475              -0.20002289127745171,
    2476              -0.20012185876966995,
    2477              -0.20017163399127091,
    2478              -0.20017940564120695,
    2479              -0.20016334602089997,
    2480              -0.2001299700027461,
    2481              -0.20009033862743789,
    2482              -0.20005033143042827,
    2483              -0.20001456480408847,
    2484              -0.19998887156242687,
    2485              -0.19997252232364973,
    2486              -0.1999658462920573,
    2487              -0.19996675178605025,
    2488              -0.19997169230550327,
    2489              -0.19997856508791936,
    2490              -0.19998607471657687,
    2491              -0.19999276976857228,
    2492              -0.19999861527597801]
     2072       
     2073        # Steve Note: Had to recapture these values when changed to default
     2074        # flow algorithm to DE0
     2075       
     2076        G0 = [-0.19166666666666665,
     2077             -0.19166666666666665,
     2078             -0.19166666666666665,
     2079             -0.19166666666666665,
     2080             -0.19166666666666665,
     2081             -0.17357498789004924,
     2082             -0.16134698833835073,
     2083             -0.15299819808948953,
     2084             -0.15658886028668945,
     2085             -0.15619519506566443,
     2086             -0.15983820234428089,
     2087             -0.17201558491115593,
     2088             -0.18809602362873767,
     2089             -0.19790107878825061,
     2090             -0.19916520934913592,
     2091             -0.19897656121883669,
     2092             -0.1994526052093108,
     2093             -0.19959391223111991,
     2094             -0.19953478511280054,
     2095             -0.19972300428585374,
     2096             -0.19630771510281139,
     2097             -0.19142529806554692,
     2098             -0.19150376369159233,
     2099             -0.19155465935100272,
     2100             -0.1915480843183047,
     2101             -0.19158487652868542,
     2102             -0.19160491229801035,
     2103             -0.19161005537288817,
     2104             -0.19161941600794635,
     2105             -0.19162712306975391,
     2106             -0.19163250820388589,
     2107             -0.19163717575751205,
     2108             -0.19164123614810449,
     2109             -0.19164461943275748,
     2110             -0.19164746068339567,
     2111             -0.19164986883200527,
     2112             -0.19165191683640856,
     2113             -0.19165366545685461,
     2114             -0.19165516248134548,
     2115             -0.19165644941311713,
     2116             -0.19165755970877371,
     2117             -0.19165852034152259,
     2118             -0.19165935411364624,
     2119             -0.19166008027417775,
     2120             -0.19166071302904672,
     2121             -0.19166126670954906,
     2122             -0.19166176113272784,
     2123             -0.19166219795907555,
     2124             -0.1916625893478662,
     2125             -0.1916629307243472,
     2126             -0.19166323917681413]
     2127       
     2128        G1 = [-0.29166666666666669,
     2129             -0.29166666666666669,
     2130             -0.29166666666666669,
     2131             -0.2625120524489587,
     2132             -0.23785652592777537,
     2133             -0.22355577785898192,
     2134             -0.21194260352756192,
     2135             -0.20074023971177196,
     2136             -0.1921307806774481,
     2137             -0.18446465937291226,
     2138             -0.17997582762982173,
     2139             -0.17711270247966202,
     2140             -0.17851892444764331,
     2141             -0.18506971624496477,
     2142             -0.19575447168307283,
     2143             -0.20276874461738162,
     2144             -0.20604869378667856,
     2145             -0.20679384168209414,
     2146             -0.20641078072679761,
     2147             -0.20542266250262109,
     2148             -0.2040758427409933,
     2149             -0.2023210482025932,
     2150             -0.20079135595686456,
     2151             -0.200151095127519,
     2152             -0.19933359856480387,
     2153             -0.1987496662304945,
     2154             -0.19838824488166795,
     2155             -0.19840968868426581,
     2156             -0.19875720118469065,
     2157             -0.1992908187455468,
     2158             -0.19978498430904629,
     2159             -0.20013379308921292,
     2160             -0.20033977063045771,
     2161             -0.20042440892886232,
     2162             -0.20040623053779325,
     2163             -0.20034473053740201,
     2164             -0.20025342290445922,
     2165             -0.20014447072563055,
     2166             -0.20003674497651436,
     2167             -0.19995754677956581,
     2168             -0.19990776759716164,
     2169             -0.19988543049560956,
     2170             -0.199888928325714,
     2171             -0.19990718400594476,
     2172             -0.19993251283774235,
     2173             -0.19996431619318056,
     2174             -0.19999093834815995,
     2175             -0.20001191340810734,
     2176             -0.20002510023168069,
     2177             -0.20003044891380231,
     2178             -0.20002952773077484]
     2179       
     2180        G2 = [-0.42499999999999999,
     2181             -0.40953908664730287,
     2182             -0.33296103674588662,
     2183             -0.30451769824676844,
     2184             -0.28219604345783056,
     2185             -0.26522350354865254,
     2186             -0.25015947587031895,
     2187             -0.23608529438075876,
     2188             -0.22253484154746356,
     2189             -0.20994131123668461,
     2190             -0.19973743965316049,
     2191             -0.19049780733818705,
     2192             -0.18495761801075922,
     2193             -0.18037302557409396,
     2194             -0.18191116803107951,
     2195             -0.18821767150886343,
     2196             -0.19501674197220067,
     2197             -0.19950705780757777,
     2198             -0.20218620150235145,
     2199             -0.20347437823613723,
     2200             -0.20399600876175172,
     2201             -0.20401809537321336,
     2202             -0.20338240306788496,
     2203             -0.20225546137366332,
     2204             -0.20125582827786589,
     2205             -0.20064315945485711,
     2206             -0.19994146252008138,
     2207             -0.19933940195992941,
     2208             -0.19890775656150686,
     2209             -0.19881040880955592,
     2210             -0.19901575680457334,
     2211             -0.19936426014319533,
     2212             -0.1996865767169046,
     2213             -0.19994731519882072,
     2214             -0.20013715580150337,
     2215             -0.20024380974598521,
     2216             -0.20027966500003219,
     2217             -0.20026916410031764,
     2218             -0.20021596069804154,
     2219             -0.20014200328898363,
     2220             -0.20006589807932401,
     2221             -0.20000079735581283,
     2222             -0.19995360469070572,
     2223             -0.19992526935599028,
     2224             -0.19991808248161369,
     2225             -0.19992443120735207,
     2226             -0.19994339357600277,
     2227             -0.19996469380466553,
     2228             -0.19998467955016122,
     2229             -0.20000213621634999,
     2230             -0.20001413684386354]
     2231       
     2232        G3 = [-0.44166666666666665,
     2233             -0.36356820384297261,
     2234             -0.32677493201134605,
     2235             -0.30732284916772212,
     2236             -0.29038753972867332,
     2237             -0.27270481540957403,
     2238             -0.25782191624274975,
     2239             -0.2432498394927349,
     2240             -0.22936799633074165,
     2241             -0.2163115182211087,
     2242             -0.20471162972237375,
     2243             -0.19474955403226407,
     2244             -0.18722605352323582,
     2245             -0.18186433340685534,
     2246             -0.18066168631825957,
     2247             -0.1849738852801476,
     2248             -0.19187415350512246,
     2249             -0.19744289107562996,
     2250             -0.20094758082578065,
     2251             -0.2028743338186943,
     2252             -0.20375298105641421,
     2253             -0.20404634370333788,
     2254             -0.20385967844158176,
     2255             -0.20281299387611038,
     2256             -0.20172106447516341,
     2257             -0.20097648698314996,
     2258             -0.20029217955013084,
     2259             -0.19962005657018717,
     2260             -0.19908929111834933,
     2261             -0.19882323339870062,
     2262             -0.19886705890507497,
     2263             -0.19919177307550476,
     2264             -0.1995284015021406,
     2265             -0.19982374500648564,
     2266             -0.20005201207002615,
     2267             -0.20019729220453644,
     2268             -0.20026700514017221,
     2269             -0.20027541321283041,
     2270             -0.20024991859335209,
     2271             -0.20018037785313814,
     2272             -0.20010282964013762,
     2273             -0.20003123082670529,
     2274             -0.19997471558256363,
     2275             -0.19993722523364474,
     2276             -0.19992030412618081,
     2277             -0.19992065759609112,
     2278             -0.19993226086341562,
     2279             -0.19995375100532778,
     2280             -0.19997513774473216,
     2281             -0.19999415800173256,
     2282             -0.20000875071328705]
     2283
     2284       
    24932285
    24942286       
     
    36133405        # for a range of stage values
    36143406        for stage in [2.0, 1.0, 0.5, 0.25, 0.1, 0.0]:
    3615             print stage
     3407            #print stage
    36163408
    36173409            domain.time = 0.0
     
    36323424        # range of stage values
    36333425        for stage in [2.0, 1.0, 0.5, 0.25, 0.1, 0.0]:
    3634             print stage
     3426            #print stage
    36353427
    36363428            domain.time = 0.0
     
    36473439                volume = domain.quantities['stage'].get_integral()
    36483440
    3649                 print t, volume
     3441                #print t, volume
    36503442                assert num.allclose(volume, initial_volume)
    36513443
     
    36823474        #Check that centroid values were distributed to vertices
    36833475        C = domain.quantities['stage'].centroid_values
    3684         for i in range(3):
    3685             assert num.allclose(domain.quantities['stage'].vertex_values[:,i],
    3686                                 C)
     3476        V = num.sum(domain.quantities['stage'].vertex_values, axis=1)/3.0
     3477       
     3478        assert num.allclose(V,C)
     3479           
    36873480
    36883481    def test_first_order_limiter_variable_z(self):
     
    37583551        domain._order_ = 1
    37593552        domain.distribute_to_vertices_and_edges()
    3760         assert num.allclose(L[1], val1)
     3553
     3554        assert num.allclose(L[1], [ 0.,  6.,  6.])
     3555        assert num.allclose(num.sum(L[1]), 3*val1)
    37613556
    37623557        # Second order
     
    37693564        domain.beta_vh_dry = 0.9
    37703565        domain.distribute_to_vertices_and_edges()
    3771         assert num.allclose(L[1], [2.2, 4.9, 4.9])
     3566        assert num.allclose(L[1], [ 0.,  6.,  6.])
     3567        assert num.allclose(num.sum(L[1]), 3*val1)
     3568
    37723569
    37733570    def test_distribute_away_from_bed(self):
     
    37873584
    37883585        domain = Domain(points, vertices)
     3586        #domain.set_flow_algorithm('1_5')
    37893587        L = domain.quantities['stage'].vertex_values
    37903588
     
    38033601        domain._order_ = 1
    38043602        domain.distribute_to_vertices_and_edges()
    3805         assert num.allclose(L[1], 1.77777778)
     3603
     3604        assert num.allclose(L[1], [-0.22222222,  2.77777778,  2.77777778])
    38063605
    38073606        domain._order_ = 2
     
    38133612        domain.beta_vh_dry = 0.9
    38143613        domain.distribute_to_vertices_and_edges()
    3815         assert num.allclose(L[1], [0.57777777, 2.37777778, 2.37777778])
     3614
     3615        assert num.allclose(L[1], [-2.66666667,  4.        ,  4.        ])
    38163616
    38173617    def test_distribute_away_from_bed1(self):
     
    38453645        domain._order_ = 1
    38463646        domain.distribute_to_vertices_and_edges()
     3647
    38473648        assert num.allclose(L[1], 4.9382716)
    38483649
     
    38553656        domain.beta_vh_dry = 0.9
    38563657        domain.distribute_to_vertices_and_edges()
    3857         assert num.allclose(L[1], [1.07160494, 6.46058131, 7.28262855])
     3658
     3659        assert num.allclose(L[1], [ -7.81670675,   9.95991663,  12.67160494])
    38583660
    38593661    def test_distribute_near_bed(self):
     
    38963698        domain.tight_slope_limiters = 0
    38973699        domain.distribute_to_vertices_and_edges()
     3700
    38983701        assert num.allclose(L[1], [0.1, 20.1, 20.1])
    38993702        for i in range(len(L)):
     
    39083711        #print L[1]
    39093712        #print [0.298, 20.001, 20.001]
    3910         assert num.allclose(L[1], [0.29998,  20.00001,  20.00001])
     3713     
     3714        assert num.allclose(L[1], [  0.1,  20.1,  20.1])
    39113715
    39123716       
     
    39283732
    39293733        domain.distribute_to_vertices_and_edges()
    3930         assert num.allclose(L[1], [0.29998,  20.00001,  20.00001])
     3734        assert num.allclose(L[1], [0.1, 20.1, 20.1])
    39313735       
    39323736        for i in range(len(L)):
     
    39463750
    39473751        domain = Domain(points, vertices)
     3752        domain.set_flow_algorithm('1_5')
    39483753
    39493754        # Set up for a gradient of (8,2) at mid triangle (bce)
     
    39973802
    39983803        domain.distribute_to_vertices_and_edges()
    3999         #print L[1]
    40003804        assert  num.allclose(L[1], [4.19444976, 16.10554024, 20.00001]) or\
    40013805                num.allclose(L[1], [4.23370103, 16.06529897, 20.001]) or\
    40023806                num.allclose(L[1], [4.18944138, 16.10955862, 20.001]) or\
    4003                 num.allclose(L[1], [4.19351461, 16.10548539, 20.001]) # old limiters
     3807                num.allclose(L[1], [4.19351461, 16.10548539, 20.001]) or\
     3808                num.allclose(L[1], [4.00001   , 16.15431247, 20.14567753])
    40043809       
    40053810        for i in range(len(L)):
     
    40653870        X_EX = [ 0.0170432 ,  0.01674667,  0.00654035]
    40663871        Y_EX = [ -1.56119371e-04,   1.10107449e-04,  -5.74034758e-05]
    4067 
    4068         assert num.allclose(L[1,:], L_EX)
    4069         assert num.allclose(X[1,:], X_EX)
    4070         assert num.allclose(Y[1,:], Y_EX)
    4071 
    4072 
     3872       
     3873        #pprint(L[1,:])
     3874        #pprint(X[1,:])
     3875        #pprint(Y[1,:])
     3876       
     3877        L_EX1 = [-0.01434766, -0.01292565,  0.03824164]
     3878        X_EX1 = [ 0.01631331,  0.01583494,  0.00596076]
     3879        Y_EX1 = [-0.00036261,  0.00068027, -0.00048923]
     3880
     3881        assert num.allclose(L[1,:], L_EX) or \
     3882            num.allclose(L[1,:], L_EX1)
     3883       
     3884        assert num.allclose(X[1,:], X_EX) or \
     3885            num.allclose(X[1,:], X_EX1)
     3886           
     3887        assert num.allclose(Y[1,:], Y_EX) or \
     3888            num.allclose(Y[1,:], Y_EX1)
    40733889
    40743890
     
    42154031                                num.sum(stage.vertex_values[k,:])/3)
    42164032
    4217         # Check actual results
     4033
    42184034        assert num.allclose(stage.vertex_values,
    4219                             [[2,2,2],
    4220                              [1.93333333, 2.03333333, 6.03333333],
    4221                              [6.93333333, 4.53333333, 4.53333333],
    4222                              [5.33333333, 5.33333333, 5.33333333]])
     4035                            [[ 2.        ,  2.        ,  2.        ],
     4036                             [ 3.33333333,  3.33333333,  3.33333333],
     4037                             [ 5.33333333,  5.33333333,  5.33333333],
     4038                             [ 5.33333333,  5.33333333, 5.33333333]])
    42234039
    42244040    def test_balance_deep_and_shallow_tight_SL(self):
     
    47264542            xmom = domain.quantities['xmomentum'].get_integral()
    47274543            ymom = domain.quantities['ymomentum'].get_integral()
    4728 
    4729             if num.allclose(t, 6):    # Steady state reached
     4544            #print stage,xmom,ymom
     4545
     4546            if num.allclose(t, 10):    # Steady state reached
    47304547                steady_xmom = domain.quantities['xmomentum'].get_integral()
    47314548                steady_ymom = domain.quantities['ymomentum'].get_integral()
    47324549                steady_stage = domain.quantities['stage'].get_integral()
    47334550
    4734             if t > 6:
     4551            if t > 10:
    47354552                msg = 'xmom=%.2f, steady_xmom=%.2f' % (xmom, steady_xmom)
    47364553                assert num.allclose(xmom, steady_xmom), msg
     
    48024619        #Create shallow water domain
    48034620        domain = Domain(points, vertices, boundary)
     4621        domain.set_flow_algorithm('1_5')
    48044622        domain.smooth = False
    48054623        domain.default_order = 2
     
    49054723        # Create shallow water domain
    49064724        domain = Domain(points, vertices, boundary)
     4725        domain.set_flow_algorithm('1_5')
    49074726        domain.smooth = False
    49084727        domain.default_order = 1
     
    49444763        # Create shallow water domain
    49454764        domain = Domain(points, vertices, boundary)
     4765        domain.set_flow_algorithm('1_5')
    49464766        domain.smooth = False
    49474767        domain.default_order = 2
     
    49804800        # Slight change due to flux limiter optimisation 18/04/2012
    49814801
    4982         #print domain.quantities['stage'].vertex_values[:4,0]
    4983         #print domain.quantities['xmomentum'].vertex_values[:4,0]
    4984         #print domain.quantities['ymomentum'].vertex_values[:4,0]
    4985 
    4986         W_EX = [ 0.001, 0.05350737,  0.00106727,  0.0535293 ]
    4987         UH_EX = [ 0.00090262,  0.03684904,  0.00090267,  0.03686323]
    4988         VH_EX = [ -1.97310289e-04,   6.10268320e-04,  -6.59631326e-05,   6.14082609e-04]
    4989 
    4990 
    4991         assert num.allclose(domain.quantities['stage'].vertex_values[:4,0], W_EX)
    4992                             #[0.001, 0.05350407, 0.00106768, 0.05352525])
    4993         assert num.allclose(domain.quantities['xmomentum'].vertex_values[:4,0], UH_EX)
    4994                             #[0.0008628, 0.03684647, 0.00087764, 0.03686007])
    4995 
    4996         assert num.allclose(domain.quantities['ymomentum'].vertex_values[:4,0], VH_EX)
    4997                             #[-0.00142114, 0.00061557, -0.00062362, 0.00061896])
     4802        #pprint(domain.quantities['stage'].vertex_values[:4,0])
     4803        #pprint(domain.quantities['xmomentum'].vertex_values[:4,0])
     4804        #pprint(domain.quantities['ymomentum'].vertex_values[:4,0])
     4805
     4806
     4807       
     4808        #W_0 =  [ 0.001     ,  0.05350388,  0.001     ,  0.05352525]
     4809        #UH_0 = [ 0.00044246,  0.03684648,  0.0008209 ,  0.03686007]
     4810        #VH_0 = [-0.00142112,  0.00061559, -0.00062362,  0.00061896]
     4811       
     4812        W_0 =  [ 0.001     ,  0.05350737,  0.00106727,  0.0535293 ]
     4813        UH_0 = [ 0.00090262,  0.03684904,  0.00090267,  0.03686323]
     4814        VH_0 = [ -1.97310289e-04,   6.10268320e-04,  -6.59631326e-05, 6.14082609e-04]
     4815
     4816
     4817
     4818        assert num.allclose(domain.quantities['stage'].vertex_values[:4,0], W_0)
     4819
     4820        assert num.allclose(domain.quantities['xmomentum'].vertex_values[:4,0], UH_0)
     4821
     4822        assert num.allclose(domain.quantities['ymomentum'].vertex_values[:4,0], VH_0)
     4823
    49984824
    49994825        os.remove(domain.get_name() + '.sww')
     
    50094835        # Create shallow water domain
    50104836        domain = Domain(points, vertices, boundary)
     4837        domain.set_flow_algorithm('1_5')
    50114838        domain.smooth = False
    50124839        domain.default_order = 2
     
    50354862        assert num.allclose(domain.recorded_max_timestep, 0.0210448446782)
    50364863
    5037 
     4864        #pprint(domain.quantities['stage'].vertex_values[:4,0])
     4865        #pprint(domain.quantities['xmomentum'].vertex_values[:4,0])
     4866        #pprint(domain.quantities['ymomentum'].vertex_values[:4,0])
    50384867
    50394868        UH_EX = [ 0.00090262,  0.03684904,  0.00090267,  0.03686323]
    50404869        VH_EX = [ -1.97310289e-04,   6.10268320e-04,  -6.59631326e-05,   6.14082609e-04]
    50414870
     4871        #UH_EX = [ 0.00044246,  0.03684648,  0.0008209 ,  0.03686007]
     4872        #VH_EX = [-0.00142112,  0.00061559, -0.00062362,  0.00061896]
    50424873
    50434874        assert num.allclose(domain.quantities['xmomentum'].vertex_values[:4,0], UH_EX)
     
    50584889        # Create shallow water domain
    50594890        domain = Domain(points, vertices, boundary)
     4891        domain.set_flow_algorithm('1_5')
    50604892        domain.smooth = False
    50614893        domain.default_order=domain._order_ = 2
     
    51725004            VH_EX = [ -1.97310289e-04,   6.10268320e-04,  -6.59631326e-05,   6.14082609e-04]
    51735005
     5006            #pprint(domain.quantities['stage'].vertex_values[:4,0])
     5007            #pprint(domain.quantities['xmomentum'].vertex_values[:4,0])
     5008            #pprint(domain.quantities['ymomentum'].vertex_values[:4,0])
     5009           
     5010           
    51745011            assert num.allclose(domain.quantities['xmomentum'].vertex_values[:4,0],
    51755012                    UH_EX)
     
    51775014            assert num.allclose(domain.quantities['ymomentum'].vertex_values[:4,0],
    51785015                    VH_EX)
    5179 
    5180 
    5181 
    5182 
    51835016
    51845017
     
    52565089
    52575090
    5258 
    5259 
    5260         W_EX = num.array([-0.02980292, -0.01505405, -0.03019976, -0.0147243 , -0.02977437,
    5261        -0.01455787, -0.0295205 , -0.01445701, -0.02954252, -0.01448278,
    5262        -0.02999257, -0.01408376, -0.07568404, -0.06260571, -0.07670382,
    5263        -0.06296941, -0.07625921, -0.06240601, -0.07560327, -0.06206728,
    5264        -0.07549723, -0.0621725 , -0.07640462, -0.06310999, -0.12083533,
    5265        -0.10966034, -0.12146507, -0.11026835, -0.12096515, -0.10975119,
    5266        -0.11980055, -0.10909004, -0.11917619, -0.10886911, -0.11992734,
    5267        -0.10974303, -0.1682724 , -0.15806185, -0.16755755, -0.15813214,
    5268        -0.16637699, -0.15747055, -0.16432173, -0.15628653, -0.16274938,
    5269        -0.15518825, -0.16300262, -0.15459735, -0.17601035, -0.19924406,
    5270        -0.18182271, -0.19760979, -0.17891469, -0.19417266, -0.17466008,
    5271        -0.19070543, -0.17309543, -0.19113156, -0.17980297, -0.19663942,
    5272        -0.14442217, -0.14810015, -0.14678554, -0.15253568, -0.14694848,
    5273        -0.15089716, -0.14339285, -0.14710889, -0.14057283, -0.14574876,
    5274        -0.14076063, -0.1496732 ])
     5091       
     5092       
     5093        W_EX = num.array([-0.02933401, -0.01091747, -0.02782667, -0.01057726, -0.02746728,
     5094       -0.01033124, -0.02724838, -0.01019733, -0.02684617, -0.00965007,
     5095       -0.02495054, -0.00706089, -0.06890704, -0.06303447, -0.07568528,
     5096       -0.06161392, -0.07566147, -0.06125286, -0.07537564, -0.06094254,
     5097       -0.07488436, -0.06058909, -0.07465553, -0.06045194, -0.12205956,
     5098       -0.10701804, -0.12318423, -0.10795678, -0.12302672, -0.10763744,
     5099       -0.12279702, -0.10731376, -0.12214772, -0.1071946 , -0.12283814,
     5100       -0.10858945, -0.16389971, -0.15304369, -0.16428248, -0.15298725,
     5101       -0.16430596, -0.15254043, -0.16407102, -0.15236021, -0.16390702,
     5102       -0.15187689, -0.16460111, -0.15549742, -0.2083898 , -0.19912702,
     5103       -0.20845637, -0.19709535, -0.20648985, -0.19663999, -0.20525695,
     5104       -0.19631453, -0.20446298, -0.19578452, -0.20735693, -0.19565282,
     5105       -0.14022868, -0.14262659, -0.13774131, -0.14132395, -0.13707526,
     5106       -0.14041639, -0.13594765, -0.13910709, -0.13533594, -0.1393996 ,
     5107       -0.1328638 , -0.1363085 ])
    52755108
    52765109       
     
    52785111        assert num.allclose(domain.quantities['stage'].centroid_values, W_EX)
    52795112
    5280         # values pre revision 8403
    5281 #                            [-0.02998628, -0.01520652, -0.03043492,
    5282 #                             -0.0149132,  -0.03004706, -0.01476251,
    5283 #                             -0.0298215,  -0.01467976, -0.02988158,
    5284 #                             -0.01474662, -0.03036161, -0.01442995,
    5285 #                             -0.07624583, -0.06297061, -0.07733792,
    5286 #                             -0.06342237, -0.07695439, -0.06289595,
    5287 #                             -0.07635559, -0.0626065,  -0.07633628,
    5288 #                             -0.06280072, -0.07739632, -0.06386738,
    5289 #                             -0.12161738, -0.11028239, -0.1223796,
    5290 #                             -0.11095953, -0.12189744, -0.11048616,
    5291 #                             -0.12074535, -0.10987605, -0.12014311,
    5292 #                             -0.10976691, -0.12096859, -0.11087692,
    5293 #                             -0.16868259, -0.15868061, -0.16801135,
    5294 #                             -0.1588003,  -0.16674343, -0.15813323,
    5295 #                             -0.16457595, -0.15693826, -0.16281096,
    5296 #                             -0.15585154, -0.16283873, -0.15540068,
    5297 #                             -0.17450362, -0.19919913, -0.18062882,
    5298 #                             -0.19764131, -0.17783111, -0.19407213,
    5299 #                             -0.1736915,  -0.19053624, -0.17228678,
    5300 #                             -0.19105634, -0.17920133, -0.1968828,
    5301 #                             -0.14244395, -0.14604641, -0.14473537,
    5302 #                             -0.1506107,  -0.14510055, -0.14919522,
    5303 #                             -0.14175896, -0.14560798, -0.13911658,
    5304 #                             -0.14439383, -0.13924047, -0.14829043])
    53055113
    53065114        os.remove(domain.get_name() + '.sww')
     
    53735181            pass
    53745182
    5375         assert num.allclose(domain.quantities['stage'].centroid_values,
    5376                             [ 0.01290985,  0.02356019,  0.01619096,  0.02356019,  0.01619096,
    5377                               0.02356019,  0.01619096,  0.02356019,  0.01619096,  0.02356019,
    5378                               0.01619096,  0.0268413,  -0.04411074, -0.0248011,  -0.04186556,
    5379                              -0.0248011,  -0.04186556, -0.0248011,  -0.04186556, -0.0248011,
    5380                              -0.04186556, -0.0248011,  -0.04186556, -0.02255593,
    5381                              -0.09966629, -0.08035666, -0.09742112, -0.08035666,
    5382                              -0.09742112, -0.08035666, -0.09742112, -0.08035666,
    5383                              -0.09742112, -0.08035666, -0.09742112, -0.07811149,
    5384                              -0.15522185, -0.13591222, -0.15297667, -0.13591222,
    5385                              -0.15297667, -0.13591222, -0.15297667, -0.13591222,
    5386                              -0.15297667, -0.13591222, -0.15297667, -0.13366704,
    5387                              -0.2107774,  -0.19146777, -0.20853223, -0.19146777,
    5388                              -0.20853223, -0.19146777, -0.20853223, -0.19146777,
    5389                              -0.20853223, -0.19146777, -0.20853223, -0.1892226,
    5390                              -0.26120669, -0.24776246, -0.25865535, -0.24776246,
    5391                              -0.25865535, -0.24776246, -0.25865535, -0.24776246,
    5392                              -0.25865535, -0.24776246, -0.25865535, -0.24521113])
     5183
     5184       
     5185        W_EX = [ 0.01571282,  0.02678718,  0.01765727,  0.02678718,  0.01765727,
     5186        0.02678718,  0.01765727,  0.02678718,  0.01765727,  0.02678718,
     5187        0.01765727,  0.02873162, -0.04259259, -0.02407407, -0.04259259,
     5188       -0.02407407, -0.04259259, -0.02407407, -0.04259259, -0.02407407,
     5189       -0.04259259, -0.02407407, -0.04259259, -0.02407407, -0.09814815,
     5190       -0.07962963, -0.09814815, -0.07962963, -0.09814815, -0.07962963,
     5191       -0.09814815, -0.07962963, -0.09814815, -0.07962963, -0.09814815,
     5192       -0.07962963, -0.1537037 , -0.13518519, -0.1537037 , -0.13518519,
     5193       -0.1537037 , -0.13518519, -0.1537037 , -0.13518519, -0.1537037 ,
     5194       -0.13518519, -0.1537037 , -0.13518519, -0.20925926, -0.19074074,
     5195       -0.20925926, -0.19074074, -0.20925926, -0.19074074, -0.20925926,
     5196       -0.19074074, -0.20925926, -0.19074074, -0.20925926, -0.19074074,
     5197       -0.26206496, -0.2509906 , -0.26012051, -0.2509906 , -0.26012051,
     5198       -0.2509906 , -0.26012051, -0.2509906 , -0.26012051, -0.2509906 ,
     5199       -0.26012051, -0.24904616]
     5200       
     5201
     5202        assert num.allclose(domain.quantities['stage'].centroid_values, W_EX)
     5203
    53935204
    53945205        os.remove(domain.get_name() + '.sww')
     
    54655276
    54665277        # Data from earlier version of abstract_2d_finite_volumes ft=0.1
    5467         assert num.allclose(domain.recorded_min_timestep, 0.0369086502523)
    5468         assert num.allclose(domain.recorded_max_timestep, 0.039741192872)
    5469 
    5470 
    5471 
    5472         W_EX = num.array([ 0.00795608,  0.01596527,  0.00956094,  0.01717369,  0.00969528,
    5473         0.01715985,  0.00969528,  0.01715912,  0.00970472,  0.01738119,
    5474         0.01185358,  0.0201596 , -0.04461219, -0.02464738, -0.04189468,
    5475        -0.02293302, -0.04170703, -0.02294762, -0.0417068 , -0.02294741,
    5476        -0.0417167 , -0.02278953, -0.04021738, -0.02030306, -0.10038956,
    5477        -0.08162321, -0.09775355, -0.0802314 , -0.09760962, -0.08023683,
    5478        -0.09760936, -0.08023661, -0.09761543, -0.08009085, -0.09604922,
    5479        -0.07758977, -0.15593983, -0.13712687, -0.15330179, -0.13571718,
    5480        -0.15315786, -0.13572398, -0.15315759, -0.13572375, -0.15316365,
    5481        -0.13557803, -0.15159926, -0.1331026 , -0.21204327, -0.192723  ,
    5482        -0.2094279 , -0.19131344, -0.20928841, -0.19132167, -0.20928816,
    5483        -0.19132145, -0.20929528, -0.19117292, -0.20768266, -0.1886722 ,
    5484        -0.25371474, -0.24629939, -0.25027799, -0.24477016, -0.25009762,
    5485        -0.24476605, -0.25009707, -0.24476605, -0.25009747, -0.24465735,
    5486        -0.24844075, -0.243179  ])
     5278        assert num.allclose(domain.recorded_min_timestep, 0.0344599003014)
     5279        assert num.allclose(domain.recorded_max_timestep, 0.0389583450282)
     5280
     5281
     5282
     5283
     5284
     5285        W_EX = [ 0.0139179 ,  0.02042942,  0.01387861,  0.02260567,  0.01411961,
     5286        0.02257022,  0.01411876,  0.02257068,  0.01410918,  0.02261447,
     5287        0.01499783,  0.02389845, -0.04251109, -0.02212912, -0.04251948,
     5288       -0.02246733, -0.04255301, -0.02249248, -0.04255414, -0.02249256,
     5289       -0.04255723, -0.02246484, -0.04249686, -0.0227994 , -0.0981469 ,
     5290       -0.07963855, -0.09814612, -0.0796798 , -0.09814534, -0.07968191,
     5291       -0.09814485, -0.07968181, -0.0981447 , -0.07968234, -0.09814709,
     5292       -0.07965679, -0.1536881 , -0.13518635, -0.15367303, -0.13518816,
     5293       -0.15367326, -0.13518799, -0.15367317, -0.13518781, -0.15367978,
     5294       -0.13518708, -0.15369949, -0.13518601, -0.20998266, -0.19073703,
     5295       -0.21026541, -0.19066381, -0.21024984, -0.19066528, -0.21024981,
     5296       -0.19066604, -0.21027042, -0.19065307, -0.20996069, -0.19066892,
     5297       -0.25756828, -0.24830925, -0.25621951, -0.24781358, -0.25622055,
     5298       -0.24781919, -0.25622027, -0.24781961, -0.25623837, -0.24769688,
     5299       -0.25474901, -0.24797932]
    54875300
    54885301
    54895302        assert num.allclose(domain.quantities['stage'].centroid_values, W_EX)
    54905303
    5491         # values pre revision 8403
    5492 #                            [ 0.00855788,  0.01575204,  0.00994606,  0.01717072,
    5493 #                              0.01005985,  0.01716362,  0.01005985,  0.01716299,
    5494 #                              0.01007098,  0.01736248,  0.01216452,  0.02026776,
    5495 #                             -0.04462374, -0.02479045, -0.04199789, -0.0229465,
    5496 #                             -0.04184033, -0.02295693, -0.04184013, -0.02295675,
    5497 #                             -0.04184486, -0.0228168,  -0.04028876, -0.02036486,
    5498 #                             -0.10029444, -0.08170809, -0.09772846, -0.08021704,
    5499 #                             -0.09760006, -0.08022143, -0.09759984, -0.08022124,
    5500 #                             -0.09760261, -0.08008893, -0.09603914, -0.07758209,
    5501 #                             -0.15584152, -0.13723138, -0.15327266, -0.13572906,
    5502 #                             -0.15314427, -0.13573349, -0.15314405, -0.13573331,
    5503 #                             -0.15314679, -0.13560104, -0.15158523, -0.13310701,
    5504 #                             -0.21208605, -0.19283913, -0.20955631, -0.19134189,
    5505 #                             -0.20942821, -0.19134598, -0.20942799, -0.1913458,
    5506 #                             -0.20943005, -0.19120952, -0.20781177, -0.18869401,
    5507 #                             -0.25384082, -0.2463294,  -0.25047649, -0.24464654,
    5508 #                             -0.25031159, -0.24464253, -0.25031112, -0.24464253,
    5509 #                             -0.25031463, -0.24454764, -0.24885323, -0.24286438])
    55105304
    55115305
     
    55215315        domain = Domain(points, vertices, boundary)
    55225316
    5523         domain.set_compute_fluxes_method('original')
     5317        #domain.set_compute_fluxes_method('original')
    55245318       
    55255319        domain.smooth = False
     
    55845378
    55855379
     5380
    55865381   
    5587         W_EX = num.array([ 0.00795608,  0.01596527,  0.00956094,  0.01717369,  0.00969528,
    5588         0.01715985,  0.00969528,  0.01715912,  0.00970472,  0.01738119,
    5589         0.01185358,  0.0201596 , -0.04461219, -0.02464738, -0.04189468,
    5590        -0.02293302, -0.04170703, -0.02294762, -0.0417068 , -0.02294741,
    5591        -0.0417167 , -0.02278953, -0.04021738, -0.02030306, -0.10038956,
    5592        -0.08162321, -0.09775355, -0.0802314 , -0.09760962, -0.08023683,
    5593        -0.09760936, -0.08023661, -0.09761543, -0.08009085, -0.09604922,
    5594        -0.07758977, -0.15593983, -0.13712687, -0.15330179, -0.13571718,
    5595        -0.15315786, -0.13572398, -0.15315759, -0.13572375, -0.15316365,
    5596        -0.13557803, -0.15159926, -0.1331026 , -0.21204327, -0.192723  ,
    5597        -0.2094279 , -0.19131344, -0.20928841, -0.19132167, -0.20928816,
    5598        -0.19132145, -0.20929528, -0.19117292, -0.20768266, -0.1886722 ,
    5599        -0.25371474, -0.24629939, -0.25027799, -0.24477016, -0.25009762,
    5600        -0.24476605, -0.25009707, -0.24476605, -0.25009747, -0.24465735,
    5601        -0.24844075, -0.243179  ])
     5382        W_EX = [ 0.01308246,  0.02201217,  0.01358687,  0.023575  ,  0.01370201,
     5383        0.0235574 ,  0.01370201,  0.02355753,  0.0136998 ,  0.02361447,
     5384        0.01454146,  0.02507853, -0.04254524, -0.022535  , -0.04260359,
     5385       -0.0225144 , -0.04263851, -0.02252512, -0.04263809, -0.02252512,
     5386       -0.04264303, -0.02249883, -0.04257228, -0.02296247, -0.0981472 ,
     5387       -0.07964098, -0.09814502, -0.07968513, -0.09814337, -0.07968807,
     5388       -0.09814296, -0.07968807, -0.09814296, -0.07968807, -0.09814555,
     5389       -0.07965964, -0.15368138, -0.13518778, -0.15366285, -0.13519037,
     5390       -0.15366285, -0.13519037, -0.15366285, -0.13518996, -0.15366479,
     5391       -0.13518832, -0.15369898, -0.13518613, -0.21012122, -0.19071462,
     5392       -0.21066837, -0.19057453, -0.21064807, -0.19057613, -0.21064807,
     5393       -0.19057519, -0.21067682, -0.19061141, -0.21080033, -0.19066023,
     5394       -0.25755282, -0.24897294, -0.25604086, -0.24820174, -0.25598276,
     5395       -0.24820504, -0.25598272, -0.24820504, -0.2559903 , -0.2480719 ,
     5396       -0.25395141, -0.24799187]
    56025397
    56035398
    56045399        assert num.allclose(domain.quantities['stage'].centroid_values, W_EX)
    56055400
    5606         # values pre revision 8403
    5607 #                            [ 0.00855788,  0.01575204,  0.00994606,  0.01717072,  0.01005985,
    5608 #                              0.01716362,  0.01005985,  0.01716299,  0.01007098,  0.01736248,
    5609 #                              0.01216452,  0.02026776, -0.04462374, -0.02479045, -0.04199789,
    5610 #                             -0.0229465,  -0.04184033, -0.02295693, -0.04184013,
    5611 #                             -0.02295675, -0.04184486, -0.0228168,  -0.04028876,
    5612 #                             -0.02036486, -0.10029444, -0.08170809, -0.09772846,
    5613 #                             -0.08021704, -0.09760006, -0.08022143, -0.09759984,
    5614 #                             -0.08022124, -0.09760261, -0.08008893, -0.09603914,
    5615 #                             -0.07758209, -0.15584152, -0.13723138, -0.15327266,
    5616 #                             -0.13572906, -0.15314427, -0.13573349, -0.15314405,
    5617 #                             -0.13573331, -0.15314679, -0.13560104, -0.15158523,
    5618 #                             -0.13310701, -0.21208605, -0.19283913, -0.20955631,
    5619 #                             -0.19134189, -0.20942821, -0.19134598, -0.20942799,
    5620 #                             -0.1913458,  -0.20943005, -0.19120952, -0.20781177,
    5621 #                             -0.18869401, -0.25384082, -0.2463294,  -0.25047649,
    5622 #                             -0.24464654, -0.25031159, -0.24464253, -0.25031112,
    5623 #                             -0.24464253, -0.25031463, -0.24454764, -0.24885323,
    5624 #                             -0.24286438])
    56255401
    56265402        os.remove(domain.get_name() + '.sww')
     
    56645440        domain.set_quantity('stage', expression='elevation+0.05')
    56655441        domain.check_integrity()
     5442       
    56665443
    56675444        assert num.allclose(domain.quantities['stage'].centroid_values,
     
    56975474            #FIXME(Ole): One might check the contents of msg here.
    56985475
    5699         W_EX = num.array([-0.02856422, -0.01453575, -0.02941048, -0.01431565, -0.02905243,
    5700        -0.01413527, -0.02878937, -0.01403079, -0.02884099, -0.0141491 ,
    5701        -0.02955122, -0.01410764, -0.07479625, -0.06138623, -0.07564908,
    5702        -0.06200901, -0.07551347, -0.06162397, -0.07491564, -0.06138228,
    5703        -0.07494649, -0.06158752, -0.07604196, -0.0621947 , -0.12364202,
    5704        -0.11028917, -0.12386763, -0.11077204, -0.12352128, -0.11047692,
    5705        -0.12286195, -0.10996273, -0.12263973, -0.11008993, -0.12360317,
    5706        -0.11059126, -0.17410112, -0.16070962, -0.17394514, -0.16076306,
    5707        -0.17328563, -0.16015092, -0.17200479, -0.15912379, -0.17108861,
    5708        -0.15887348, -0.17178364, -0.15930084, -0.19146029, -0.20647645,
    5709        -0.19695876, -0.20598706, -0.1938877 , -0.20407842, -0.18918618,
    5710        -0.20207992, -0.1870235 , -0.20259107, -0.19887788, -0.20371427,
    5711        -0.13029883, -0.13590279, -0.1300885 , -0.13870598, -0.12907624,
    5712        -0.13558385, -0.12468691, -0.1303495 , -0.11947742, -0.12585526,
    5713        -0.11243542, -0.12623977])
    5714 
    5715        
     5476       
     5477        W_EX = [-0.02695415, -0.01287006, -0.02818574, -0.01247623, -0.02768874,
     5478       -0.01207144, -0.02730899, -0.01194022, -0.02711282, -0.0117616 ,
     5479       -0.02738771, -0.01167069, -0.07749118, -0.06043846, -0.0769658 ,
     5480       -0.06184802, -0.07744466, -0.06141224, -0.07709613, -0.06116766,
     5481       -0.07718967, -0.06125268, -0.07747803, -0.06164894, -0.12285222,
     5482       -0.10929421, -0.12384982, -0.10947707, -0.12469478, -0.10954611,
     5483       -0.12449187, -0.10900107, -0.12404879, -0.1096133 , -0.12558555,
     5484       -0.11038741, -0.15781682, -0.1476446 , -0.15947493, -0.1506577 ,
     5485       -0.15901211, -0.15175708, -0.15914706, -0.15170165, -0.15922835,
     5486       -0.1509616 , -0.15923876, -0.15357957, -0.20664662, -0.1958594 ,
     5487       -0.2061699 , -0.19450922, -0.20595402, -0.19406777, -0.20433092,
     5488       -0.19402095, -0.20641805, -0.19359282, -0.20288242, -0.19214276,
     5489       -0.1369593 , -0.14305522, -0.13546369, -0.14427954, -0.13441821,
     5490       -0.14337654, -0.13422527, -0.14243224, -0.13457848, -0.14463175,
     5491       -0.13452416, -0.14353644]
     5492
     5493               
    57165494        assert num.allclose(domain.quantities['stage'].centroid_values, W_EX)
    57175495
    5718         # values pre revision 8403
    5719 #     [-0.02907028, -0.01475478, -0.02973417, -0.01447186, -0.02932665, -0.01428285,
    5720 #      -0.02901975, -0.0141361,  -0.02898816, -0.01418135, -0.02961409, -0.01403487,
    5721 #      -0.07597998, -0.06252591, -0.07664854, -0.06312532, -0.07638287, -0.06265139,
    5722 #      -0.07571145, -0.06235231, -0.0756817,  -0.06245309, -0.07652292, -0.06289946,
    5723 #      -0.12367464, -0.11088981, -0.12237277, -0.11115338, -0.1218934,  -0.1107174,
    5724 #      -0.12081485, -0.11000491, -0.12038451, -0.11010335, -0.12102113, -0.11012105,
    5725 #      -0.16909116, -0.15831543, -0.16730214, -0.15786249, -0.1665493,  -0.15697919,
    5726 #      -0.16496618, -0.15559852, -0.16338679, -0.15509088, -0.16364092, -0.15424423,
    5727 #      -0.18771107, -0.19903904, -0.18903759, -0.19858437, -0.18701552, -0.19697797,
    5728 #      -0.1833593,  -0.19505871, -0.1818806,  -0.19418042, -0.18586159, -0.19576946,
    5729 #      -0.13986873, -0.14170053, -0.14132188, -0.14560674, -0.14095617, -0.14373292,
    5730 #      -0.13785933, -0.14033364, -0.13592955, -0.13936356, -0.13596008, -0.14216296])
    5731 
    5732 
    5733 
    5734 
    5735         UH_EX = num.array([ 0.00869792,  0.003321  ,  0.00756643,  0.00344888,  0.00785009,
    5736         0.00357082,  0.00805061,  0.00362361,  0.00791928,  0.0034436 ,
    5737         0.00702931,  0.0030922 ,  0.02147923,  0.01422572,  0.01988038,
    5738         0.01332568,  0.01990566,  0.01363585,  0.02045457,  0.01378278,
    5739         0.02018036,  0.01335409,  0.01857885,  0.01250651,  0.0324787 ,
    5740         0.02414437,  0.03140816,  0.02293733,  0.03154705,  0.02317586,
    5741         0.03212877,  0.02363643,  0.03205507,  0.02318739,  0.03027674,
    5742         0.02224699,  0.04195105,  0.03302848,  0.04147282,  0.03228817,
    5743         0.04194204,  0.03275172,  0.04335877,  0.03388154,  0.044118  ,
    5744         0.03391709,  0.04235559,  0.03278699,  0.06416486,  0.04689968,
    5745         0.06405966,  0.04716946,  0.06609021,  0.04900066,  0.06913591,
    5746         0.05132586,  0.07362503,  0.05290551,  0.07169446,  0.05281069,
    5747         0.01536729,  0.04536714,  0.02162401,  0.05030179,  0.02280556,
    5748         0.0509393 ,  0.02309298,  0.05107956,  0.02378978,  0.05360493,
    5749         0.02910787,  0.07659445])
    5750 
    5751 
     5496
     5497
     5498       
     5499        UH_EX = [ 0.00788645,  0.00390814,  0.00711958,  0.00404466,  0.00733421,
     5500        0.00422702,  0.00752395,  0.00429491,  0.00761551,  0.00434995,
     5501        0.00721727,  0.00411432,  0.01646569,  0.0130111 ,  0.01644551,
     5502        0.01216501,  0.01615127,  0.01240563,  0.01643715,  0.01256101,
     5503        0.01627185,  0.01241143,  0.01595907,  0.01183127,  0.03255793,
     5504        0.02449605,  0.02992571,  0.02396898,  0.029099  ,  0.02421192,
     5505        0.02948018,  0.02487591,  0.03004103,  0.0239476 ,  0.0276319 ,
     5506        0.02260694,  0.07102764,  0.05530028,  0.06897196,  0.04924545,
     5507        0.07002517,  0.04776964,  0.06975088,  0.04800971,  0.06988388,
     5508        0.04914598,  0.06973173,  0.04401888,  0.08838727,  0.07422356,
     5509        0.08963216,  0.07728281,  0.08883881,  0.07725803,  0.08950098,
     5510        0.07783773,  0.0896763 ,  0.07812909,  0.09101014,  0.07680172,
     5511        0.01997572,  0.05705228,  0.02600184,  0.05722906,  0.02536524,
     5512        0.05605345,  0.02487505,  0.05552244,  0.02476363,  0.05634745,
     5513        0.02588648,  0.07443149]
     5514
     5515       
    57525516        assert num.allclose(domain.quantities['xmomentum'].centroid_values, UH_EX)
    57535517
     
    57695533
    57705534
    5771         VH_EX = num.array([  2.06796590e-04,  -3.29367998e-04,  -1.52220976e-04,
    5772         -3.11218696e-04,  -9.96075638e-05,  -3.20907741e-04,
    5773         -1.47981959e-04,  -3.67614843e-04,  -1.45709433e-04,
    5774         -2.98220604e-04,   1.34623078e-04,   1.02274843e-05,
    5775          6.76864794e-04,   2.95592677e-05,   7.98388735e-05,
    5776         -4.31239362e-04,  -4.23138310e-06,  -3.81398379e-04,
    5777         -5.45415024e-05,  -4.52983088e-04,  -5.62322523e-05,
    5778         -3.47588214e-04,   4.15802915e-04,   1.09334239e-04,
    5779          4.91188349e-04,   5.36833948e-04,   2.05803413e-04,
    5780         -5.71725948e-05,   1.39371595e-04,  -1.11790586e-04,
    5781         -4.77803087e-05,  -1.95979136e-04,  -1.71935352e-04,
    5782         -1.77069459e-04,   2.78181122e-04,   3.36866848e-04,
    5783         -4.66030597e-04,   2.75725661e-04,  -2.22665566e-04,
    5784          1.42608349e-04,  -7.27394206e-05,   2.27551349e-04,
    5785         -3.29907229e-04,   2.06966081e-05,  -8.32142218e-04,
    5786         -1.71984899e-04,  -6.30578370e-04,   1.76980898e-04,
    5787         -1.11523129e-03,  -1.49061122e-03,  -2.29647440e-03,
    5788         -1.13051481e-03,  -1.62504681e-03,  -1.03029647e-03,
    5789         -1.49833754e-03,  -1.31614997e-03,  -1.45428178e-03,
    5790         -9.22094733e-04,  -2.07382981e-03,  -6.56823266e-04,
    5791         -1.74291764e-03,  -5.23696518e-03,  -8.41662203e-03,
    5792         -8.71913710e-03,  -9.63951609e-03,  -8.07611833e-03,
    5793         -9.03057002e-03,  -7.75602645e-03,  -1.02340127e-02,
    5794         -9.49068686e-03,  -5.36492187e-03,  -2.52159160e-03])
    5795 
    5796 
     5535        VH_EX = [  3.24389373e-04,  -2.89562023e-04,  -1.88586166e-04,
     5536        -2.42370868e-04,  -4.27203357e-05,  -1.59405924e-04,
     5537         1.72058997e-05,  -1.89182601e-04,  -7.17849451e-05,
     5538        -2.62512543e-04,  -1.15231624e-04,  -5.30330999e-05,
     5539         1.65246942e-04,   1.01105926e-04,  -1.95515883e-04,
     5540        -3.52171991e-04,  -2.11327789e-04,  -1.71195081e-04,
     5541        -1.13571246e-04,  -1.21618757e-04,  -3.84072310e-05,
     5542        -5.70630953e-05,   1.99377831e-04,   7.26507645e-05,
     5543         1.21737397e-03,   5.00567549e-04,   1.33045862e-04,
     5544        -2.54549210e-04,  -2.69891715e-04,  -2.75002067e-04,
     5545        -2.25034310e-04,  -2.80881699e-04,  -3.83637499e-04,
     5546        -6.64640436e-05,   7.35727068e-04,   7.18052339e-04,
     5547         1.80525370e-03,   7.01677479e-04,   6.77099758e-04,
     5548        -1.61819203e-05,   5.43704204e-04,  -3.72049950e-04,
     5549         4.05465795e-04,  -2.63344137e-04,   5.19126755e-04,
     5550        -6.09877824e-04,  -4.60754612e-04,   3.76429746e-04,
     5551         2.84536503e-04,   1.59630418e-03,   3.76390114e-04,
     5552         5.95421898e-04,   2.82457784e-04,   5.47244203e-04,
     5553         3.84716877e-04,   7.71753954e-04,   2.31027297e-05,
     5554         3.69328529e-04,  -1.01941489e-03,   2.97123648e-04,
     5555        -1.50688255e-03,  -2.59013076e-03,  -2.47801719e-03,
     5556        -1.62973032e-03,  -1.46144964e-03,  -1.15516385e-03,
     5557        -1.53438382e-03,  -1.08374100e-03,  -1.69606444e-03,
     5558         2.83600865e-04,   3.68792917e-03,  -1.84496742e-03]
     5559
     5560
     5561       
    57975562        assert num.allclose(domain.quantities['ymomentum'].centroid_values, VH_EX)
    5798 
    5799         # Values pre revision 8403
    5800 #     [ 1.45876601e-004, -3.24627393e-004, -1.57572719e-004, -2.92790187e-004,
    5801 #      -9.90988382e-005, -3.06677335e-004, -1.62493106e-004, -3.71310004e-004,
    5802 #      -1.99445058e-004, -3.28493467e-004,  6.68217349e-005, -8.42042805e-006,
    5803 #       5.05093371e-004, -1.42842214e-004, -6.81454718e-005, -5.02084057e-004,
    5804 #      -8.50583861e-005, -4.65443981e-004, -1.96406564e-004, -5.88889562e-004,
    5805 #      -2.70160173e-004, -5.35485454e-004,  2.60780997e-004,  3.12145471e-005,
    5806 #       5.16189608e-004,  1.07069062e-004,  9.29989252e-005, -3.71211119e-004,
    5807 #       1.16350246e-004, -3.82407830e-004, -1.62077969e-004, -6.30906636e-004,
    5808 #      -4.74025708e-004, -6.94463009e-004,  6.15092843e-005,  2.22106820e-004,
    5809 #      -6.29589294e-004,  2.43611937e-004, -5.88125094e-004, -6.94293192e-005,
    5810 #      -4.17914641e-004,  6.64609019e-005, -7.68334577e-004, -3.40232101e-004,
    5811 #      -1.67424308e-003, -7.39485066e-004, -1.59966988e-003,  5.68262838e-005,
    5812 #      -1.48470633e-003, -1.84554882e-003, -2.27200099e-003, -1.67506848e-003,
    5813 #      -1.95610258e-003, -1.47638801e-003, -1.73779477e-003, -1.85498791e-003,
    5814 #      -2.01357843e-003, -2.17675471e-003, -1.65783870e-003, -1.15818681e-003,
    5815 #      -1.18663036e-003, -2.94229849e-003, -3.59309018e-003, -5.13496584e-003,
    5816 #      -6.17359400e-003, -5.98761937e-003, -6.00540116e-003, -5.01121966e-003,
    5817 #      -4.50964850e-003, -3.06319963e-003,  6.08950810e-004, -4.79537921e-004])
    58185563
    58195564        os.remove(domain.get_name() + '.sww')
     
    59825727            pass
    59835728
    5984 #        print domain.quantities['stage'].centroid_values[:4]
    5985 #        print domain.quantities['xmomentum'].centroid_values[:4]
    5986 #        print domain.quantities['ymomentum'].centroid_values[:4]
    5987         assert num.allclose(domain.quantities['stage'].centroid_values[:4],
    5988                             [ 0.001362,    0.01344294,  0.00308829, 0.01470289])
    5989         assert num.allclose(domain.quantities['xmomentum'].centroid_values[:4],
    5990                             [ 0.01300239,  0.00537933,  0.01214676,  0.00515825])
    5991         assert num.allclose(domain.quantities['ymomentum'].centroid_values[:4],
    5992                             [ -1.13165691e-03,  -6.55330189e-04,
    5993                               -6.62804076e-05,   5.26313051e-05])
     5729        #pprint(domain.quantities['stage'].centroid_values[:4])
     5730        #pprint(domain.quantities['xmomentum'].centroid_values[:4])
     5731        #pprint(domain.quantities['ymomentum'].centroid_values[:4])
     5732
     5733        W = domain.quantities['stage'].centroid_values[:4]
     5734        UH = domain.quantities['xmomentum'].centroid_values[:4]
     5735        VH = domain.quantities['ymomentum'].centroid_values[:4]
     5736       
     5737        W_0  = [ 0.001362,    0.01344294,  0.00308829, 0.01470289]
     5738        UH_0 = [ 0.01300239,  0.00537933,  0.01214676,  0.00515825]
     5739        VH_0 = [ -1.13165691e-03,  -6.55330189e-04, -6.62804076e-05,   5.26313051e-05]
     5740
     5741        W_1 = [ 0.00707892,  0.01849914,  0.00783274,  0.01997863]
     5742        UH_1 = [ 0.01512518,  0.00354391,  0.01503765,  0.00326075]
     5743        VH_1 = [  5.36531332e-04,  -6.77297008e-04,  -4.58560426e-05, 2.47714988e-05]
     5744
     5745
     5746        assert num.allclose(W,W_0) or num.allclose(W,W_1)
     5747        assert num.allclose(UH, UH_0) or num.allclose(UH, UH_1)
     5748        assert num.allclose(VH, VH_0) or num.allclose(VH, VH_1)
     5749       
     5750       
     5751                           
    59945752
    59955753        # old values pre revision 8402
     
    61695927        # and verify that results at right hand side are close.
    61705928        cv2 = domain2.quantities['stage'].centroid_values
    6171 
     5929       
    61725930        assert num.allclose(num.take(cv1, (0,8,16), axis=0),
    6173                             num.take(cv2, (0,3,8), axis=0))      # Diag
     5931                            num.take(cv2, (0,3,8), axis=0), rtol=1.0e-4)      # Diag
    61745932        assert num.allclose(num.take(cv1, (0,6,12), axis=0),
    6175                             num.take(cv2, (0,1,4), axis=0))      # Bottom
     5933                            num.take(cv2, (0,1,4), axis=0), rtol=1.0e-4)      # Bottom
    61765934        assert num.allclose(num.take(cv1, (12,14,16), axis=0),
    6177                             num.take(cv2, (4,6,8), axis=0))      # RHS
     5935                            num.take(cv2, (4,6,8), axis=0), rtol=1.0e-4)      # RHS
    61785936
    61795937        # Cleanup
     
    77317489
    77327490
    7733     def test_variable_elevation(self):           
     7491    def test_variable_elevation_de0(self):           
    77347492        """test_variable_elevation
    77357493
     
    77647522                                            'stage': 2})
    77657523
     7524        #pprint(domain.get_algorithm_parameters())
    77667525        #---------------------------------------------------------------------
    77677526        # Setup initial conditions
     
    77847543        domain.set_quantity('elevation', 0.0)    # Flat bed initially
    77857544        domain.set_quantity('friction', 0.01)    # Constant friction
    7786         domain.set_quantity('stage', 0.0)        # Dry initial condition
     7545        domain.set_quantity('stage', 10.0)        # Dry initial condition
    77877546
    77887547        #------------------------------------------------------------------
    77897548        # Setup boundary conditions
    77907549        #------------------------------------------------------------------
    7791         Bi = Dirichlet_boundary([0.4, 0, 0])          # Inflow
     7550        Bi = Dirichlet_boundary([10.0, 0, 0])          # Inflow
     7551        Br = Reflective_boundary(domain)              # Solid reflective wall
     7552        Bo = Dirichlet_boundary([-5, 0, 0])           # Outflow
     7553
     7554        domain.set_boundary({'left': Bi, 'right': Bo, 'top': Br, 'bottom': Br})
     7555
     7556        #-------------------------------------------------------------------
     7557        # Evolve system through time
     7558        #-------------------------------------------------------------------
     7559
     7560        for t in domain.evolve(yieldstep=1, finaltime=3.0):
     7561            #print domain.timestepping_statistics()
     7562
     7563            domain.add_quantity('elevation', pole_increment, location='centroids')
     7564       
     7565           
     7566        # Check that quantities have been stored correctly   
     7567        sww_file = domain.get_name() + '.sww'
     7568        fid = NetCDFFile(sww_file)
     7569
     7570        stage = fid.variables['stage_c'][:]
     7571        elevation = fid.variables['elevation_c'][:]
     7572        fid.close()
     7573
     7574        os.remove(sww_file)
     7575       
     7576                   
     7577        assert len(stage.shape) == 2
     7578        assert len(elevation.shape) == 2       
     7579       
     7580        M, N = stage.shape
     7581               
     7582        for i in range(M):
     7583            # For each timestep
     7584            assert num.allclose(max(elevation[i,:]), i * inc)
     7585
     7586    def test_variable_elevation_1_5(self):           
     7587        """test_variable_elevation
     7588
     7589        This will test that elevagtion van be stored in sww files
     7590        as a time dependent quantity.
     7591       
     7592        It will also chck that storage of other quantities
     7593        can be controlled this way.
     7594        """
     7595
     7596        #---------------------------------------------------------------------
     7597        # Import necessary modules
     7598        #---------------------------------------------------------------------
     7599        from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
     7600
     7601        #---------------------------------------------------------------------
     7602        # Setup computational domain
     7603        #---------------------------------------------------------------------
     7604        length = 8.
     7605        width = 6.
     7606        dx = dy = 1    # Resolution: Length of subdivisions on both axes
     7607       
     7608        inc = 0.05 # Elevation increment
     7609
     7610        points, vertices, boundary = rectangular_cross(int(length/dx),
     7611                                                       int(width/dy),
     7612                                                       len1=length,
     7613                                                       len2=width)
     7614        domain = Domain(points, vertices, boundary)
     7615        domain.set_flow_algorithm('1_5')
     7616        domain.set_name('channel_variable_test')  # Output name
     7617        domain.set_quantities_to_be_stored({'elevation': 2,
     7618                                            'stage': 2})
     7619
     7620        #---------------------------------------------------------------------
     7621        # Setup initial conditions
     7622        #---------------------------------------------------------------------
     7623
     7624        def pole_increment(x,y):
     7625            """This provides a small increment to a pole located mid stream
     7626            For use with variable elevation data
     7627            """
     7628           
     7629            z = 0.0*x
     7630
     7631            N = len(x)
     7632            for i in range(N):
     7633                # Pole
     7634                if (x[i] - 4)**2 + (y[i] - 2)**2 < 1.0**2:
     7635                    z[i] += inc
     7636            return z
     7637           
     7638        domain.set_quantity('elevation', 0.0)    # Flat bed initially
     7639        domain.set_quantity('friction', 0.01)    # Constant friction
     7640        domain.set_quantity('stage', 10.0)        # Dry initial condition
     7641
     7642        #------------------------------------------------------------------
     7643        # Setup boundary conditions
     7644        #------------------------------------------------------------------
     7645        Bi = Dirichlet_boundary([10.0, 0, 0])          # Inflow
    77927646        Br = Reflective_boundary(domain)              # Solid reflective wall
    77937647        Bo = Dirichlet_boundary([-5, 0, 0])           # Outflow
     
    78257679        for i in range(M):
    78267680            # For each timestep
    7827             assert num.allclose(max(elevation[i,:]), i * inc)
    7828        
     7681            assert num.allclose(max(elevation[i,:]), i * inc) 
     7682           
     7683                 
    78297684    def test_inflow_using_flowline(self):
    78307685        """test_inflow_using_flowline
     
    86668521if __name__ == "__main__":
    86678522    #suite = unittest.makeSuite(Test_Shallow_Water, 'test_extrapolate_second_order_sw')
    8668     suite = unittest.makeSuite(Test_Shallow_Water, 'test_')
     8523    suite = unittest.makeSuite(Test_Shallow_Water, 'test_flatbed_second_order')
    86698524    runner = unittest.TextTestRunner(verbosity=1)
    86708525    runner.run(suite)
  • trunk/anuga_core/anuga/shallow_water/tests/test_sww_interrogate.py

    r9550 r9733  
    4343                pass     
    4444   
    45    
    46     def test_get_maximum_inundation(self):
     45
     46    def test_get_maximum_inundation_de0(self):
    4747        """Test that sww information can be converted correctly to maximum
    4848        runup elevation and location (without and with georeferencing)
     
    6464        # Create shallow water domain
    6565        domain = Domain(points, vertices, boundary)
     66        domain.default_order = 2
     67        domain.set_minimum_storable_height(0.01)
     68
     69        filename = 'runup_test_3'
     70        domain.set_name(filename)
     71        swwfile = domain.get_name() + '.sww'
     72
     73        domain.set_datadir('.')
     74        domain.format = 'sww'
     75        domain.smooth = True
     76
     77        # FIXME (Ole): Backwards compatibility
     78        # Look at sww file and see what happens when
     79        # domain.tight_slope_limiters = 1
     80        domain.tight_slope_limiters = 0
     81        domain.use_centroid_velocities = 0 # Backwards compatibility (7/5/8)       
     82       
     83        Br = Reflective_boundary(domain)
     84        Bd = Dirichlet_boundary([1.0,0,0])
     85
     86
     87        #---------- First run without geo referencing
     88       
     89        domain.set_quantity('elevation', lambda x,y: -0.2*x + 14) # Slope
     90        domain.set_quantity('stage', -6)
     91        domain.set_boundary( {'left': Br, 'right': Bd, 'top': Br, 'bottom': Br})
     92
     93        for t in domain.evolve(yieldstep=1, finaltime = 50):
     94            pass
     95
     96
     97        # Check maximal runup
     98        runup = get_maximum_inundation_elevation(swwfile)
     99        location = get_maximum_inundation_location(swwfile)
     100        #print 'Runup, location', runup, location
     101        assert num.allclose(runup, 4.66666666667)
     102        assert num.allclose(location[0], 46.666668)
     103               
     104        # Check final runup
     105        runup = get_maximum_inundation_elevation(swwfile, time_interval=[45,50])
     106        location = get_maximum_inundation_location(swwfile, time_interval=[45,50])
     107        #print 'Runup, location:',runup, location
     108
     109        assert num.allclose(runup, 3.81481488546)
     110        assert num.allclose(location[0], 51.666668)
     111
     112        # Check runup restricted to a polygon
     113        p = [[50,1], [99,1], [99,49], [50,49]]
     114        runup = get_maximum_inundation_elevation(swwfile, polygon=p)
     115        location = get_maximum_inundation_location(swwfile, polygon=p)
     116        #print runup, location
     117
     118        assert num.allclose(runup, 3.81481488546)
     119        assert num.allclose(location[0], 51.6666666)               
     120
     121        # Check that mimimum_storable_height works
     122        fid = NetCDFFile(swwfile, netcdf_mode_r) # Open existing file
     123       
     124        stage = fid.variables['stage_c'][:]
     125        z = fid.variables['elevation_c'][:]
     126        xmomentum = fid.variables['xmomentum_c'][:]
     127        ymomentum = fid.variables['ymomentum_c'][:]
     128       
     129        for i in range(stage.shape[0]):
     130            h = stage[i]-z # depth vector at time step i
     131           
     132            # Check every node location
     133            for j in range(stage.shape[1]):
     134                # Depth being either exactly zero implies
     135                # momentum being zero.
     136                # Or else depth must be greater than or equal to
     137                # the minimal storable height
     138                if h[j] == 0.0:
     139                    assert xmomentum[i,j] == 0.0
     140                    assert ymomentum[i,j] == 0.0               
     141                else:
     142                    assert h[j] >= 0.0
     143       
     144        fid.close()
     145
     146        # Cleanup
     147        os.remove(swwfile)
     148       
     149
     150
     151        #------------- Now the same with georeferencing
     152
     153        domain.time=0.0
     154        E = 308500
     155        N = 6189000
     156        #E = N = 0
     157        domain.geo_reference = Geo_reference(56, E, N)
     158
     159        domain.set_quantity('elevation', lambda x,y: -0.2*x + 14) # Slope
     160        domain.set_quantity('stage', -6)
     161        domain.set_boundary( {'left': Br, 'right': Bd, 'top': Br, 'bottom': Br})
     162
     163        for t in domain.evolve(yieldstep=1, finaltime = 50):
     164            pass
     165
     166        # Check maximal runup
     167        runup = get_maximum_inundation_elevation(swwfile)
     168        location = get_maximum_inundation_location(swwfile)
     169
     170        #print runup, location
     171
     172        assert num.allclose(runup,4.66666666667)
     173        assert num.allclose(location[0], 308546.66)
     174
     175        # Check final runup
     176        runup = get_maximum_inundation_elevation(swwfile, time_interval=[45,50])
     177        location = get_maximum_inundation_location(swwfile, time_interval=[45,50])
     178       
     179        #print runup, location
     180        #1.66666666667 [308561.66, 6189006.5]
     181
     182        assert num.allclose(runup, 3.81481488546)
     183        assert num.allclose(location[0], 308551.66)
     184
     185        # Check runup restricted to a polygon
     186        p = num.array([[50,1], [99,1], [99,49], [50,49]], num.int) + num.array([E, N], num.int)      #array default#
     187
     188        runup = get_maximum_inundation_elevation(swwfile, polygon=p)
     189        location = get_maximum_inundation_location(swwfile, polygon=p)
     190
     191        #print runup, location
     192
     193        assert num.allclose(runup, 3.81481488546)
     194        assert num.allclose(location[0], 308551.66)               
     195
     196
     197        # Cleanup
     198        os.remove(swwfile)
     199
     200
     201    def test_get_maximum_inundation_1_5(self):
     202        """Test that sww information can be converted correctly to maximum
     203        runup elevation and location (without and with georeferencing)
     204
     205        This test creates a slope and a runup which is maximal (~11m) at around 10s
     206        and levels out to the boundary condition (1m) at about 30s.
     207        """
     208
     209        import time, os
     210        from anuga.file.netcdf import NetCDFFile
     211
     212        #Setup
     213
     214        #from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular
     215
     216        # Create basic mesh (100m x 100m)
     217        points, vertices, boundary = rectangular(20, 5, 100, 50)
     218
     219        # Create shallow water domain
     220        domain = Domain(points, vertices, boundary)
     221        domain.set_flow_algorithm('1_5')
    66222        domain.default_order = 2
    67223        domain.set_minimum_storable_height(0.01)
     
    8831039 
    8841040if __name__ == "__main__":
    885     suite = unittest.makeSuite(Test_sww_Interrogate, 'test')#_get_maximum_inundation_from_sww')
     1041    suite = unittest.makeSuite(Test_sww_Interrogate, 'test_')#_get_maximum_inundation_from_sww')
    8861042    runner = unittest.TextTestRunner() #verbosity=2)
    8871043    runner.run(suite)
  • trunk/anuga_core/anuga/shallow_water/tests/test_system.py

    r9452 r9733  
    156156                           domain,  use_cache=False, verbose=False)
    157157
     158
    158159        # Setup boundary conditions
    159160        domain.set_boundary({'exterior': Bf})
     
    163164            #domain.write_time()
    164165            #print "domain.time", domain.time
     166
    165167
    166168        # do an assertion on the time of the produced sww file
     
    178180        msg += "Not logic. "
    179181        msg += "It's testing that starttime is working"
    180         assert num.allclose(stage[2,0], 4.7981238),msg
     182        assert num.allclose(stage[2,0], 4.85825),msg
    181183       
    182184       
     
    185187        os.remove(boundary_filename)
    186188        os.remove(filename)
    187        
     189 
     190    def test_boundary_timeII_1_5(self):
     191        """
     192        test_boundary_timeII(self):
     193        Test that starttime can be set in the middle of a boundary condition
     194        """
     195       
     196        boundary_starttime = 0
     197        boundary_filename = self.create_sww_boundary(boundary_starttime)
     198        #print "boundary_filename",boundary_filename
     199       
     200        filename = tempfile.mktemp(".sww")
     201        #print "filename",filename
     202        dir, base = os.path.split(filename)
     203        senario_name = base[:-4]
     204 
     205        mesh = Mesh()
     206        mesh.add_region_from_polygon([[10,10], [90,10], [90,90], [10,90]])
     207        mesh.generate_mesh(verbose=False)
     208       
     209        domain = pmesh_to_domain_instance(mesh, anuga.Domain)
     210        domain.set_name(senario_name)                 
     211        domain.set_datadir(dir)
     212        domain.set_flow_algorithm('1_5')
     213        new_starttime = 0.
     214        domain.set_starttime(new_starttime)
     215
     216        # Setup initial conditions
     217        domain.set_quantity('elevation', 0.0)
     218        domain.set_quantity('stage', 0.0)         
     219        Bf = anuga.File_boundary(boundary_filename,
     220                           domain,  use_cache=False, verbose=False)
     221
     222
     223        # Setup boundary conditions
     224        domain.set_boundary({'exterior': Bf})
     225        for t in domain.evolve(yieldstep = 5, finaltime = 9.0):
     226            pass
     227            #print domain.boundary_statistics()
     228            #domain.write_time()
     229            #print "domain.time", domain.time
     230
     231
     232        # do an assertion on the time of the produced sww file
     233        fid = NetCDFFile(filename, netcdf_mode_r)    #Open existing file for read
     234        times = fid.variables['time'][:]
     235        stage = fid.variables['stage'][:]
     236        #print stage
     237        #print "times", times
     238        #print "fid.starttime", fid.starttime
     239        assert num.allclose(fid.starttime, new_starttime)
     240        fid.close()
     241       
     242        #print "stage[2,0]", stage[2,0]
     243        msg = "This test is a bit hand crafted, based on the output file. "
     244        msg += "Not logic. "
     245        msg += "It's testing that starttime is working"
     246        assert num.allclose(stage[2,0], 4.88601),msg
     247       
     248       
     249
     250        # clean up
     251        os.remove(boundary_filename)
     252        os.remove(filename)
     253               
    188254#-------------------------------------------------------------
    189255
  • trunk/anuga_core/anuga/validation_utilities/parameters.py

    r9161 r9733  
    77__date__ ="$20/08/2012 11:20:00 PM$"
    88
    9 alg = 'DE0'
     9alg = 'DE1'
    1010cfl = 1.0
    1111
  • trunk/anuga_core/examples/channel2.py

    r8728 r9733  
    1616dx = dy = 1.           # Resolution: Length of subdivisions on both axes
    1717
    18 points, vertices, boundary = anuga.rectangular_cross(int(length/dx),
    19                                         int(width/dy), len1=length, len2=width)
     18domain = anuga.rectangular_cross_domain(int(length/dx), int(width/dy),
     19                                        len1=length, len2=width)
    2020                                       
    21 domain = anuga.Domain(points, vertices, boundary)   
     21
    2222domain.set_name('channel2')                 # Output name
    2323
  • trunk/anuga_core/examples/channel3.py

    r9309 r9733  
    1616dx = dy = .1           # Resolution: Length of subdivisions on both axes
    1717
    18 points, vertices, boundary = anuga.rectangular_cross(int(length/dx),
    19                                          int(width/dy), len1=length, len2=width)
    20 domain = anuga.Domain(points, vertices, boundary)
     18domain = anuga.rectangular_cross_domain(int(length/dx), int(width/dy),
     19                                        len1=length, len2=width)
     20
    2121domain.set_name('channel3')                  # Output name
    22 domain.set_flow_algorithm('DE0')
     22
    2323print domain.statistics()
    2424
  • trunk/anuga_core/validation_tests/analytical_exact/subcritical_depth_expansion/numerical_depth_expansion.py

    r9372 r9733  
    1616from numpy import zeros, ones, float
    1717from time import localtime, strftime, gmtime
    18 from anuga.structures.inlet_operator import Inlet_operator
    19 #from balanced_dev import *
     18from anuga import Inlet_operator
     19
    2020
    2121
  • trunk/anuga_core/validation_tests/behaviour_only/bridge_hecras/channel_floodplain1.py

    r9731 r9733  
    8888                                   breaklines=breakLines.values(),
    8989                                   regionPtArea=regionPtAreas,
    90                                    verbose=True)
     90                                   verbose=verbose)
    9191    domain=anuga.create_domain_from_file('channel_floodplain1.msh')
    9292    domain.set_name('channel_floodplain1') # Output name
  • trunk/anuga_core/validation_tests/behaviour_only/bridge_hecras2/channel_floodplain1.py

    r9633 r9733  
    1313from anuga.parallel import distribute, myid, numprocs, finalize, barrier
    1414from anuga.structures.internal_boundary_functions import hecras_internal_boundary_function
     15
    1516args = anuga.get_args()
    1617alg = args.alg
     
    194195    use_velocity_head=False,
    195196    smoothing_timescale=30.0,
    196     logging=True)
     197    logging=verbose)
    197198   
    198199#------------------------------------------------------------------------------
     
    241242
    242243for t in domain.evolve(yieldstep=10.0, finaltime=dtQdata*(len(Qdata)-2)):
    243     if(myid==0):
     244    if(myid==0 and verbose):
    244245        print domain.timestepping_statistics()
    245246
  • trunk/anuga_core/validation_tests/experimental_data/dam_break_yeh_petroff/numerical_Yeh_Petroff.py

    r9731 r9733  
    1414from numpy import zeros, float
    1515from time import localtime, strftime, gmtime
    16 #from balanced_dev import *
     16
    1717from anuga.geometry.polygon import inside_polygon, is_inside_triangle
    1818
     
    2727verbose = args.verbose
    2828
     29output_file = 'dam_break'
     30output_dir = '.'
    2931
    3032time = strftime('%Y%m%d_%H%M%S',localtime())
  • trunk/anuga_core/validation_tests/reports/validations_produce_results.py

    r9729 r9733  
    2222#---------------------------------
    2323timestamp = time.asctime()
    24 major_revision = anuga.__version__
     24major_revision = anuga.get_version()
    2525try:
    2626    # This fails if using git for version control
    27     minor_revision = anuga.utilities.system_tools.get_revision_number()
     27    minor_revision = anuga.get_revision_number()
    2828except:
    2929    try:
     
    145145
    146146
    147 os.system('python all_tests_typeset_report.py')
     147os.system('python validations_typeset_report.py')
    148148
    149149import subprocess
    150 cmd = 'mv all_tests_report.pdf all_tests_report_cfl_%s_alg_%s.pdf' % (str(cfl), str(alg))
     150cmd = 'mv validations_report.pdf validations_report_alg_%s.pdf' % (str(alg))
    151151print cmd
    152152subprocess.call([cmd], shell=True)
  • trunk/anuga_core/validation_tests/reports/validations_report.tex

    r9729 r9733  
    4949The results in this report were produced by \anuga{} version \majorR{} from svn
    5050repository revision \minorR{} at time \timeR.
    51 The flow algorithm was \alg{}, unless otherwise stated explicitly. Based on this version,
    52 26 tests are available in the subversion. To get an automated report,
    53 we can run either an individual run of the available tests or the complete (whole) test.
     51The flow algorithm used was \alg{}, unless otherwise stated explicitly.
     52
     53To get an automated report,
     54we can run either run individual tests or the complete (whole) test.
    5455
    5556To do an individual test, we can run the python module \\
     
    5758available in the corresponding test directory. The module will do the
    5859numerical simulation of the given problem, plot the simulation
    59 results in png files, and type-set the corresponding
     60results in png files, and typeset the corresponding
    6061individual automated report. The individual automated report is in
    61 pdf file and saved in the same directory.
     62the pdf file \verb report.pdf saved in the same directory.
    6263
    6364To do the complete test, we can just run the python module \\
    64 \verb all_tests_produce_results.py \\
     65\verb validations_produce_results.py \\
    6566available in the directory \\
    6667\verb validation_tests/reports \\
     
    6869will do the numerical simulations of all the given problems,
    6970plot results in png files and save them in its corresponding directory,
    70 and finally type-set the complete report. The complete automated report is saved in this directory.
     71and finally type-set the complete report. The complete automated report is saved in the
     72\verb validation_tests/reports   directory.
    7173
    7274The simulation results can be analysed qualitatively and quantitatively.
     
    108110The report is organised as follows. We collect a number of tests against
    109111analytical exact solutions in Chapter~\ref{ch:ana}. Tests against other
    110 reference data or solutions are given in Chapter~\ref{ch:ref}.
    111 We provide explanations on how to add new tests in the Appendix.
     112reference data or solutions are given in Chapter~\ref{ch:ref}. Tests against
     113realistic case studies are given in Chapter~\ref{ch:casestudy}, but at present
     114these are not included in this document because they take too much time to run,
     115although the code is provided the source. We provide explanations on how to add
     116new tests in the Appendix.
    112117
    113118%======================
     
    151156\inputresults{../behaviour_only/weir_1}
    152157\inputresults{../behaviour_only/bridge_hecras}
     158\inputresults{../behaviour_only/bridge_hecras2}
    153159\inputresults{../behaviour_only/lateral_weir_hecras}
    154160\inputresults{../behaviour_only/tides_hecras}
     
    157163\inputresults{../other_references/radial_dam_break_wet}
    158164
     165%%======================
     166\chapter{Realistic large-scale cases} \label{ch:casestudy}
     167%%======================
     168Code for a number of realistic applications is in the case\_studies directory,
     169however they are not included here by default, because they take a long time to
     170run.
    159171
    160172%======================
  • trunk/anuga_core/validation_tests/reports/validations_typeset_report.py

    r9730 r9733  
    1111import os
    1212
    13 os.system('pdflatex -shell-escape  -interaction=batchmode all_tests_report.tex')
    14 os.system('bibtex all_tests_report')
    15 os.system('pdflatex -shell-escape  -interaction=batchmode all_tests_report.tex')
    16 os.system('pdflatex -shell-escape  -interaction=batchmode all_tests_report.tex')
     13os.system('pdflatex -shell-escape  -interaction=batchmode validations_report.tex')
     14os.system('bibtex validations_report')
     15os.system('pdflatex -shell-escape  -interaction=batchmode validations_report.tex')
     16os.system('pdflatex -shell-escape  -interaction=batchmode validations_report.tex')
    1717
Note: See TracChangeset for help on using the changeset viewer.