source: anuga_validation/okushiri_2005/run_okushiri_parallel.py @ 4354

Last change on this file since 4354 was 4299, checked in by duncan, 18 years ago

refinements

File size: 3.0 KB
Line 
1"""Validation of the AnuGA implementation of the shallow water wave equation.
2
3This script sets up Okushiri Island benchmark as published at the
4
5THE THIRD INTERNATIONAL WORKSHOP ON LONG-WAVE RUNUP MODELS
6June 17-18 2004
7Wrigley Marine Science Center
8Catalina Island, California
9http://www.cee.cornell.edu/longwave/
10
11
12The validation data was downloaded and made available in this directory
13for convenience but the original data is available at
14http://www.cee.cornell.edu/longwave/index.cfm?page=benchmark&problem=2
15where a detailed description of the problem is also available.
16
17
18Run create_okushiri.py to process the boundary condition and build a the
19mesh before running this script.
20
21"""
22
23# To know quickly if pypar can be imported
24import imp
25print " imp.find_module('pypar')", imp.find_module('pypar')
26import  pypar
27
28# Module imports
29from anuga.shallow_water import Domain
30from anuga.shallow_water import Reflective_boundary
31from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
32from anuga.abstract_2d_finite_volumes.util import file_function
33
34from anuga_parallel.parallel_api import myid, numprocs, distribute   
35
36import project
37
38use_cache = True
39#-------------------------
40# Create Domain from mesh
41#-------------------------
42domain = Domain(project.mesh_filename, use_cache=use_cache, verbose=True)
43print domain.statistics()
44
45
46#-------------------------
47# Initial Conditions
48#-------------------------
49domain.set_quantity('friction', 0.0)
50domain.set_quantity('stage', 0.0)
51domain.set_quantity('elevation',
52                    filename=project.bathymetry_filename,
53                    alpha=0.02,                   
54                    verbose=True,
55                    use_cache=use_cache)
56
57
58#-------------------------
59# Distribute domain if run in parallel
60#-------------------------
61if numprocs > 1:
62    domain = distribute(domain)
63
64
65#-------------------------
66# Set simulation parameters
67#-------------------------
68domain.set_name(project.output_filename)  # Name of output sww file
69domain.set_default_order(2)               # Apply second order scheme
70domain.set_all_limiters(0.9)              # Max second order scheme (old lim)
71domain.set_minimum_storable_height(0.001) # Don't store w < 0.001m
72domain.set_maximum_allowed_speed(0.1)     # Allow a little runoff (0.1 is OK)
73
74
75#-------------------------
76# Boundary Conditions
77#-------------------------
78
79# Create boundary function from timeseries provided in file
80function = file_function(project.boundary_filename,
81                         domain, verbose=True)
82
83# Create and assign boundary objects
84Bts = Transmissive_Momentum_Set_Stage_boundary(domain, function)
85Br = Reflective_boundary(domain)
86domain.set_boundary({'wave': Bts, 'wall': Br})
87
88
89#-------------------------
90# Evolve through time
91#-------------------------
92import time
93t0 = time.time()
94
95for t in domain.evolve(yieldstep = 0.05, finaltime = 22.5):
96    domain.write_time()
97
98print 'That took %.2f seconds' %(time.time()-t0)
Note: See TracBrowser for help on using the repository browser.