1 | """Validation of the AnuGA implementation of the shallow water wave equation. |
---|
2 | |
---|
3 | This script sets up Okushiri Island benchmark as published at the |
---|
4 | |
---|
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 | # Module imports |
---|
24 | import anuga |
---|
25 | import project |
---|
26 | #from balanced_dev import * |
---|
27 | from bal_and import * |
---|
28 | #from anuga_tsunami import * |
---|
29 | |
---|
30 | def main(elevation_in_mesh=False): |
---|
31 | #------------------------- |
---|
32 | # Create Domain from mesh |
---|
33 | #------------------------- |
---|
34 | domain = Domain(project.mesh_filename, use_cache=False, verbose=True) |
---|
35 | print domain.statistics() |
---|
36 | |
---|
37 | |
---|
38 | #------------------------- |
---|
39 | # Initial Conditions |
---|
40 | #------------------------- |
---|
41 | domain.set_quantity('friction', 0.0) |
---|
42 | domain.set_quantity('stage', 0.0) |
---|
43 | if elevation_in_mesh is False: |
---|
44 | domain.set_quantity('elevation', |
---|
45 | filename=project.bathymetry_filename, |
---|
46 | alpha=0.02, |
---|
47 | verbose=True, |
---|
48 | use_cache=False) |
---|
49 | |
---|
50 | |
---|
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_minimum_storable_height(0.001) # Don't store w < 0.001m |
---|
57 | domain.set_quantities_to_be_monitored('stage') |
---|
58 | |
---|
59 | #------------------------- |
---|
60 | # Boundary Conditions |
---|
61 | #------------------------- |
---|
62 | |
---|
63 | # Create boundary function from timeseries provided in file |
---|
64 | function = anuga.file_function(project.boundary_filename, |
---|
65 | domain, verbose=True) |
---|
66 | |
---|
67 | # Create and assign boundary objects |
---|
68 | Bts = anuga.Transmissive_momentum_set_stage_boundary(domain, function) |
---|
69 | Br = anuga.Reflective_boundary(domain) |
---|
70 | domain.set_boundary({'wave': Bts, 'wall': Br}) |
---|
71 | |
---|
72 | |
---|
73 | #------------------------- |
---|
74 | # Evolve through time |
---|
75 | #------------------------- |
---|
76 | import time |
---|
77 | t0 = time.time() |
---|
78 | |
---|
79 | for t in domain.evolve(yieldstep = 0.05, finaltime = 22.5): |
---|
80 | domain.write_time() |
---|
81 | print domain.quantity_statistics(precision='%.12f') |
---|
82 | |
---|
83 | print 'That took %.2f seconds' %(time.time()-t0) |
---|
84 | |
---|
85 | #------------------------------------------------------------- |
---|
86 | if __name__ == "__main__": |
---|
87 | main() |
---|