Changeset 4783


Ignore:
Timestamp:
Nov 5, 2007, 2:11:10 PM (16 years ago)
Author:
duncan
Message:

modified to aid in debugging

Location:
anuga_validation/automated_validation_tests/okushiri_tank_validation
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • anuga_validation/automated_validation_tests/okushiri_tank_validation/create_okushiri.py

    r4555 r4783  
    145145
    146146
    147 
    148 
    149 #-------------------------------------------------------------
    150 if __name__ == "__main__":
    151 
    152 
     147def create_mesh(elevation_in_mesh=False):
    153148    # Prepare time boundary
    154149    prepare_timeboundary(project.boundary_filename)
     
    165160                                 use_cache=False,
    166161                                 verbose=True)
     162   
     163    if elevation_in_mesh is True:
     164        fit_to_mesh_file(project.mesh_filename, project.bathymetry_filename,
     165                         project.mesh_filename)
    167166
     167
     168#-------------------------------------------------------------
     169if __name__ == "__main__":
     170    create_mesh()
     171
     172
  • anuga_validation/automated_validation_tests/okushiri_tank_validation/run_okushiri.py

    r4719 r4783  
    2929import project
    3030
    31 
    32 #-------------------------
    33 # Create Domain from mesh
    34 #-------------------------
    35 domain = Domain(project.mesh_filename, use_cache=False, verbose=True)
    36 print domain.statistics()
     31def main(elevation_in_mesh=False):
     32    #-------------------------
     33    # Create Domain from mesh
     34    #-------------------------
     35    domain = Domain(project.mesh_filename, use_cache=False, verbose=True)
     36    print domain.statistics()
    3737
    3838
    39 #-------------------------
    40 # Initial Conditions
    41 #-------------------------
    42 domain.set_quantity('friction', 0.0)
    43 domain.set_quantity('stage', 0.0)
    44 domain.set_quantity('elevation',
    45                     filename=project.bathymetry_filename,
    46                     alpha=0.02,                   
    47                     verbose=True,
    48                     use_cache=False)
     39    #-------------------------
     40    # Initial Conditions
     41    #-------------------------
     42    domain.set_quantity('friction', 0.0)
     43    domain.set_quantity('stage', 0.0)
     44    if elevation_in_mesh is False:
     45        domain.set_quantity('elevation',
     46                            filename=project.bathymetry_filename,
     47                            alpha=0.02,                   
     48                            verbose=True,
     49                            use_cache=False)
    4950
    5051
    51 #-------------------------
    52 # Set simulation parameters
    53 #-------------------------
    54 domain.set_name(project.output_filename)  # Name of output sww file
    55 domain.set_default_order(2)               # Apply second order scheme
    56 domain.set_all_limiters(0.9)              # Max second order scheme (old lim)
    57 domain.set_minimum_storable_height(0.001) # Don't store w < 0.001m
    58 domain.set_maximum_allowed_speed(0.0)     # No runoff (though 0.1 is OK)
    59 domain.set_quantities_to_be_monitored('stage')
     52    #-------------------------
     53    # Set simulation parameters
     54    #-------------------------
     55    domain.set_name(project.output_filename)  # Name of output sww file
     56    domain.set_default_order(2)               # Apply second order scheme
     57    domain.set_all_limiters(0.9)              # Max second order scheme
     58                                              # (old lim)
     59    domain.set_minimum_storable_height(0.001) # Don't store w < 0.001m
     60    domain.set_maximum_allowed_speed(0.0)     # No runoff (though 0.1 is OK)
     61    domain.set_quantities_to_be_monitored('stage')
    6062
    61 # New slope limiter and first order h-limiter
    62 # (this in planned to be the default!)
    63 domain.beta_h = 0.0
    64 domain.tight_slope_limiters = 1 # Run time invariant in this case
     63    # New slope limiter and first order h-limiter
     64    # (this in planned to be the default!)
     65    domain.beta_h = 0.0
     66    domain.tight_slope_limiters = 1 # Run time invariant in this case
    6567
    66 #-------------------------
    67 # Boundary Conditions
    68 #-------------------------
     68    #-------------------------
     69    # Boundary Conditions
     70    #-------------------------
    6971
    70 # Create boundary function from timeseries provided in file
    71 function = file_function(project.boundary_filename,
    72                          domain, verbose=True)
     72    # Create boundary function from timeseries provided in file
     73    function = file_function(project.boundary_filename,
     74                             domain, verbose=True)
    7375
    74 # Create and assign boundary objects
    75 Bts = Transmissive_Momentum_Set_Stage_boundary(domain, function)
    76 Br = Reflective_boundary(domain)
    77 domain.set_boundary({'wave': Bts, 'wall': Br})
     76    # Create and assign boundary objects
     77    Bts = Transmissive_Momentum_Set_Stage_boundary(domain, function)
     78    Br = Reflective_boundary(domain)
     79    domain.set_boundary({'wave': Bts, 'wall': Br})
    7880
    7981
    80 #-------------------------
    81 # Evolve through time
    82 #-------------------------
    83 import time
    84 t0 = time.time()
     82    #-------------------------
     83    # Evolve through time
     84    #-------------------------
     85    import time
     86    t0 = time.time()
    8587
    86 for t in domain.evolve(yieldstep = 0.05, finaltime = 22.5):
    87     domain.write_time()
    88     print domain.quantity_statistics(precision='%.12f')
     88    for t in domain.evolve(yieldstep = 0.05, finaltime = 22.5):
     89        domain.write_time()
     90        print domain.quantity_statistics(precision='%.12f')
    8991
    90 print 'That took %.2f seconds' %(time.time()-t0)
     92    print 'That took %.2f seconds' %(time.time()-t0)
     93
     94#-------------------------------------------------------------
     95if __name__ == "__main__":
     96    main()
  • anuga_validation/automated_validation_tests/okushiri_tank_validation/validate_okushiri.py

    r4781 r4783  
    99class Test_Okushiri(unittest.TestCase):
    1010    def setUp(self):
    11         pass
    12        
    13     def tearDown(self):
    14         pass
    15 
    16     def test_that_output_is_as_expected(self):
    1711       
    1812        # Remove garbage
     
    2317                os.remove(file)
    2418               
     19       
     20    def tearDown(self):
     21        pass
     22
     23    def test_that_output_is_as_expected(self):
    2524
    2625        #print
     
    4039        assert res == 0
    4140
     41    def manual_test_that_output_is_as_expected(self):
     42        from run_okushiri import main
     43        from create_okushiri import create_mesh
    4244
     45        # Note, this has not been tested when code is failing.
     46        # Next step, use the parrameter elevation_in_mesh
     47        # and only run create_okishiri once for speed.
     48       
     49        res = create_mesh()
     50        assert res == None
     51       
     52        res = main()
     53        assert res == None
     54       
     55        s = 'compare_timeseries_with_measures.py'
     56        #print s
     57        res = os.system('python %s > compare_timeseries_with_measures.stdout'\
     58                        %s)
     59        assert res == 0
     60       
    4361
    4462#-------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.