source: anuga_core/source/anuga/examples/bed_w_eden_boundary.py @ 4026

Last change on this file since 4026 was 4026, checked in by jack, 17 years ago

Moved the vpython visualiser to obsolete_code and cleared out things that call it from other code.

File size: 1.6 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.default_order = 2
20domain.store = True     #Store for visualisation purposes
21domain.format = 'sww'   #Native netcdf visualisation format
22
23
24
25#######################
26#Bed-slope and friction
27domain.set_quantity('elevation', 0.0) #Flat
28#domain.set_quantity('elevation', lambda x,y: -(x+y)/3) #Slopy
29domain.set_quantity('friction', 0.1)
30
31
32######################
33# Boundary conditions
34
35
36#Write file
37import os, time
38from anuga.config import time_format
39from math import sin, pi
40
41filename = 'Eden_Australia_31082004.txt'
42
43Br = Reflective_boundary(domain)
44Bd = Dirichlet_boundary([1. ,0.,0.])
45Bw = Time_boundary(domain=domain,
46                   f=lambda t: [(1*sin(t*pi/20)), 0.0, 0.0])
47
48Bf = File_boundary(filename, domain)
49
50#domain.set_boundary({'left': Bw, 'right': Br, 'top': Br, 'bottom': Br})
51domain.set_boundary({'left': Bf, 'right': Br, 'top': Br, 'bottom': Br})
52
53
54######################
55#Initial condition (constant)
56domain.set_quantity('stage', 0.0)
57domain.check_integrity()
58
59 
60######################
61#Evolution
62for t in domain.evolve(yieldstep = 60, finaltime = 385*15*60):
63    domain.write_time()
64
Note: See TracBrowser for help on using the repository browser.