source: inundation/ga/storm_surge/pyvolution/bed_w_eden_boundary.py @ 773

Last change on this file since 773 was 773, checked in by ole, 19 years ago

Changed quantity name 'level' to 'stage'

File size: 1.7 KB
Line 
1"""Example of shallow water wave equation
2using time boundary from a file
3"""
4
5######################
6# Module imports
7#
8from mesh_factory import rectangular
9from shallow_water import Domain, Reflective_boundary, Dirichlet_boundary,\
10     Constant_height, Time_boundary, File_boundary
11from Numeric import array, ones
12
13#Create basic mesh (100m x 100m)
14points, vertices, boundary = rectangular(50, 50, 100, 100)
15
16#Create shallow water domain
17domain = Domain(points, vertices, boundary)
18domain.smooth = False
19domain.visualise = False
20domain.default_order = 2
21domain.store = True     #Store for visualisation purposes
22domain.format = 'sww'   #Native netcdf visualisation format
23
24
25
26#######################
27#Bed-slope and friction
28domain.set_quantity('elevation', 0.0) #Flat
29#domain.set_quantity('elevation', lambda x,y: -(x+y)/3) #Slopy
30domain.set_quantity('friction', 0.1)
31
32
33######################
34# Boundary conditions
35
36
37#Write file
38import os, time
39from config import time_format
40from math import sin, pi
41
42filename = 'Eden_Australia_31082004.txt'
43
44Br = Reflective_boundary(domain)
45Bd = Dirichlet_boundary([1. ,0.,0.])
46Bw = Time_boundary(domain=domain,
47                   f=lambda t: [(1*sin(t*pi/20)), 0.0, 0.0])
48
49Bf = File_boundary(filename, domain)
50
51#domain.set_boundary({'left': Bw, 'right': Br, 'top': Br, 'bottom': Br})
52domain.set_boundary({'left': Bf, 'right': Br, 'top': Br, 'bottom': Br})
53
54
55######################
56#Initial condition (constant)
57domain.set_quantity('stage', 0.0)
58domain.check_integrity()
59
60 
61######################
62#Evolution
63for t in domain.evolve(yieldstep = 60, finaltime = 385*15*60):
64    domain.write_time()
65
Note: See TracBrowser for help on using the repository browser.