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

Last change on this file since 647 was 647, checked in by chris, 20 years ago
File size: 2.0 KB
Line 
1"""Example of shallow water wave equation analytical solution
2consists of a parabolic profile in a parabolic basin. Analytical
3solutiuon to this problem was derived by Carrier and Greenspan
4and used by Yoon and Chou.
5
6   Copyright 2004
7   Christopher Zoppou, Stephen Roberts, Ole Nielsen, Duncan Gray
8   Geoscience Australia
9   
10"""
11
12######################
13# Module imports
14import sys
15from os import sep
16sys.path.append('..'+sep+'pyvolution')
17
18from shallow_water import Transmissive_boundary, Reflective_boundary, \
19     Dirichlet_boundary, Domain
20from math import sqrt, cos, sin, pi
21from mesh_factory import strang_mesh
22from pmesh2domain import pmesh_to_domain_instance
23
24
25######################
26# Domain
27filename = 'Sydney_UBD.tsh'
28print 'Creating domain from', filename
29domain = pmesh_to_domain_instance(filename, Domain)
30print 'Number of triangles = ', len(domain)
31
32
33domain.default_order = 2
34domain.smooth = True
35
36
37# Provide file name for storing output
38domain.store = True
39domain.format = 'sww'
40domain.filename = 'sydney'
41
42print 'Number of triangles = ', len(domain)
43
44#Reduction operation for get_vertex_values
45from util import mean
46domain.reduction = mean
47#domain.reduction = min  #Looks better near steep slopes
48
49
50######################
51#Initial condition
52#
53print 'Initial condition'
54
55#Set bed-elevation and friction(None)
56def x_slope(x,y):
57    n = x.shape[0]
58    z = 0*x
59    return z
60
61domain.set_quantity('elevation', x_slope)
62
63#Set the initial water level
64def level(x,y):
65    z = x_slope(x,y)
66    n = x.shape[0]
67    h = 0*x
68    return h   
69
70domain.set_quantity('level', level)
71
72
73############
74#Boundary
75tags = {}
76#tags['input'] = Dirichlet_boundary([10.0, 0.0, 0.0])
77tags['reflective'] = Reflective_boundary(domain) 
78#tags['far'] = Transmissive_boundary(domain)
79tags['far'] = Dirichlet_boundary([10.0, 0.0, 0.0])
80domain.set_boundary(tags)
81   
82
83######################
84#Evolution
85import time
86t0 = time.time()
87for t in domain.evolve(yieldstep = 10.0, finaltime = 5):
88    domain.write_time()
89
90print 'That took %.2f seconds' %(time.time()-t0)
91
92   
Note: See TracBrowser for help on using the repository browser.