source: anuga_validation/okushiri_2005/okushiri_parallel.py @ 3785

Last change on this file since 3785 was 3785, checked in by ole, 18 years ago
File size: 2.2 KB
Line 
1"""Validation of the AnuGA implementation of the shallow water wave equation.
2
3This script sets up LWRU2 benchmark with initial condition stated
4
5See also
6
7http://www.cee.cornell.edu/longwave/index.cfm?page=benchmark&problem=2
8
9Depth at western boundary is d = 13.5 cm
10
11This a parallel version.
12"""
13
14# Module imports
15from Numeric import array, zeros, Float, allclose
16
17from anuga.shallow_water import Domain
18from anuga.shallow_water import Reflective_boundary
19from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
20from anuga.abstract_2d_finite_volumes.util import file_function
21
22from anuga_parallel.parallel_api import myid, numprocs, distribute
23
24import project
25
26
27#-------------------------
28# Create Domain
29#-------------------------
30domain = Domain(project.mesh_filename, use_cache=True, verbose=True)
31domain.set_name('okushiri_parallel')
32domain.set_minimum_storable_height(0.001)
33domain.set_default_order(2)
34print domain.statistics()
35
36
37#-------------------------
38# Initial Conditions
39#-------------------------
40domain.set_quantity('friction', 0.0)
41domain.set_quantity('stage', 0.0)
42domain.set_quantity('elevation',
43                    filename = project.bathymetry_filename[:-4] + '.pts',
44                    alpha = 0.02,                   
45                    verbose = True,
46                    use_cache = True)
47
48#-------------------------
49# Boundary Conditions
50#-------------------------
51Br = Reflective_boundary(domain)
52
53domain.set_boundary({'wave': None,  # Bind this one later
54                     'wall': Br})
55
56
57#-------------------------
58# Distribute domain
59#-------------------------
60domain = distribute(domain)
61
62
63# Bind boundary, that cannot be fully specified before distribution.
64function = file_function(project.boundary_filename[:-4] + '.tms',
65                         domain, 
66                         verbose=True)
67
68Bts = Transmissive_Momentum_Set_Stage_boundary(domain, function)
69domain.modify_boundary({'wave': Bts})
70
71
72#-------------------------
73# Evolve through time
74#-------------------------
75import time
76t0 = time.time()
77
78for t in domain.evolve(yieldstep = 0.05, finaltime = 22.5):
79    domain.write_time()
80
81print 'That took %.2f seconds' %(time.time()-t0)
Note: See TracBrowser for help on using the repository browser.