source: trunk/anuga_work/development/mem_time_tests/parameters/timelen/ex1.py @ 8304

Last change on this file since 8304 was 8304, checked in by pittj, 12 years ago

adding more files from the resource experiments

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