source: anuga_validation/okushiri_2005/run_okushiri_parallel.py @ 3929

Last change on this file since 3929 was 3845, checked in by ole, 18 years ago

Work on Okushiri

File size: 2.6 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)
31
32#-------------------------
33# Initial Conditions
34#-------------------------
35domain.set_quantity('friction', 0.0)
36domain.set_quantity('stage', 0.0)
37domain.set_quantity('elevation',
38                    filename = project.bathymetry_filename[:-4] + '.pts',
39                    alpha = 0.02,                   
40                    verbose = True,
41                    use_cache = True)
42
43
44#-------------------------
45# Distribute domain
46#-------------------------
47domain = distribute(domain)
48
49# Parameters
50domain.set_name('okushiri_parallel')
51domain.set_minimum_storable_height(0.001)
52domain.set_default_order(2)
53domain.set_maximum_allowed_speed(0.1) # Allow a little runoff (0.1 is OK)
54
55# Set old (pre Sep 2006) defaults for limiters
56domain.beta_w      = 0.9
57domain.beta_w_dry  = 0.9
58domain.beta_uh     = 0.9
59domain.beta_uh_dry = 0.9
60domain.beta_vh     = 0.9
61domain.beta_vh_dry = 0.9
62
63
64#------------------------------------------------------------------------------
65# Setup boundary conditions
66# (MUST currently happen after domain has been distributed)
67#------------------------------------------------------------------------------
68
69Br = Reflective_boundary(domain)      # Solid reflective wall
70
71function = file_function(project.boundary_filename[:-4] + '.tms',
72                         domain, 
73                         verbose=True)
74
75Bts = Transmissive_Momentum_Set_Stage_boundary(domain, function)
76
77domain.set_boundary({'wave': Bts,  # Bind this one later
78                     'wall': Br})
79
80
81#-------------------------
82# Evolve through time
83#-------------------------
84import time
85t0 = time.time()
86
87for t in domain.evolve(yieldstep = 0.05, finaltime = 22.5):
88    domain.write_time()
89
90if myid == 0:
91    print 'That took %.2f seconds' %(time.time()-t0)
Note: See TracBrowser for help on using the repository browser.