source: trunk/anuga_core/documentation/user_manual/demos/channel1.py @ 7806

Last change on this file since 7806 was 7770, checked in by hudson, 14 years ago

Broke up data_manager into more modules - some failing tests.

File size: 2.1 KB
Line 
1"""Simple water flow example using ANUGA
2
3Water flowing down a channel
4"""
5
6#------------------------------------------------------------------------------
7# Import necessary modules
8#------------------------------------------------------------------------------
9
10# Import standard shallow water domain and standard boundaries.
11import anuga
12
13# Import rectangular cross mesh generator
14from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
15
16
17#------------------------------------------------------------------------------
18# Setup computational domain
19#------------------------------------------------------------------------------
20points, vertices, boundary = rectangular_cross(10, 5,
21                                               len1=10.0, len2=5.0) # Mesh
22
23domain = anuga.Domain(points, vertices, boundary)  # Create domain
24domain.set_name('channel1')                  # Output name
25
26#------------------------------------------------------------------------------
27# Setup initial conditions
28#------------------------------------------------------------------------------
29def topography(x, y):
30    return -x/10                             # linear bed slope
31
32domain.set_quantity('elevation', topography) # Use function for elevation
33domain.set_quantity('friction', 0.01)        # Constant friction
34domain.set_quantity('stage',                 # Dry bed
35                    expression='elevation') 
36
37#------------------------------------------------------------------------------
38# Setup boundary conditions
39#------------------------------------------------------------------------------
40Bi = anuga.Dirichlet_boundary([0.4, 0, 0])         # Inflow
41Br = anuga.Reflective_boundary(domain)             # Solid reflective wall
42
43domain.set_boundary({'left': Bi, 'right': Br, 'top': Br, 'bottom': Br})
44
45#------------------------------------------------------------------------------
46# Evolve system through time
47#------------------------------------------------------------------------------
48for t in domain.evolve(yieldstep=0.2, finaltime=40.0):
49    print domain.timestepping_statistics()
Note: See TracBrowser for help on using the repository browser.