Changeset 6237 for anuga_validation


Ignore:
Timestamp:
Jan 29, 2009, 3:00:47 AM (16 years ago)
Author:
ole
Message:

Comments regarding ticket:314 and cleanup

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.
     2First cache is cleared, then set_quantity is run twice checking that
     3fitting is evaluated only first time and that the result from cache on the
     4second round is correct.
    25
    3 This script sets up Okushiri Island benchmark as published at the
     6This 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.
    49
    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.
    2511
    2612# Module imports
     
    3016import project
    3117import Numeric as num
     18import time
    3219
    33 internal_verbose = False # Verbose used in set_quantity and passed into fit_to_mesh
     20internal_verbose = True # Verbose used in set_quantity and passed into fit_to_mesh
    3421
    3522filename=project.bathymetry_filename
     
    5037          'alpha': alpha,
    5138          '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!
    5340          'mesh_origin': None,
    5441          'data_origin': None,
     
    8067#-------------------------
    8168#print 'Set elevation and cache'
     69t0 = time.time()
    8270domain.set_quantity('elevation',
    8371                    filename=filename,
     
    8573                    verbose=internal_verbose,
    8674                    use_cache=True)
     75compute_time = time.time()-t0
    8776                   
    8877ref = domain.get_quantity('elevation').get_values()                   
     
    10089
    10190# Now check this using the high level call
    102 #print 'Try to read in via cache'
     91
     92print 'Try to read in via cache'
     93t0 = time.time()
    10394domain.set_quantity('elevation',
    10495                    filename=filename,
     
    10697                    verbose=internal_verbose,
    10798                    use_cache=True)
     99cache_time = time.time()-t0                   
    108100                   
    109101res = domain.get_quantity('elevation').get_values()                                       
    110102assert num.allclose(res, ref)
     103
     104print 'cache_time', cache_time
     105print 'compute_time', compute_time
     106assert cache_time < compute_time/10
Note: See TracChangeset for help on using the changeset viewer.