[3640] | 1 | """Validation of the AnuGA implementation of the shallow water wave equation. |
---|
| 2 | |
---|
[4022] | 3 | This script sets up Okushiri Island benchmark as published at the |
---|
[3640] | 4 | |
---|
[4022] | 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/ |
---|
[3640] | 10 | |
---|
[4022] | 11 | |
---|
| 12 | The validation data was downloaded and made available in this directory |
---|
| 13 | for convenience but the original data is available at |
---|
[3640] | 14 | http://www.cee.cornell.edu/longwave/index.cfm?page=benchmark&problem=2 |
---|
[4022] | 15 | where a detailed description of the problem is also available. |
---|
[3640] | 16 | |
---|
| 17 | |
---|
[4022] | 18 | Run create_okushiri.py to process the boundary condition and build a the |
---|
| 19 | mesh before running this script. |
---|
| 20 | |
---|
[3640] | 21 | """ |
---|
| 22 | |
---|
| 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 |
---|
| 28 | |
---|
[4022] | 29 | # from anuga_parallel.parallel_api import myid, numprocs, distribute |
---|
[3640] | 30 | |
---|
| 31 | import project |
---|
| 32 | |
---|
| 33 | |
---|
| 34 | #------------------------- |
---|
[4022] | 35 | # Create Domain from mesh |
---|
[3640] | 36 | #------------------------- |
---|
| 37 | domain = Domain(project.mesh_filename, use_cache=True, verbose=True) |
---|
[4022] | 38 | print domain.statistics() |
---|
[3640] | 39 | |
---|
[4022] | 40 | |
---|
[3640] | 41 | #------------------------- |
---|
| 42 | # Initial Conditions |
---|
| 43 | #------------------------- |
---|
| 44 | domain.set_quantity('friction', 0.0) |
---|
| 45 | domain.set_quantity('stage', 0.0) |
---|
| 46 | domain.set_quantity('elevation', |
---|
[4022] | 47 | filename=project.bathymetry_filename, |
---|
| 48 | alpha=0.02, |
---|
| 49 | verbose=True, |
---|
| 50 | use_cache=True) |
---|
[3640] | 51 | |
---|
| 52 | |
---|
| 53 | #------------------------- |
---|
[4022] | 54 | # Distribute domain if run in parallel |
---|
[3640] | 55 | #------------------------- |
---|
[4022] | 56 | if numprocs > 1: |
---|
| 57 | domain = distribute(domain) |
---|
[3640] | 58 | |
---|
[3648] | 59 | |
---|
[4022] | 60 | #------------------------- |
---|
| 61 | # Set simulation parameters |
---|
| 62 | #------------------------- |
---|
| 63 | domain.set_name(project.output_filename) # Name of output sww file |
---|
| 64 | domain.set_default_order(2) # Apply second order scheme |
---|
| 65 | domain.set_all_limiters(0.9) # Max second order scheme (old lim) |
---|
| 66 | domain.set_minimum_storable_height(0.001) # Don't store w < 0.001m |
---|
| 67 | domain.set_maximum_allowed_speed(0.1) # Allow a little runoff (0.1 is OK) |
---|
[3829] | 68 | |
---|
| 69 | |
---|
[4022] | 70 | #------------------------- |
---|
| 71 | # Boundary Conditions |
---|
| 72 | #------------------------- |
---|
[3829] | 73 | |
---|
[4022] | 74 | # Create boundary function from timeseries provided in file |
---|
| 75 | function = file_function(project.boundary_filename, |
---|
| 76 | domain, verbose=True) |
---|
[3829] | 77 | |
---|
[4022] | 78 | # Create and assign boundary objects |
---|
[3645] | 79 | Bts = Transmissive_Momentum_Set_Stage_boundary(domain, function) |
---|
[4022] | 80 | Br = Reflective_boundary(domain) |
---|
| 81 | domain.set_boundary({'wave': Bts, 'wall': Br}) |
---|
[3645] | 82 | |
---|
[3648] | 83 | |
---|
[3640] | 84 | #------------------------- |
---|
| 85 | # Evolve through time |
---|
| 86 | #------------------------- |
---|
| 87 | import time |
---|
| 88 | t0 = time.time() |
---|
| 89 | |
---|
| 90 | for t in domain.evolve(yieldstep = 0.05, finaltime = 22.5): |
---|
| 91 | domain.write_time() |
---|
| 92 | |
---|
[4022] | 93 | print 'That took %.2f seconds' %(time.time()-t0) |
---|