source: inundation/ga/storm_surge/Hobart/Hobart.py @ 1505

Last change on this file since 1505 was 1503, checked in by chris, 19 years ago
File size: 2.4 KB
Line 
1"""Validation study of Merimbula lake using Pyvolution.
2Example of shallow water wave equation applied to
3Malpasset dam break simulation.
4
5   Copyright 2004
6   Christopher Zoppou, Stephen Roberts
7   Australian National University
8
9Specific methods pertaining to the 2D shallow water equation
10are imported from shallow_water
11for use with the generic finite volume framework
12
13Conserved quantities are h, uh and vh stored as elements 0, 1 and 2 in the
14numerical vector named conserved_quantities.
15
16Existence of file 'Hobart_mesh.tsh' is assumed.
17"""
18
19###############################
20# Setup Path and importing modules
21import sys
22from os import sep, path
23sys.path.append('..'+sep+'pyvolution')
24
25import Numeric
26from shallow_water import Domain, Reflective_boundary, File_boundary,\
27     Dirichlet_boundary, Transmissive_boundary
28from pmesh2domain import pmesh_to_domain_instance
29from util import Polygon_function, read_polygon
30
31######################
32# Domain
33filename = 'hobart_mesh.tsh'
34yieldstep = 2
35finaltime = 600
36
37print 'Creating domain from', filename
38domain = pmesh_to_domain_instance(filename, Domain)
39print "Number of triangles = ", len(domain)
40
41domain.default_order = 1
42domain.smooth = True
43domain.visualise = True
44
45#------------------------------
46# Boundary Conditions
47tags = {}
48tags['external'] = Reflective_boundary(domain)
49domain.set_boundary(tags)
50
51#---------------------------------------------------------
52#Decide which quantities are to be stored at each timestep
53domain.quantities_to_be_stored = ['stage', 'xmomentum', 'ymomentum']
54
55#-----------------
56#Initial condition
57
58p0 = read_polygon('Hobart_recent_source_zone.xya')
59domain.set_quantity('stage',Polygon_function([(p0,10.0)]))
60
61stage_vv = domain.quantities['stage'].vertex_values
62elevation_vv = domain.quantities['elevation'].vertex_values
63
64new_stage_vv = stage_vv + elevation_vv
65
66domain.set_quantity('stage', new_stage_vv)
67
68#-------------------------------------
69# Provide file name for storing output
70domain.store = True
71domain.format = 'sww'
72domain.filename = 'Hobart_first_order'
73
74#----------------------------
75# Friction
76domain.set_quantity('friction', 0.033)
77
78######################
79#Evolution
80import time
81t0 = time.time()
82for t in domain.evolve(yieldstep = yieldstep, finaltime = finaltime):
83    domain.write_time()
84
85print 'That took %.2f seconds' %(time.time()-t0)
86
87
Note: See TracBrowser for help on using the repository browser.