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 | from anuga import Domain |
---|
25 | from anuga import Reflective_boundary |
---|
26 | from anuga import Time_boundary |
---|
27 | from anuga import Transmissive_momentum_set_stage_boundary |
---|
28 | from anuga import Transmissive_n_momentum_zero_t_momentum_set_stage_boundary |
---|
29 | from anuga import file_function |
---|
30 | |
---|
31 | import project |
---|
32 | |
---|
33 | |
---|
34 | #------------------------- |
---|
35 | # Create Domain from mesh |
---|
36 | #------------------------- |
---|
37 | domain = Domain(project.mesh_filename, use_cache=True, verbose=True) |
---|
38 | print domain.statistics() |
---|
39 | |
---|
40 | |
---|
41 | #------------------------- |
---|
42 | # Initial Conditions |
---|
43 | #------------------------- |
---|
44 | domain.set_quantity('friction', 0.0) |
---|
45 | domain.set_quantity('stage', 0.0) |
---|
46 | domain.set_quantity('elevation', |
---|
47 | filename=project.bathymetry_filename, |
---|
48 | alpha=0.02, |
---|
49 | verbose=True, |
---|
50 | use_cache=True) |
---|
51 | |
---|
52 | |
---|
53 | #------------------------- |
---|
54 | # Set simulation parameters |
---|
55 | #------------------------- |
---|
56 | domain.set_name(project.output_filename) # Name of output sww file |
---|
57 | domain.set_default_order(2) # Apply second order scheme |
---|
58 | domain.set_minimum_storable_height(0.001) # Don't store h < 0.001m |
---|
59 | |
---|
60 | #Timings on AMD64-242 (beta_h=0) |
---|
61 | # tight_slope_limiters = 0: |
---|
62 | # 3035s - 3110s |
---|
63 | # tight_slope_limiters = 1: |
---|
64 | # 3000s - 3008s |
---|
65 | # |
---|
66 | # beta_h>0: In the order of 3200s |
---|
67 | |
---|
68 | #------------------------- |
---|
69 | # Boundary Conditions |
---|
70 | #------------------------- |
---|
71 | |
---|
72 | # Create boundary function from timeseries provided in file |
---|
73 | function = file_function(project.boundary_filename, |
---|
74 | domain, verbose=True) |
---|
75 | |
---|
76 | # Create and assign boundary objects |
---|
77 | Bts = Transmissive_momentum_set_stage_boundary(domain, function) |
---|
78 | Br = Reflective_boundary(domain) |
---|
79 | domain.set_boundary({'wave': Bts, 'wall': Br}) |
---|
80 | |
---|
81 | |
---|
82 | # Select triangle containing ch5 for diagnostic output |
---|
83 | # around known gauge |
---|
84 | triangle_id = domain.get_triangle_containing_point([4.521, 1.196]) |
---|
85 | # This should get triangle id 32833 with centroid (4.5244, 1.1972) |
---|
86 | print 'triangle_id = ',triangle_id |
---|
87 | bdry_id = domain.get_triangle_containing_point([0.000, 1.696]) |
---|
88 | # This should get triangle id 56474 |
---|
89 | print 'bdry_id = ',bdry_id |
---|
90 | |
---|
91 | |
---|
92 | #------------------------- |
---|
93 | # Evolve through time |
---|
94 | #------------------------- |
---|
95 | import time |
---|
96 | t0 = time.time() |
---|
97 | |
---|
98 | for t in domain.evolve(yieldstep = 0.05, finaltime = 22.5): |
---|
99 | domain.write_time() |
---|
100 | print ' ',function(domain.get_time())[0],' bdry_d = ',bdry_id,' ',\ |
---|
101 | domain.get_conserved_quantities(bdry_id, edge=0)[0],' ',\ |
---|
102 | domain.get_conserved_quantities(bdry_id, edge=1)[0],' ',\ |
---|
103 | domain.get_conserved_quantities(bdry_id, edge=2)[0] |
---|
104 | |
---|
105 | |
---|
106 | print 'That took %.2f seconds' %(time.time()-t0) |
---|