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