1 | """Validation study of Merimbula lake using Pyvolution. |
---|
2 | |
---|
3 | Copyright 2006 |
---|
4 | Christopher Zoppou, Stephen Roberts |
---|
5 | Geoscience Australia, ANU |
---|
6 | |
---|
7 | Specific methods pertaining to the 2D shallow water equation |
---|
8 | are imported from shallow_water |
---|
9 | for use with the generic finite volume framework |
---|
10 | |
---|
11 | Conserved quantities are h, uh and vh stored as elements 0, 1 and 2 in the |
---|
12 | numerical vector named conserved_quantities. |
---|
13 | |
---|
14 | """ |
---|
15 | |
---|
16 | #------------------------------ |
---|
17 | # Setup Path and import modules |
---|
18 | import sys |
---|
19 | from os import sep, path |
---|
20 | sys.path.append('..'+sep+'pyvolution') |
---|
21 | |
---|
22 | from shallow_water import Domain, Reflective_boundary, File_boundary,\ |
---|
23 | Dirichlet_boundary, Wind_stress |
---|
24 | from pmesh2domain import pmesh_to_domain_instance |
---|
25 | from util import file_function, Polygon_function, read_polygon, inside_polygon |
---|
26 | from Numeric import zeros, Float, asarray |
---|
27 | from least_squares import Interpolation |
---|
28 | import time |
---|
29 | |
---|
30 | |
---|
31 | #------- |
---|
32 | # Domain |
---|
33 | filename = 'merimbula_10834_bridge_refined_bathymetry.tsh' |
---|
34 | print 'Creating domain from', filename |
---|
35 | domain = pmesh_to_domain_instance(filename, Domain) |
---|
36 | print "Number of triangles = ", len(domain) |
---|
37 | |
---|
38 | #------------------------------------------ |
---|
39 | # Reduction operation for get_vertex_values |
---|
40 | from util import mean |
---|
41 | domain.reduction = mean |
---|
42 | |
---|
43 | |
---|
44 | #----------------- |
---|
45 | # Scale weed zones |
---|
46 | |
---|
47 | def weed_zone(points): |
---|
48 | #print points |
---|
49 | n = len(points) |
---|
50 | print n |
---|
51 | z = [] |
---|
52 | for i in range(n): |
---|
53 | #print i |
---|
54 | z.append([0,0]) |
---|
55 | z[i][0] = 755471.4 + (points[i][0] + 3250.)/1.125 |
---|
56 | z[i][1] = 5910260.0 + (points[i][1] + 1337.)/1.12 |
---|
57 | #print z |
---|
58 | return z |
---|
59 | |
---|
60 | #------------- |
---|
61 | # Set friction |
---|
62 | # Sand bed |
---|
63 | w = 0.035 |
---|
64 | # Saltmarsh |
---|
65 | g = 0.060 |
---|
66 | # Paddle weed |
---|
67 | y = 0.025 |
---|
68 | # Eel grass |
---|
69 | r = 0.035 |
---|
70 | # Mangroves |
---|
71 | c = 0.065 |
---|
72 | # Strap weed |
---|
73 | b = 0.040 |
---|
74 | #----------------------------------------------- |
---|
75 | # Set the whole region to a constant value |
---|
76 | #weed_zoneall = weed_zone([[-2269,-1337],[1894,-1339],[1894,2946],[-2669,2946]]) |
---|
77 | |
---|
78 | #--------------------------------------- |
---|
79 | # Read friction polygon boundaries |
---|
80 | #weed_zone47 = weed_zone(read_polygon('weed_zone.047')) |
---|
81 | #weed_zone2 = weed_zone(read_polygon('weed_zone.002')) |
---|
82 | #weed_zone12 = weed_zone(read_polygon('weed_zone.012')) |
---|
83 | #weed_zone35 = weed_zone(read_polygon('weed_zone.035')) |
---|
84 | #weed_zone8 = weed_zone(read_polygon('weed_zone.008')) |
---|
85 | #weed_zone10 = weed_zone(read_polygon('weed_zone.010')) |
---|
86 | #weed_zone13 = weed_zone(read_polygon('weed_zone.013')) |
---|
87 | #weed_zone15 = weed_zone(read_polygon('weed_zone.015')) |
---|
88 | #weed_zone19 = weed_zone(read_polygon('weed_zone.019')) |
---|
89 | #weed_zone18 = weed_zone(read_polygon('weed_zone.018')) |
---|
90 | #weed_zone24 = weed_zone(read_polygon('weed_zone.024')) |
---|
91 | #weed_zone26 = weed_zone(read_polygon('weed_zone.026')) |
---|
92 | #weed_zone27 = weed_zone(read_polygon('weed_zone.027')) |
---|
93 | #weed_zone32 = weed_zone(read_polygon('weed_zone.032')) |
---|
94 | #weed_zone31 = weed_zone(read_polygon('weed_zone.031')) |
---|
95 | #weed_zone33 = weed_zone(read_polygon('weed_zone.033')) |
---|
96 | #weed_zone34 = weed_zone(read_polygon('weed_zone.034')) |
---|
97 | #weed_zone36 = weed_zone(read_polygon('weed_zone.036')) |
---|
98 | #weed_zone37 = weed_zone(read_polygon('weed_zone.037')) |
---|
99 | #weed_zone38 = weed_zone(read_polygon('weed_zone.038')) |
---|
100 | #weed_zone40 = weed_zone(read_polygon('weed_zone.040')) |
---|
101 | #weed_zone41 = weed_zone(read_polygon('weed_zone.041')) |
---|
102 | #weed_zone42 = weed_zone(read_polygon('weed_zone.042')) |
---|
103 | #weed_zone43 = weed_zone(read_polygon('weed_zone.043')) |
---|
104 | #weed_zone44 = weed_zone(read_polygon('weed_zone.044')) |
---|
105 | #weed_zone45 = weed_zone(read_polygon('weed_zone.045')) |
---|
106 | #weed_zone46 = weed_zone(read_polygon('weed_zone.046')) |
---|
107 | #weed_zone1 = weed_zone(read_polygon('weed_zone.001')) |
---|
108 | #weed_zone20 = weed_zone(read_polygon('weed_zone.020')) |
---|
109 | #weed_zone21 = weed_zone(read_polygon('weed_zone.021')) |
---|
110 | #weed_zone22 = weed_zone(read_polygon('weed_zone.022')) |
---|
111 | #weed_zone23 = weed_zone(read_polygon('weed_zone.023')) |
---|
112 | #weed_zone25 = weed_zone(read_polygon('weed_zone.025')) |
---|
113 | #weed_zone16 = weed_zone(read_polygon('weed_zone.016')) |
---|
114 | #weed_zone17 = weed_zone(read_polygon('weed_zone.017')) |
---|
115 | #weed_zone3 = weed_zone(read_polygon('weed_zone.003')) |
---|
116 | #weed_zone6 = weed_zone(read_polygon('weed_zone.006')) |
---|
117 | #weed_zone7 = weed_zone(read_polygon('weed_zone.007')) |
---|
118 | #weed_zone9 = weed_zone(read_polygon('weed_zone.009')) |
---|
119 | #weed_zone4 = weed_zone(read_polygon('weed_zone.004')) |
---|
120 | #weed_zone39 = weed_zone(read_polygon('weed_zone.039')) |
---|
121 | #weed_zone28 = weed_zone(read_polygon('weed_zone.028')) |
---|
122 | #weed_zone29 = weed_zone(read_polygon('weed_zone.029')) |
---|
123 | #weed_zone30 = weed_zone(read_polygon('weed_zone.030')) |
---|
124 | #weed_zone5 = weed_zone(read_polygon('weed_zone.005')) |
---|
125 | #weed_zone11 = weed_zone(read_polygon('weed_zone.011')) |
---|
126 | #weed_zone14 = weed_zone(read_polygon('weed_zone.014')) |
---|
127 | |
---|
128 | # (weed_zone15, g), (weed_zone19, c), (weed_zone18, g), (weed_zone24, c), \ |
---|
129 | # (weed_zone26, r), (weed_zone27, g), (weed_zone32, c), (weed_zone31, g), \ |
---|
130 | # (weed_zone33, r), (weed_zone34, g), (weed_zone36, r), (weed_zone37, g), \ |
---|
131 | # (weed_zone38, g), (weed_zone40, r), (weed_zone41, b), (weed_zone42, r), \ |
---|
132 | # (weed_zone43, r), (weed_zone44, r), (weed_zone45, b), (weed_zone46, r), \ |
---|
133 | # (weed_zone1, w), (weed_zone20, w), (weed_zone21, w), (weed_zone22, w), \ |
---|
134 | # (weed_zone23, w), (weed_zone25, w), (weed_zone16, w), (weed_zone17, w), \ |
---|
135 | # (weed_zone3, w), (weed_zone6, w), (weed_zone7, w), (weed_zone9, w), \ |
---|
136 | # (weed_zone4, b), (weed_zone39, b), (weed_zone28, r), (weed_zone29, b), \ |
---|
137 | # (weed_zone30, b), (weed_zone5, b), (weed_zone11, b), (weed_zone14, b) ])) |
---|
138 | |
---|
139 | domain.set_quantity('friction',0.01) |
---|
140 | #-------------------- |
---|
141 | # Boundary conditions |
---|
142 | |
---|
143 | #--------------------------------------- |
---|
144 | # Tidal cycle recorded at Eden as open |
---|
145 | filename = 'Eden_tide_Sept03.dat' |
---|
146 | print 'Open sea boundary condition from ',filename |
---|
147 | Bf = File_boundary(filename, domain) |
---|
148 | |
---|
149 | #-------------------------------------- |
---|
150 | # All other boundaries are reflective |
---|
151 | Br = Reflective_boundary(domain) |
---|
152 | domain.set_boundary({'exterior': Br, 'open': Bf}) |
---|
153 | |
---|
154 | #----------- |
---|
155 | # Wind field |
---|
156 | # Format is time [DD/MM/YY hh:mm:ss], speed [m/s] direction (degrees) |
---|
157 | filename = 'Merimbula_Weather_data_Sept03_m_per_s.dat' |
---|
158 | print 'Wind field from ',filename |
---|
159 | F = file_function(filename, domain) |
---|
160 | domain.forcing_terms.append(Wind_stress(F)) |
---|
161 | |
---|
162 | #-------------------------------- |
---|
163 | # Initial water surface elevation |
---|
164 | domain.set_quantity('stage', .0) |
---|
165 | |
---|
166 | #---------------------------------------------------------- |
---|
167 | # Decide which quantities are to be stored at each timestep |
---|
168 | domain.quantities_to_be_stored = ['stage', 'xmomentum', 'ymomentum'] |
---|
169 | |
---|
170 | #------------------------------------- |
---|
171 | # Provide file name for storing output |
---|
172 | domain.store = True #Store for visualisation purposes |
---|
173 | domain.format = 'sww' #Native netcdf visualisation format |
---|
174 | domain.filename = 'Merimbula_2003_60days_Manning_pt01' |
---|
175 | |
---|
176 | #---------------------- |
---|
177 | # Set order of accuracy |
---|
178 | domain.default_order = 1 |
---|
179 | domain.smooth = True |
---|
180 | |
---|
181 | #--------- |
---|
182 | # Evolution |
---|
183 | t0 = time.time() |
---|
184 | yieldstep = 900 |
---|
185 | finaltime = 86400*60 |
---|
186 | for t in domain.evolve(yieldstep = yieldstep, finaltime = finaltime): |
---|
187 | domain.write_time() |
---|
188 | |
---|
189 | print 'That took %.2f seconds' %(time.time()-t0) |
---|