[2229] | 1 | """Validation of the AnuGA implementation of the shallow water wave equation. |
---|
| 2 | |
---|
[3845] | 3 | This script sets up Okushiri Island benchmark as published at the |
---|
[2229] | 4 | |
---|
[3845] | 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/ |
---|
[2229] | 10 | |
---|
[3845] | 11 | |
---|
| 12 | The validation data was downloaded and made available in this directory |
---|
| 13 | for convenience but the original data is available at |
---|
[2229] | 14 | http://www.cee.cornell.edu/longwave/index.cfm?page=benchmark&problem=2 |
---|
[3845] | 15 | where a detailed description of the problem is also available. |
---|
[2229] | 16 | |
---|
[3845] | 17 | |
---|
| 18 | Run create_okushiri.py to process the boundary condition and build a the |
---|
| 19 | mesh before running this script. |
---|
| 20 | |
---|
[2229] | 21 | """ |
---|
| 22 | |
---|
[3647] | 23 | # Module imports |
---|
| 24 | from anuga.shallow_water import Domain |
---|
| 25 | from anuga.shallow_water import Reflective_boundary |
---|
| 26 | from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary |
---|
| 27 | from anuga.abstract_2d_finite_volumes.util import file_function |
---|
[2229] | 28 | |
---|
| 29 | import project |
---|
| 30 | |
---|
| 31 | |
---|
[3647] | 32 | #------------------------- |
---|
[3845] | 33 | # Create Domain from mesh |
---|
[3647] | 34 | #------------------------- |
---|
[3845] | 35 | domain = Domain(project.mesh_filename, use_cache=True, verbose=True) |
---|
[3859] | 36 | print domain.statistics() |
---|
[2229] | 37 | |
---|
[3883] | 38 | |
---|
[3845] | 39 | #------------------------- |
---|
| 40 | # Initial Conditions |
---|
| 41 | #------------------------- |
---|
| 42 | domain.set_quantity('friction', 0.0) |
---|
| 43 | domain.set_quantity('stage', 0.0) |
---|
| 44 | domain.set_quantity('elevation', |
---|
[3850] | 45 | filename=project.bathymetry_filename, |
---|
| 46 | alpha=0.02, |
---|
| 47 | verbose=True, |
---|
| 48 | use_cache=True) |
---|
[2229] | 49 | |
---|
[3883] | 50 | |
---|
[3845] | 51 | #------------------------- |
---|
[3883] | 52 | # Set simulation parameters |
---|
| 53 | #------------------------- |
---|
[3850] | 54 | domain.set_name(project.output_filename) # Name of output sww file |
---|
| 55 | domain.set_default_order(2) # Apply second order scheme |
---|
[3878] | 56 | domain.set_all_limiters(0.9) # Max second order scheme (old lim) |
---|
[5231] | 57 | domain.set_minimum_storable_height(0.001) # Don't store h < 0.001m |
---|
[5424] | 58 | domain.tight_slope_limiters = True |
---|
[4257] | 59 | domain.beta_h = 0.0 |
---|
[3716] | 60 | |
---|
[4260] | 61 | #Timings on AMD64-242 (beta_h=0) |
---|
[4631] | 62 | # tight_slope_limiters = 0: |
---|
[4260] | 63 | # 3035s - 3110s |
---|
[4631] | 64 | # tight_slope_limiters = 1: |
---|
[4260] | 65 | # 3000s - 3008s |
---|
| 66 | # |
---|
| 67 | # beta_h>0: In the order of 3200s |
---|
| 68 | |
---|
[3647] | 69 | #------------------------- |
---|
[2229] | 70 | # Boundary Conditions |
---|
[3647] | 71 | #------------------------- |
---|
[2229] | 72 | |
---|
[3845] | 73 | # Create boundary function from timeseries provided in file |
---|
[3850] | 74 | function = file_function(project.boundary_filename, |
---|
[3845] | 75 | domain, verbose=True) |
---|
[3647] | 76 | |
---|
[3845] | 77 | # Create and assign boundary objects |
---|
[2229] | 78 | Bts = Transmissive_Momentum_Set_Stage_boundary(domain, function) |
---|
[3845] | 79 | Br = Reflective_boundary(domain) |
---|
| 80 | domain.set_boundary({'wave': Bts, 'wall': Br}) |
---|
[2229] | 81 | |
---|
| 82 | |
---|
[4836] | 83 | # Select triangle containing ch5 for diagnostic output |
---|
| 84 | # around known gauge |
---|
| 85 | triangle_id = domain.get_triangle_containing_point([4.521, 1.196]) |
---|
| 86 | # This should get triangle id 32833 with centroid (4.5244, 1.1972) |
---|
| 87 | |
---|
| 88 | |
---|
[3647] | 89 | #------------------------- |
---|
| 90 | # Evolve through time |
---|
| 91 | #------------------------- |
---|
[2229] | 92 | import time |
---|
| 93 | t0 = time.time() |
---|
| 94 | |
---|
[5083] | 95 | for t in domain.evolve(yieldstep = 0.05, finaltime = 22.5): |
---|
[5082] | 96 | print domain.timestepping_statistics(track_speeds=False, |
---|
[4836] | 97 | triangle_id=triangle_id) |
---|
[2229] | 98 | |
---|
| 99 | print 'That took %.2f seconds' %(time.time()-t0) |
---|