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

Last change on this file since 1599 was 1491, checked in by steve, 19 years ago
File size: 3.0 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
44
45# Turn on visualiser
46domain.initialise_visualiser()
47
48# Colours for Hobart
49domain.visualiser.stage_color    = (0.0,0.38,0.1)
50domain.visualiser.friction_color = (0.1,0.99,0.1)
51domain.visualiser.other_color    = (0.99,0.4,0.1)
52
53
54#------------------------------
55# Boundary Conditions
56tags = {}
57tags['exterior'] = Reflective_boundary(domain)
58tags['Building'] = None
59domain.set_boundary(tags)
60
61#---------------------------------------------------------
62#Decide which quantities are to be stored at each timestep
63domain.quantities_to_be_stored = ['stage', 'xmomentum', 'ymomentum']
64
65#-----------------
66#Initial condition
67
68p0 = read_polygon('Hobart_recent_source_zone.xya')
69domain.set_quantity('stage',Polygon_function([(p0,10.0)]))
70
71stage_vv = domain.quantities['stage'].vertex_values
72elevation_vv = domain.quantities['elevation'].vertex_values
73
74new_stage_vv = stage_vv + elevation_vv
75
76domain.set_quantity('stage', new_stage_vv)
77
78#-------------------------------------
79# Provide file name for storing output
80domain.store = True
81domain.format = 'sww'
82domain.filename = 'Hobart_first_order'
83
84#----------------------------
85# Friction
86domain.set_quantity('friction', 0.033)
87
88
89Friction = domain.quantities['friction']
90for triangle in domain.tagged_elements['Building']:
91    #print 'key %s triangle %g \n'%(key, triangle)
92    Friction.centroid_values[triangle] = 100.0
93
94Friction.extrapolate_first_order()
95
96
97######################
98#Evolution
99import time
100t0 = time.time()
101for t in domain.evolve(yieldstep = yieldstep, finaltime = finaltime):
102    domain.write_time()
103    domain.visualiser.update_quantity_color('friction',(1.0,0.0,0.0))
104
105print 'That took %.2f seconds' %(time.time()-t0)
Note: See TracBrowser for help on using the repository browser.