Changeset 6237 for anuga_validation
- Timestamp:
- Jan 29, 2009, 3:00:47 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_validation/okushiri_2005/test_caching_of_set_quantity.py
r6232 r6237 1 """Validation of the AnuGA implementation of the shallow water wave equation. 1 """This script tests that caching works for set_quantity using point data from a file. 2 First cache is cleared, then set_quantity is run twice checking that 3 fitting is evaluated only first time and that the result from cache on the 4 second round is correct. 2 5 3 This script sets up Okushiri Island benchmark as published at the 6 This script depends on Benchmark_2.msh and Benchmark_2_Bathymetry.pts 7 """ 8 # FIXME(Ole): This needs to become a unit test - in automated validation tests under Okushiri. 4 9 5 THE THIRD INTERNATIONAL WORKSHOP ON LONG-WAVE RUNUP MODELS 6 June 17-18 2004 7 Wrigley Marine Science Center 8 Catalina Island, California 9 http://www.cee.cornell.edu/longwave/ 10 11 12 The validation data was downloaded and made available in this directory 13 for convenience but the original data is available at 14 http://www.cee.cornell.edu/longwave/index.cfm?page=benchmark&problem=2 15 where a detailed description of the problem is also available. 16 17 18 Run create_okushiri.py to process the boundary condition and build a the 19 mesh before running this script. 20 21 22 """ 23 # NOTE: Cache should be cleared before running this script 24 10 # FIXME(Ole): This won't work until ticket:314 has been fixed. 25 11 26 12 # Module imports … … 30 16 import project 31 17 import Numeric as num 18 import time 32 19 33 internal_verbose = False # Verbose used in set_quantity and passed into fit_to_mesh20 internal_verbose = True # Verbose used in set_quantity and passed into fit_to_mesh 34 21 35 22 filename=project.bathymetry_filename … … 50 37 'alpha': alpha, 51 38 'verbose': internal_verbose, 52 'acceptable_overshoot': 1.01, # This is the default value in _fit_to_mesh 39 'acceptable_overshoot': 1.01, # This is the default value in _fit_to_mesh - actually, not implemented. Remove! 53 40 'mesh_origin': None, 54 41 'data_origin': None, … … 80 67 #------------------------- 81 68 #print 'Set elevation and cache' 69 t0 = time.time() 82 70 domain.set_quantity('elevation', 83 71 filename=filename, … … 85 73 verbose=internal_verbose, 86 74 use_cache=True) 75 compute_time = time.time()-t0 87 76 88 77 ref = domain.get_quantity('elevation').get_values() … … 100 89 101 90 # Now check this using the high level call 102 #print 'Try to read in via cache' 91 92 print 'Try to read in via cache' 93 t0 = time.time() 103 94 domain.set_quantity('elevation', 104 95 filename=filename, … … 106 97 verbose=internal_verbose, 107 98 use_cache=True) 99 cache_time = time.time()-t0 108 100 109 101 res = domain.get_quantity('elevation').get_values() 110 102 assert num.allclose(res, ref) 103 104 print 'cache_time', cache_time 105 print 'compute_time', compute_time 106 assert cache_time < compute_time/10
Note: See TracChangeset
for help on using the changeset viewer.