Changeset 5181


Ignore:
Timestamp:
Mar 31, 2008, 4:39:49 PM (17 years ago)
Author:
ole
Message:

Made tight_slope_limiters = True the default.
Fixed a few tests
Did some cosmetics as per style guide.

Location:
anuga_core/source/anuga
Files:
4 edited

Legend:

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

    r5166 r5181  
    14041404            return -x
    14051405       
    1406         """Most of this test was copied from test_interpolate test_interpole_sww2csv
     1406        """Most of this test was copied from test_interpolate
     1407        test_interpole_sww2csv
    14071408       
    14081409        This is testing the gauge_sww2csv function, by creating a sww file and
     
    14101411        """
    14111412       
    1412         # create mesh
     1413        # Create mesh
    14131414        mesh_file = tempfile.mktemp(".tsh")   
    14141415        points = [[0.0,0.0],[6.0,0.0],[6.0,6.0],[0.0,6.0]]
     
    14191420        m.export_mesh_file(mesh_file)
    14201421       
    1421         #Create shallow water domain
     1422        # Create shallow water domain
    14221423        domain = Domain(mesh_file)
    14231424        os.remove(mesh_file)
     
    14251426        domain.default_order=2
    14261427        domain.beta_h = 0
    1427 
    1428         #Set some field values
     1428       
     1429        # This test was made before tight_slope_limiters were introduced
     1430        # Since were are testing interpolation values this is OK
     1431        domain.tight_slope_limiters = 0
     1432       
     1433
     1434        # Set some field values
    14291435        domain.set_quantity('elevation', elevation_function)
    14301436        domain.set_quantity('friction', 0.03)
     
    14461452        domain.smooth = True
    14471453        domain.reduction = mean
     1454
    14481455
    14491456        sww = get_dataobject(domain)
     
    14681475       
    14691476        sww2csv_gauges(sww.filename,
    1470                             points_file,
    1471                             verbose=False,
    1472                             use_cache=False)
     1477                       points_file,
     1478                       verbose=False,
     1479                       use_cache=False)
    14731480
    14741481#        point1_answers_array = [[0.0,1.0,-5.0,3.0,4.0], [2.0,10.0,-5.0,3.0,4.0]]
     
    15211528            return -x
    15221529       
    1523         """Most of this test was copied from test_interpolate test_interpole_sww2csv
     1530        """Most of this test was copied from test_interpolate
     1531        test_interpole_sww2csv
    15241532       
    15251533        This is testing the gauge_sww2csv function, by creating a sww file and
     
    15301538        """
    15311539       
    1532         # create mesh
     1540        # Create mesh
    15331541        mesh_file = tempfile.mktemp(".tsh")   
    15341542        points = [[0.0,0.0],[6.0,0.0],[6.0,6.0],[0.0,6.0]]
     
    15391547        m.export_mesh_file(mesh_file)
    15401548       
    1541         #Create shallow water domain
     1549        # Create shallow water domain
    15421550        domain = Domain(mesh_file)
    15431551        os.remove(mesh_file)
     
    15461554        domain.beta_h = 0
    15471555
    1548         #Set some field values
     1556        # Set some field values
    15491557        domain.set_quantity('elevation', elevation_function)
    15501558        domain.set_quantity('friction', 0.03)
     
    16331641            return -x
    16341642       
    1635         """Most of this test was copied from test_interpolate test_interpole_sww2csv
     1643        """Most of this test was copied from test_interpolate
     1644        test_interpole_sww2csv
    16361645       
    16371646        This is testing the gauge_sww2csv function, by creating a sww file and
    16381647        then exporting the gauges and checking the results.
    16391648       
    1640         This is the same as sww2csv_gauges except set domain.set_starttime to 5. Therefore
    1641         testing the storing of the absolute time in the csv files
     1649        This is the same as sww2csv_gauges except set domain.set_starttime to 5.
     1650        Therefore testing the storing of the absolute time in the csv files
    16421651        """
    16431652       
    1644         # create mesh
     1653        # Create mesh
    16451654        mesh_file = tempfile.mktemp(".tsh")   
    16461655        points = [[0.0,0.0],[6.0,0.0],[6.0,6.0],[0.0,6.0]]
     
    16511660        m.export_mesh_file(mesh_file)
    16521661       
    1653         #Create shallow water domain
     1662        # Create shallow water domain
    16541663        domain = Domain(mesh_file)
    16551664        os.remove(mesh_file)
     
    16581667        domain.beta_h = 0
    16591668
    1660         #Set some field values
     1669        # This test was made before tight_slope_limiters were introduced
     1670        # Since were are testing interpolation values this is OK
     1671        domain.tight_slope_limiters = 0         
     1672
     1673        # Set some field values
    16611674        domain.set_quantity('elevation', elevation_function)
    16621675        domain.set_quantity('friction', 0.03)
  • anuga_core/source/anuga/abstract_2d_finite_volumes/util.py

    r5166 r5181  
    19651965                                           verbose=False):
    19661966
    1967     '''this will read a csv file with the header x,y. Then look in a square 'size'x2
    1968     around this position for the 'max_inundaiton_height' in the 'sww_filename' and
    1969     report the findings in the 'runup_filename
    1970    
    1971     WARNING: NO TESTS!
    1972     '''
     1967    """this will read a csv file with the header x,y. Then look in a square
     1968    'size'x2 around this position for the 'max_inundaiton_height' in the
     1969    'sww_filename' and report the findings in the 'runup_filename
     1970   
     1971    WARNING: NO TESTS! 
     1972    """
    19731973
    19741974    from anuga.shallow_water.data_manager import get_all_directories_with_name,\
     
    20022002        if x_y==None: x_y=[0,0]
    20032003       
    2004         if verbose:print 'maximum inundation runup near %s is %s meters' %(x_y,run_up)
     2004        if verbose:
     2005            print 'maximum inundation runup near %s is %s meters' %(x_y,run_up)
    20052006       
    20062007        #writes to file
     
    20092010        file.write(temp)
    20102011        file.close()
     2012       
    20112013
    20122014def sww2csv_gauges(sww_file,
    20132015                   gauge_file,
    2014                    quantities = ['stage','depth', 'elevation', 'xmomentum', 'ymomentum'],
     2016                   quantities = ['stage', 'depth', 'elevation',
     2017                                 'xmomentum', 'ymomentum'],
    20152018                   verbose=False,
    20162019                   use_cache = True):
     
    20192022    Inputs:
    20202023       
    2021         NOTE: if using csv2timeseries_graphs after creating csv file, it is essential to
    2022         export quantities 'depth' and 'elevation'. 'depth' is good to analyse gauges on
    2023         land and elevation is used automatically by csv2timeseries_graphs in the legend.
     2024        NOTE: if using csv2timeseries_graphs after creating csv file,
     2025        it is essential to export quantities 'depth' and 'elevation'.
     2026        'depth' is good to analyse gauges on land and elevation is used
     2027        automatically by csv2timeseries_graphs in the legend.
    20242028       
    20252029        sww_file: path to any sww file
     
    20302034            point2, 10.3, 70.3, 78.0
    20312035       
    2032         NOTE: order of column can change but names eg 'easting', elevation'
     2036        NOTE: order of column can change but names eg 'easting', 'elevation'
    20332037        must be the same! ALL lowercaps!
    20342038       
    2035     Outputs:
     2039    Outputs: 
    20362040        one file for each gauge/point location in the points file. They
    20372041        will be named with this format in the same directory as the 'sww_file'
     
    20412045   
    20422046    Usage: gauges_sww2csv(sww_file='test1.sww',
    2043                quantities = ['stage', 'elevation','depth','bearing'],
    2044                gauge_file='gauge.txt')   
     2047                          quantities = ['stage', 'elevation','depth','bearing'],
     2048                          gauge_file='gauge.txt')   
    20452049   
    20462050    Interpolate the quantities at a given set of locations, given
     
    20552059
    20562060    This is really returning speed, not velocity.
    2057    
    2058    
    2059     """
     2061     
     2062   
     2063    """
     2064   
    20602065    from csv import reader,writer
    20612066    from anuga.utilities.numerical_tools import ensure_numeric, mean, NAN
    2062     from Numeric import array, resize,shape,Float,zeros,take,argsort,argmin
     2067    from Numeric import array, resize, shape, Float, zeros, take, argsort, argmin
    20632068    import string
    20642069    from anuga.shallow_water.data_manager import get_all_swwfiles
  • anuga_core/source/anuga/config.py

    r5175 r5181  
    8686# tight_slope_limiters = 0 means use old limiters (e.g. for some tests)
    8787# tight_slope_limiters = 1 means use new limiters that hug the bathymetry closer
    88 tight_slope_limiters = 0
     88tight_slope_limiters = True
    8989
    9090
  • anuga_core/source/anuga/fit_interpolate/test_interpolate.py

    r4820 r5181  
    15821582            return -x
    15831583       
    1584         # create mesh
     1584        # Create mesh
    15851585        mesh_file = tempfile.mktemp(".tsh")   
    15861586        points = [[0.0,0.0],[6.0,0.0],[6.0,6.0],[0.0,6.0]]
     
    15911591        m.export_mesh_file(mesh_file)
    15921592       
    1593         #Create shallow water domain
     1593        # Create shallow water domain
    15941594        domain = Domain(mesh_file)
    15951595        os.remove(mesh_file)
    15961596       
    1597         domain.default_order=2
     1597        domain.default_order = 2
    15981598        domain.beta_h = 0
    15991599
    1600         #Set some field values
     1600        # This test was made before tight_slope_limiters were introduced
     1601        # Since were are testing interpolation values this is OK
     1602        domain.tight_slope_limiters = 0
     1603
     1604        # Set some field values
    16011605        domain.set_quantity('elevation', elevation_function)
    16021606        domain.set_quantity('friction', 0.03)
     
    16221626        sww.store_connectivity()
    16231627        sww.store_timestep(['stage', 'xmomentum', 'ymomentum'])
    1624         domain.set_quantity('stage', 10.0) # This is automatically limmited
    1625         # so it will not be less than the elevation
     1628        domain.set_quantity('stage', 10.0) # This is automatically limited
     1629        # So it will not be less than the elevation
    16261630        domain.time = 2.
    16271631        sww.store_timestep(['stage', 'xmomentum', 'ymomentum'])
    16281632
    1629         # test the function
     1633        # Test the function
    16301634        points = [[5.0,1.],[0.5,2.]]
    16311635        depth_file = tempfile.mktemp(".csv")
Note: See TracChangeset for help on using the changeset viewer.