Changeset 5181
- Timestamp:
- Mar 31, 2008, 4:39:49 PM (17 years ago)
- 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 1404 1404 return -x 1405 1405 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 1407 1408 1408 1409 This is testing the gauge_sww2csv function, by creating a sww file and … … 1410 1411 """ 1411 1412 1412 # create mesh1413 # Create mesh 1413 1414 mesh_file = tempfile.mktemp(".tsh") 1414 1415 points = [[0.0,0.0],[6.0,0.0],[6.0,6.0],[0.0,6.0]] … … 1419 1420 m.export_mesh_file(mesh_file) 1420 1421 1421 # Create shallow water domain1422 # Create shallow water domain 1422 1423 domain = Domain(mesh_file) 1423 1424 os.remove(mesh_file) … … 1425 1426 domain.default_order=2 1426 1427 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 1429 1435 domain.set_quantity('elevation', elevation_function) 1430 1436 domain.set_quantity('friction', 0.03) … … 1446 1452 domain.smooth = True 1447 1453 domain.reduction = mean 1454 1448 1455 1449 1456 sww = get_dataobject(domain) … … 1468 1475 1469 1476 sww2csv_gauges(sww.filename, 1470 1471 1472 1477 points_file, 1478 verbose=False, 1479 use_cache=False) 1473 1480 1474 1481 # point1_answers_array = [[0.0,1.0,-5.0,3.0,4.0], [2.0,10.0,-5.0,3.0,4.0]] … … 1521 1528 return -x 1522 1529 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 1524 1532 1525 1533 This is testing the gauge_sww2csv function, by creating a sww file and … … 1530 1538 """ 1531 1539 1532 # create mesh1540 # Create mesh 1533 1541 mesh_file = tempfile.mktemp(".tsh") 1534 1542 points = [[0.0,0.0],[6.0,0.0],[6.0,6.0],[0.0,6.0]] … … 1539 1547 m.export_mesh_file(mesh_file) 1540 1548 1541 # Create shallow water domain1549 # Create shallow water domain 1542 1550 domain = Domain(mesh_file) 1543 1551 os.remove(mesh_file) … … 1546 1554 domain.beta_h = 0 1547 1555 1548 # Set some field values1556 # Set some field values 1549 1557 domain.set_quantity('elevation', elevation_function) 1550 1558 domain.set_quantity('friction', 0.03) … … 1633 1641 return -x 1634 1642 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 1636 1645 1637 1646 This is testing the gauge_sww2csv function, by creating a sww file and 1638 1647 then exporting the gauges and checking the results. 1639 1648 1640 This is the same as sww2csv_gauges except set domain.set_starttime to 5. Therefore1641 testing the storing of the absolute time in the csv files1649 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 1642 1651 """ 1643 1652 1644 # create mesh1653 # Create mesh 1645 1654 mesh_file = tempfile.mktemp(".tsh") 1646 1655 points = [[0.0,0.0],[6.0,0.0],[6.0,6.0],[0.0,6.0]] … … 1651 1660 m.export_mesh_file(mesh_file) 1652 1661 1653 # Create shallow water domain1662 # Create shallow water domain 1654 1663 domain = Domain(mesh_file) 1655 1664 os.remove(mesh_file) … … 1658 1667 domain.beta_h = 0 1659 1668 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 1661 1674 domain.set_quantity('elevation', elevation_function) 1662 1675 domain.set_quantity('friction', 0.03) -
anuga_core/source/anuga/abstract_2d_finite_volumes/util.py
r5166 r5181 1965 1965 verbose=False): 1966 1966 1967 '''this will read a csv file with the header x,y. Then look in a square 'size'x21968 around this position for the 'max_inundaiton_height' in the 'sww_filename' and1969 report the findings in the 'runup_filename1970 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 """ 1973 1973 1974 1974 from anuga.shallow_water.data_manager import get_all_directories_with_name,\ … … 2002 2002 if x_y==None: x_y=[0,0] 2003 2003 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) 2005 2006 2006 2007 #writes to file … … 2009 2010 file.write(temp) 2010 2011 file.close() 2012 2011 2013 2012 2014 def sww2csv_gauges(sww_file, 2013 2015 gauge_file, 2014 quantities = ['stage','depth', 'elevation', 'xmomentum', 'ymomentum'], 2016 quantities = ['stage', 'depth', 'elevation', 2017 'xmomentum', 'ymomentum'], 2015 2018 verbose=False, 2016 2019 use_cache = True): … … 2019 2022 Inputs: 2020 2023 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. 2024 2028 2025 2029 sww_file: path to any sww file … … 2030 2034 point2, 10.3, 70.3, 78.0 2031 2035 2032 NOTE: order of column can change but names eg 'easting', elevation'2036 NOTE: order of column can change but names eg 'easting', 'elevation' 2033 2037 must be the same! ALL lowercaps! 2034 2038 2035 Outputs: 2039 Outputs: 2036 2040 one file for each gauge/point location in the points file. They 2037 2041 will be named with this format in the same directory as the 'sww_file' … … 2041 2045 2042 2046 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') 2045 2049 2046 2050 Interpolate the quantities at a given set of locations, given … … 2055 2059 2056 2060 This is really returning speed, not velocity. 2057 2058 2059 """ 2061 2062 2063 """ 2064 2060 2065 from csv import reader,writer 2061 2066 from anuga.utilities.numerical_tools import ensure_numeric, mean, NAN 2062 from Numeric import array, resize, shape,Float,zeros,take,argsort,argmin2067 from Numeric import array, resize, shape, Float, zeros, take, argsort, argmin 2063 2068 import string 2064 2069 from anuga.shallow_water.data_manager import get_all_swwfiles -
anuga_core/source/anuga/config.py
r5175 r5181 86 86 # tight_slope_limiters = 0 means use old limiters (e.g. for some tests) 87 87 # tight_slope_limiters = 1 means use new limiters that hug the bathymetry closer 88 tight_slope_limiters = 088 tight_slope_limiters = True 89 89 90 90 -
anuga_core/source/anuga/fit_interpolate/test_interpolate.py
r4820 r5181 1582 1582 return -x 1583 1583 1584 # create mesh1584 # Create mesh 1585 1585 mesh_file = tempfile.mktemp(".tsh") 1586 1586 points = [[0.0,0.0],[6.0,0.0],[6.0,6.0],[0.0,6.0]] … … 1591 1591 m.export_mesh_file(mesh_file) 1592 1592 1593 # Create shallow water domain1593 # Create shallow water domain 1594 1594 domain = Domain(mesh_file) 1595 1595 os.remove(mesh_file) 1596 1596 1597 domain.default_order =21597 domain.default_order = 2 1598 1598 domain.beta_h = 0 1599 1599 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 1601 1605 domain.set_quantity('elevation', elevation_function) 1602 1606 domain.set_quantity('friction', 0.03) … … 1622 1626 sww.store_connectivity() 1623 1627 sww.store_timestep(['stage', 'xmomentum', 'ymomentum']) 1624 domain.set_quantity('stage', 10.0) # This is automatically lim mited1625 # so it will not be less than the elevation1628 domain.set_quantity('stage', 10.0) # This is automatically limited 1629 # So it will not be less than the elevation 1626 1630 domain.time = 2. 1627 1631 sww.store_timestep(['stage', 'xmomentum', 'ymomentum']) 1628 1632 1629 # test the function1633 # Test the function 1630 1634 points = [[5.0,1.],[0.5,2.]] 1631 1635 depth_file = tempfile.mktemp(".csv")
Note: See TracChangeset
for help on using the changeset viewer.