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 | z = domain.get_vertex_coordinates() |
---|
43 | |
---|
44 | # Write vertex coordinates to file |
---|
45 | filename='okushiri_mesh_vertex_coordinates_truescale.txt' |
---|
46 | fid=open(filename,'w') |
---|
47 | fid.write('x (m), y (m)\n') |
---|
48 | for i in range(len(z)): |
---|
49 | pt=z[i] |
---|
50 | x=pt[0] |
---|
51 | y=pt[1] |
---|
52 | fid.write('%.6f, %.6f\n' %(x, y)) |
---|
53 | |
---|
54 | #------------------------- |
---|
55 | # Initial Conditions |
---|
56 | #------------------------- |
---|
57 | domain.set_quantity('friction', 0.0) |
---|
58 | domain.set_quantity('stage', 0.0) |
---|
59 | domain.set_quantity('elevation', |
---|
60 | filename=project_truescale.bathymetry_filename, |
---|
61 | alpha=0.02, |
---|
62 | verbose=True, |
---|
63 | use_cache=True) |
---|
64 | |
---|
65 | |
---|
66 | #------------------------- |
---|
67 | # Set simulation parameters |
---|
68 | #------------------------- |
---|
69 | domain.set_name(project_truescale.output_filename) # Name of output sww file |
---|
70 | domain.set_datadir(project_truescale.output_dir) |
---|
71 | domain.set_default_order(2) # Apply second order scheme |
---|
72 | domain.set_all_limiters(0.9) # Max second order scheme (old lim) |
---|
73 | domain.set_minimum_storable_height(0.4) # Don't store h < 0.4m |
---|
74 | domain.tight_slope_limiters = 1 |
---|
75 | domain.beta_h = 0.0 |
---|
76 | |
---|
77 | #Timings on AMD64-242 (beta_h=0) |
---|
78 | # tight_slope_limiters = 0: |
---|
79 | # 3035s - 3110s |
---|
80 | # tight_slope_limiters = 1: |
---|
81 | # 3000s - 3008s |
---|
82 | # |
---|
83 | # beta_h>0: In the order of 3200s |
---|
84 | |
---|
85 | #------------------------- |
---|
86 | # Boundary Conditions |
---|
87 | #------------------------- |
---|
88 | |
---|
89 | # Create boundary function from timeseries provided in file |
---|
90 | function = file_function(project_truescale.boundary_filename, |
---|
91 | domain, verbose=True) |
---|
92 | |
---|
93 | # Create and assign boundary objects |
---|
94 | Bts = Transmissive_Momentum_Set_Stage_boundary(domain, function) |
---|
95 | Br = Reflective_boundary(domain) |
---|
96 | domain.set_boundary({'wave': Bts, 'wall': Br}) |
---|
97 | |
---|
98 | |
---|
99 | # Select triangle containing ch5 for diagnostic output |
---|
100 | # around known gauge |
---|
101 | triangle_id = domain.get_triangle_containing_point([1808.4, 478.4]) |
---|
102 | # This should get triangle id 32833 with centroid (4.5244, 1.1972) |
---|
103 | |
---|
104 | |
---|
105 | #------------------------- |
---|
106 | # Evolve through time |
---|
107 | #------------------------- |
---|
108 | import time |
---|
109 | t0 = time.time() |
---|
110 | |
---|
111 | for t in domain.evolve(yieldstep = 1, finaltime = 450): |
---|
112 | print domain.timestepping_statistics(track_speeds=False, |
---|
113 | triangle_id=triangle_id) |
---|
114 | print domain.boundary_statistics() |
---|
115 | |
---|
116 | print 'That took %.2f seconds' %(time.time()-t0) |
---|