source: trunk/anuga_work/development/mem_time_tests/parameters/timelen-over-timestep/ex1.py @ 8311

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

updating the python script files

  • 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 random
11import os
12#------------------------------------------------------------------------------
13# Setup computational domain
14#------------------------------------------------------------------------------
15from anuga.abstract_2d_finite_volumes.util import add_directories
16
17home = os.getenv('INUNDATIONHOME')
18scenariodir = add_directories(home, ["data","mem_time_test", "parameters",
19                                     "timelen-over-timestep"])
20
21def runex(g,f):
22   points, vertices, boundary = anuga.rectangular_cross(10,5,
23   len1=10.0, len2=5.0) # Mesh
24   domain = anuga.Domain(points, vertices, boundary) # Create domain
25   domain.set_name('channel1') # Output name
26   domain.set_datadir(scenariodir) 
27#------------------------------------------------------------------------------
28# Setup initial conditions
29#------------------------------------------------------------------------------
30   def topography(x, y):
31       return -x/10 # linear bed slope
32       domain.set_quantity('elevation', topography) # Use function for elevation
33       domain.set_quantity('friction', 0.01) # Constant friction
34       domain.set_quantity('stage', # Dry bed
35                           expression='elevation')
36
37#------------------------------------------------------------------------------
38# Setup boundary conditions
39#------------------------------------------------------------------------------
40   Bi = anuga.Dirichlet_boundary([0.4, 0, 0]) # Inflow
41   Br = anuga.Reflective_boundary(domain) # Solid reflective wall
42   domain.set_boundary({'left': Bi, 'right': Br, 'top': Br, 'bottom': Br})
43
44#------------------------------------------------------------------------------
45# Evolve system through time
46#------------------------------------------------------------------------------
47   for t in domain.evolve(yieldstep=f, finaltime=g):
48      print domain.timestepping_statistics()
49
50
Note: See TracBrowser for help on using the repository browser.