source: inundation/ga/storm_surge/analytical solutions/Sydney.py @ 774

Last change on this file since 774 was 774, checked in by ole, 20 years ago

Changed quantity name 'level' to 'stage'

File size: 1.9 KB
Line 
1"""Example of the use of the shallow water wave equation
2to simulate a bomb blast in an urban area.
3
4   Copyright 2004
5   Christopher Zoppou, Stephen Roberts, Ole Nielsen, Duncan Gray
6   Geoscience Australia
7   
8"""
9
10###############################
11# Setup Path and import modules
12import sys
13from os import sep, path
14sys.path.append('..'+sep+'pyvolution')
15
16from shallow_water import Domain, Reflective_boundary, File_boundary,\
17     Dirichlet_boundary, Transmissive_boundary
18from pmesh2domain import pmesh_to_domain_instance
19from util import Polygon_function
20
21######################
22# Domain
23filename = 'Sydney_UBD.tsh'
24print 'Creating domain from', filename
25domain = pmesh_to_domain_instance(filename, Domain)
26print 'Number of triangles = ', len(domain)
27
28domain.default_order = 2
29domain.smooth = True
30
31
32# Provide file name for storing output
33domain.store = True
34domain.format = 'sww'
35domain.filename = 'Sydney_UBD'
36
37#Reduction operation for get_vertex_values
38from util import mean
39domain.reduction = mean
40#domain.reduction = min  #Looks better near steep slopes
41
42
43######################
44#Initial condition
45#
46print 'Initial condition'
47
48#Set bed-elevation and friction(None)
49def x_slope(x,y):
50    n = x.shape[0]
51    z = 0*x
52    return z
53
54domain.set_quantity('elevation', x_slope)
55
56#Set the initial water stage
57def stage(x,y):
58    z = x_slope(x,y)
59    n = x.shape[0]
60    h = 0*x
61    return h   
62
63domain.set_quantity('stage', stage)
64p0 = [[334429.024416, 6251238.11488],[334428.532417, 6251234.42489],
65      [334432.468407, 6251233.93289],[334431.730409, 6251238.36088]]
66domain.set_quantity('stage',Polygon_function([(p0,10000.0)]))
67
68############
69#Boundary
70tags = {}
71tags['external'] = Transmissive_boundary(domain)
72tags[''] = None
73domain.set_boundary(tags)
74   
75
76######################
77#Evolution
78import time
79t0 = time.time()
80for t in domain.evolve(yieldstep = 0.1, finaltime = 5):
81    domain.write_time()
82
83print 'That took %.2f seconds' %(time.time()-t0)
84
85   
Note: See TracBrowser for help on using the repository browser.