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