source: trunk/anuga_core/benchmarks/create_test_sww.py @ 7810

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

Added aggressive psyco optimisation, fixed benchmark app to work with new API.

File size: 1.8 KB
Line 
1#------------------------------------------------------------------------------
2# Import necessary modules
3#------------------------------------------------------------------------------
4import anuga
5
6def create_test_sww(sww_name):
7
8        #------------------------------------------------------------------------------
9        # Setup computational domain
10        #------------------------------------------------------------------------------
11        points, vertices, boundary = anuga.rectangular_cross(50, 50,
12                                                                                                   len1=50.0, len2=50.0) # Mesh
13
14        domain = anuga.Domain(points, vertices, boundary)  # Create domain
15        domain.set_name(sww_name)                  # Output name
16
17        #------------------------------------------------------------------------------
18        # Setup initial conditions
19        #------------------------------------------------------------------------------
20        def topography(x, y):
21                return -x/20                             # linear bed slope
22
23        domain.set_quantity('elevation', topography) # Use function for elevation
24        domain.set_quantity('friction', 0.01)        # Constant friction
25        domain.set_quantity('stage',                 # Dry bed
26                                                expression='elevation') 
27
28        #------------------------------------------------------------------------------
29        # Setup boundary conditions
30        #------------------------------------------------------------------------------
31        Bi = anuga.Dirichlet_boundary([0.4, 0, 0])         # Inflow
32        Br = anuga.Reflective_boundary(domain)             # Solid reflective wall
33
34        domain.set_boundary({'left': Bi, 'right': Br, 'top': Br, 'bottom': Br})
35
36        #------------------------------------------------------------------------------
37        # Evolve system through time
38        #------------------------------------------------------------------------------
39        for t in domain.evolve(yieldstep=10.0, finaltime=100.0):
40                print domain.timestepping_statistics()
Note: See TracBrowser for help on using the repository browser.