source: anuga_work/development/demos/limiter_test.py @ 4539

Last change on this file since 4539 was 4539, checked in by ole, 17 years ago

Moved files from examples to anuga_work

File size: 2.2 KB
Line 
1"""Simple water flow example using ANUGA
2
3Water driven up a linear slope and time varying boundary,
4similar to a beach environment
5"""
6
7
8#------------------------------------------------------------------------------
9# Import necessary modules
10#------------------------------------------------------------------------------
11
12from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular
13from anuga.shallow_water import Domain
14from anuga.shallow_water import Reflective_boundary
15from anuga.shallow_water import Dirichlet_boundary
16from anuga.shallow_water import Time_boundary
17from anuga.shallow_water import Transmissive_boundary
18
19
20#------------------------------------------------------------------------------
21# Setup computational domain
22#------------------------------------------------------------------------------
23
24points, vertices, boundary = rectangular(4, 1, len1=4, len2=1)
25domain = Domain(points, vertices, boundary)
26domain.set_name('limiter_test')
27domain.set_store_vertices_uniquely(True)
28domain.set_default_order(2)
29domain.limit2007 = 1
30
31#------------------------------------------------------------------------------
32# Setup initial conditions
33#------------------------------------------------------------------------------
34
35def topography(x,y):
36    from Numeric import zeros, size, Float
37   
38    z = zeros(size(x), Float)
39    for i in range(len(x)):
40        if x[i] < 2:
41            z[i] = 1.0
42        else:
43            z[i] = 0.0
44    return z
45
46
47domain.set_quantity('elevation', topography) # Use function for elevation
48domain.set_quantity('stage', 0.5)           # Constant initial stage
49
50
51#------------------------------------------------------------------------------
52# Setup boundary conditions
53#------------------------------------------------------------------------------
54
55Br = Reflective_boundary(domain)      # Solid reflective wall
56domain.set_boundary({'left': Br, 'right': Br, 'top': Br, 'bottom': Br})
57
58#------------------------------------------------------------------------------
59# Evolve system through time
60#------------------------------------------------------------------------------
61
62for t in domain.evolve(yieldstep = 0.1, finaltime = 50.0):
63    domain.write_time()
64
65print 'done'   
66
67   
68
Note: See TracBrowser for help on using the repository browser.