source: inundation/ga/storm_surge/Hobart/run_hobart_buildings.py @ 1452

Last change on this file since 1452 was 1438, checked in by chris, 20 years ago
File size: 2.8 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 import 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'
34filename = 'building_boundary_Hobart_58868_triangles12May2005_bathymetry_0.1.tsh'
35yieldstep = 0.1
36finaltime = 2000
37
38print 'Creating domain from', filename
39domain = pmesh_to_domain_instance(filename, Domain)
40print "Number of triangles = ", len(domain)
41
42domain.default_order = 1
43domain.smooth = True
44domain.visualise = True
45
46#------------------------------
47# Boundary Conditions
48tags = {}
49tags['exterior'] = Reflective_boundary(domain)
50tags['Building'] = None
51domain.set_boundary(tags)
52
53#---------------------------------------------------------
54#Decide which quantities are to be stored at each timestep
55domain.quantities_to_be_stored = ['stage', 'xmomentum', 'ymomentum']
56
57#-----------------
58#Initial condition
59
60p0 = read_polygon('Hobart_recent_source_zone.xya')
61domain.set_quantity('stage',Polygon_function([(p0,10.0)]))
62
63stage_vv = domain.quantities['stage'].vertex_values
64elevation_vv = domain.quantities['elevation'].vertex_values
65
66new_stage_vv = stage_vv + elevation_vv
67
68domain.set_quantity('stage', new_stage_vv)
69
70#-------------------------------------
71# Provide file name for storing output
72domain.store = True
73domain.format = 'sww'
74domain.filename = 'Hobart_first_order'
75
76#----------------------------
77# Friction
78domain.set_quantity('friction', 0.033)
79
80
81Friction = domain.quantities['friction']
82for triangle in domain.tagged_elements['Building']:
83    #print 'key %s triangle %g \n'%(key, triangle)
84    Friction.centroid_values[triangle] = 100.0
85
86Friction.extrapolate_first_order()
87
88
89######################
90#Evolution
91import time
92t0 = time.time()
93for t in domain.evolve(yieldstep = yieldstep, finaltime = finaltime):
94    domain.write_time()
95    domain.visualiser.update_quantity_color('friction',(1.0,0.0,0.0))
96
97print 'That took %.2f seconds' %(time.time()-t0)
Note: See TracBrowser for help on using the repository browser.