source: inundation/ga/storm_surge/pyvolution/flatbed.py @ 660

Last change on this file since 660 was 660, checked in by ole, 20 years ago
File size: 1.4 KB
Line 
1"""Example of shallow water wave equation.
2
3Generate slope
4
5"""
6
7######################
8# Module imports
9#
10from os import sep, path
11from mesh_factory import rectangular
12from shallow_water import Domain, Reflective_boundary, Dirichlet_boundary,\
13     Constant_height
14from Numeric import array
15from util import Polygon_function, read_polygon
16from config import data_dir
17
18#Create basic mesh
19N = 20
20points, vertices, boundary = rectangular(N, N, 100, 100)
21
22#Create shallow water domain
23domain = Domain(points, vertices, boundary)
24domain.store = True
25domain.set_name('polygons')
26print "Output being written to " + data_dir + sep + \
27              domain.filename + "." + domain.format
28       
29
30domain.default_order=2
31
32#Set driving forces
33manning = 0.07
34manning = 0.0
35inflow_level = 10.0
36domain.set_quantity('friction', manning)
37
38
39
40
41#Define polynomials
42p0 = [[20,27], [30,25], [40,40], [20,40]]         
43p1 = [[80,19], [90,20], [85,50], [80,55], [75,58], [70,60], [60,24]]         
44p2 = read_polygon('testpoly.txt')
45
46
47#Set elevation 
48domain.set_quantity('elevation', 
49        Polygon_function([(p0, 23), (p1,10), (p2,15)]))
50
51
52         
53
54
55
56######################
57# Boundary conditions
58Br = Reflective_boundary(domain)
59Bd = Dirichlet_boundary([inflow_level,0.,0.])
60
61domain.set_boundary({'left': Bd, 'right': Br, 'top': Br, 'bottom': Br})
62domain.check_integrity()
63
64
65######################
66#Evolution
67for t in domain.evolve(yieldstep = 1, finaltime = 1):
68    domain.write_time()
69
70print 'Done'   
71
Note: See TracBrowser for help on using the repository browser.