source: anuga_core/source/anuga/examples/limiter_test.py @ 4203

Last change on this file since 4203 was 4187, checked in by ole, 18 years ago

Very simple test that highlights the 'creep' problem. Setting alpha=1 globally fixes this, but that won't work in general.

File size: 2.1 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)
28
29#------------------------------------------------------------------------------
30# Setup initial conditions
31#------------------------------------------------------------------------------
32
33def topography(x,y):
34    from Numeric import zeros, size, Float
35   
36    z = zeros(size(x), Float)
37    for i in range(len(x)):
38        if x[i] < 2:
39            z[i] = 1.0
40        else:
41            z[i] = 0.0
42    return z
43
44
45domain.set_quantity('elevation', topography) # Use function for elevation
46domain.set_quantity('stage', 0.5)             # Constant negative initial stage
47
48
49#------------------------------------------------------------------------------
50# Setup boundary conditions
51#------------------------------------------------------------------------------
52
53Br = Reflective_boundary(domain)      # Solid reflective wall
54domain.set_boundary({'left': Br, 'right': Br, 'top': Br, 'bottom': Br})
55
56#------------------------------------------------------------------------------
57# Evolve system through time
58#------------------------------------------------------------------------------
59
60for t in domain.evolve(yieldstep = 0.1, finaltime = 1.0):
61    domain.write_time()
62
63   
64
Note: See TracBrowser for help on using the repository browser.