source: production/merimbula_2005/run_merimbula_lake_checkpoint.py @ 3289

Last change on this file since 3289 was 2225, checked in by steve, 19 years ago

Making meribula a production directory

File size: 4.2 KB
Line 
1"""Validation study of Merimbula lake using Pyvolution.
2
3   Copyright 2004
4   Christopher Zoppou, Stephen Roberts, Ole Nielsen, Duncan Gray
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
14Existence of file 'merimbula_interpolated.tsh' is assumed.
15"""
16
17#------------------------------
18# Setup Path and import modules
19import sys
20from os import sep, path
21sys.path.append('..'+sep+'pyvolution')
22
23from shallow_water import Domain, Reflective_boundary, File_boundary,\
24     Dirichlet_boundary, Wind_stress
25from pmesh2domain import pmesh_to_domain_instance
26from util import file_function, Polygon_function, read_polygon, inside_polygon
27from Numeric import zeros, Float, asarray
28from least_squares import Interpolation
29from data_manager import sww2domain
30
31import time
32
33#-------
34# Domain
35# This is the original file used to create the SWW file from t = 0.
36# It is also needed to define the domain if it contains boundaryies other that
37# external.
38filename = 'merimbula_10834_bridge_refined_bathymetry.tsh'
39domain_old = pmesh_to_domain_instance(filename, Domain)
40
41# The evolution starts from the last time step contained in the following file.
42filename_sww = 'c:\grohm_output\Merimbula_2003_4days_dry.sww'
43print 'Creating domain from', filename_sww
44domain = sww2domain(filename_sww)
45print "Number of triangles = ", len(domain)
46
47# Extract old boundary data form original tsh file
48domain.boundary = domain_old.boundary
49
50#------------------------------------------
51# Reduction operation for get_vertex_values             
52from util import mean
53domain.reduction = mean
54
55domain.set_quantity('friction',0.03)
56#--------------------
57# Boundary conditions
58
59#---------------------------------------
60#   Tidal cycle recorded at Eden as open
61filename = 'Eden_tide_Sept03.dat'
62print 'Open sea boundary condition from ',filename
63Bf = File_boundary(filename, domain)
64
65#--------------------------------------
66#   All other boundaries are reflective
67Br = Reflective_boundary(domain)
68domain.set_boundary({'exterior': Br, 'open': Bf})
69
70#-----------
71# Wind field
72#   Format is time [DD/MM/YY hh:mm:ss], speed [m/s] direction (degrees)
73filename = 'Merimbula_Weather_data_Sept03_m_per_s.dat'
74print 'Wind field from ',filename
75F = file_function(filename, domain)
76domain.forcing_terms.append(Wind_stress(F))
77
78#--------------------------------
79# Initial water surface elevation: only required for initial run
80# domain.set_quantity('stage', -50.0)
81# All conserved values are retrieved from the SWW file
82   
83#----------------------------------------------------------
84# Decide which quantities are to be stored at each timestep
85domain.quantities_to_be_stored = ['stage', 'xmomentum', 'ymomentum']
86
87#-------------------------------------
88# Provide file name for storing output
89domain.store = True     #Store for visualisation purposes
90domain.format = 'sww'   #Native netcdf visualisation format
91# Caution: Should not store results in the SWW file
92filename = 'Merimbula_2003_4days_dry_plus'
93domain.filename = (filename)
94if filename_sww == filename:
95    msg = 'SWW file name is the same as the output file name'
96    raise msg
97
98#----------------------
99# Set order of accuracy
100domain.default_order = 1
101# Smooth in True or discontinuous triangles if False (Default is minimum for True)
102domain.smooth = True
103domain.reduction = 'mean'
104
105# Use the inscribed circle with safety factor of 0.9 to establish the time step
106# domain.set_to_inscribed_circle(safety_factor=0.9)
107
108#---------
109# Evolution
110# t0 is the computer clock time
111t0 = time.time()
112yieldstep = 9
113
114# domain.startime is obtained from the SWW file and is the last evolution time
115# time_extra is the additional evolution time final evolution time
116# is equal to desired_finaltime
117time_extra = 90
118desired_finaltime = domain.starttime + time_extra
119finaltime = desired_finaltime - domain.starttime
120
121for t in domain.evolve(yieldstep = yieldstep, finaltime = finaltime):
122    domain.write_time()
123   
124print 'That took %.2f seconds' %(time.time()-t0)   
Note: See TracBrowser for help on using the repository browser.