Changeset 4783
- Timestamp:
- Nov 5, 2007, 2:11:10 PM (17 years ago)
- 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 145 145 146 146 147 148 149 #------------------------------------------------------------- 150 if __name__ == "__main__": 151 152 147 def create_mesh(elevation_in_mesh=False): 153 148 # Prepare time boundary 154 149 prepare_timeboundary(project.boundary_filename) … … 165 160 use_cache=False, 166 161 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) 167 166 167 168 #------------------------------------------------------------- 169 if __name__ == "__main__": 170 create_mesh() 171 172 -
anuga_validation/automated_validation_tests/okushiri_tank_validation/run_okushiri.py
r4719 r4783 29 29 import project 30 30 31 32 #-------------------------33 # Create Domain from mesh34 #-------------------------35 domain = Domain(project.mesh_filename, use_cache=False, verbose=True)36 print domain.statistics()31 def 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() 37 37 38 38 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) 49 50 50 51 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') 60 62 61 # New slope limiter and first order h-limiter62 # (this in planned to be the default!)63 domain.beta_h = 0.064 domain.tight_slope_limiters = 1 # Run time invariant in this case63 # 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 65 67 66 #-------------------------67 # Boundary Conditions68 #-------------------------68 #------------------------- 69 # Boundary Conditions 70 #------------------------- 69 71 70 # Create boundary function from timeseries provided in file71 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) 73 75 74 # Create and assign boundary objects75 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}) 78 80 79 81 80 #-------------------------81 # Evolve through time82 #-------------------------83 import time84 t0 = time.time()82 #------------------------- 83 # Evolve through time 84 #------------------------- 85 import time 86 t0 = time.time() 85 87 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') 89 91 90 print 'That took %.2f seconds' %(time.time()-t0) 92 print 'That took %.2f seconds' %(time.time()-t0) 93 94 #------------------------------------------------------------- 95 if __name__ == "__main__": 96 main() -
anuga_validation/automated_validation_tests/okushiri_tank_validation/validate_okushiri.py
r4781 r4783 9 9 class Test_Okushiri(unittest.TestCase): 10 10 def setUp(self): 11 pass12 13 def tearDown(self):14 pass15 16 def test_that_output_is_as_expected(self):17 11 18 12 # Remove garbage … … 23 17 os.remove(file) 24 18 19 20 def tearDown(self): 21 pass 22 23 def test_that_output_is_as_expected(self): 25 24 26 25 #print … … 40 39 assert res == 0 41 40 41 def manual_test_that_output_is_as_expected(self): 42 from run_okushiri import main 43 from create_okushiri import create_mesh 42 44 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 43 61 44 62 #-------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.