source: anuga_validation/okushiri_2005/okushiri_parallel.py @ 3656

Last change on this file since 3656 was 3656, checked in by ole, 17 years ago

Work on parallel examples

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')
32domain.set_default_order(2)
33print domain.statistics()
34
35
36#-------------------------
37# Initial Conditions
38#-------------------------
39domain.set_quantity('friction', 0.0)
40domain.set_quantity('stage', 0.0)
41domain.set_quantity('elevation',
42                    filename = project.bathymetry_filename[:-4] + '.pts',
43                    alpha = 0.02,                   
44                    verbose = True,
45                    use_cache = True)
46
47#-------------------------
48# Boundary Conditions
49#-------------------------
50Br = Reflective_boundary(domain)
51
52domain.set_boundary({'wave': None,  # Bind this one later
53                     'wall': Br})
54
55
56#-------------------------
57# Distribute domain
58#-------------------------
59#if numprocs > 1:
60#    domain = distribute(domain)
61domain = distribute(domain)
62
63
64# Bind boundary, that cannot be fully specified before distribution.
65function = file_function(project.boundary_filename[:-4] + '.tms',
66                         domain, 
67                         verbose=True)
68
69Bts = Transmissive_Momentum_Set_Stage_boundary(domain, function)
70domain.modify_boundary({'wave': Bts})
71
72
73#-------------------------
74# Evolve through time
75#-------------------------
76import time
77t0 = time.time()
78
79for t in domain.evolve(yieldstep = 0.05, finaltime = 22.5):
80    domain.write_time()
81
82print 'That took %.2f seconds' %(time.time()-t0)
Note: See TracBrowser for help on using the repository browser.