source: production/merimbula_2005/run_merimbula_lake_weed.py @ 3391

Last change on this file since 3391 was 3359, checked in by jack, 18 years ago

SCons will now byte-compile any .py files found.

File size: 7.1 KB
Line 
1"""Validation study of Merimbula lake using Pyvolution.
2
3   Copyright 2006
4   Christopher Zoppou, Stephen Roberts
5   Geoscience Australia, ANU
6   
7Specific methods pertaining to the 2D shallow water equation
8are imported from shallow_water
9for use with the generic finite volume framework
10
11Conserved quantities are h, uh and vh stored as elements 0, 1 and 2 in the
12numerical vector named conserved_quantities.
13
14"""
15
16#------------------------------
17# Setup Path and import modules
18import sys
19from os import sep, path
20sys.path.append('..'+sep+'pyvolution')
21
22from shallow_water import Domain, Reflective_boundary, File_boundary,\
23     Dirichlet_boundary, Wind_stress
24from pmesh2domain import pmesh_to_domain_instance
25from util import file_function, Polygon_function, read_polygon, inside_polygon
26from Numeric import zeros, Float, asarray
27from least_squares import Interpolation
28import time
29
30
31#-------
32# Domain
33filename = 'merimbula_10834_bridge_refined_bathymetry.tsh'
34print 'Creating domain from', filename
35domain = pmesh_to_domain_instance(filename, Domain)
36print "Number of triangles = ", len(domain)
37
38#------------------------------------------
39# Reduction operation for get_vertex_values             
40from util import mean
41domain.reduction = mean
42
43
44#-----------------
45# Scale weed zones
46
47def 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
63w = 0.035
64#   Saltmarsh
65g = 0.060
66#   Paddle weed
67y = 0.025
68#   Eel grass
69r = 0.035
70#   Mangroves
71c = 0.065
72#   Strap weed
73b = 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
139domain.set_quantity('friction',0.01)
140#--------------------
141# Boundary conditions
142
143#---------------------------------------
144#   Tidal cycle recorded at Eden as open
145filename = 'Eden_tide_Sept03.dat'
146print 'Open sea boundary condition from ',filename
147Bf = File_boundary(filename, domain)
148
149#--------------------------------------
150#   All other boundaries are reflective
151Br = Reflective_boundary(domain)
152domain.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)
157filename = 'Merimbula_Weather_data_Sept03_m_per_s.dat'
158print 'Wind field from ',filename
159F = file_function(filename, domain)
160domain.forcing_terms.append(Wind_stress(F))
161
162#--------------------------------
163# Initial water surface elevation
164domain.set_quantity('stage', .0)
165   
166#----------------------------------------------------------
167# Decide which quantities are to be stored at each timestep
168domain.quantities_to_be_stored = ['stage', 'xmomentum', 'ymomentum']
169
170#-------------------------------------
171# Provide file name for storing output
172domain.store = True     #Store for visualisation purposes
173domain.format = 'sww'   #Native netcdf visualisation format
174domain.filename = 'Merimbula_2003_60days_Manning_pt01'
175
176#----------------------
177# Set order of accuracy
178domain.default_order = 1
179domain.smooth = True
180         
181#---------
182# Evolution
183t0 = time.time()
184yieldstep = 900
185finaltime = 86400*60
186for t in domain.evolve(yieldstep = yieldstep, finaltime = finaltime):
187    domain.write_time()
188   
189print 'That took %.2f seconds' %(time.time()-t0)   
Note: See TracBrowser for help on using the repository browser.