source: trunk/anuga_core/demos/channel1.py @ 9065

Last change on this file since 9065 was 8976, checked in by steve, 12 years ago

Added in Petar's mode_tools

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