source: anuga_core/source/obsolete_code/loading_pts.py @ 5453

Last change on this file since 5453 was 4232, checked in by duncan, 17 years ago

for debugging

File size: 3.1 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# Module imports
24from anuga.shallow_water import Domain
25from anuga.shallow_water import Reflective_boundary
26from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
27from anuga.abstract_2d_finite_volumes.util import file_function
28
29from anuga_parallel.parallel_api import myid, numprocs, distribute
30
31import project
32
33
34#-------------------------
35# Create Domain from mesh
36#-------------------------
37domain = Domain(project.mesh_filename, use_cache=True, verbose=True)
38print domain.statistics()
39
40
41#-------------------------
42# Initial Conditions
43#-------------------------
44domain.set_quantity('friction', 0.0)
45domain.set_quantity('stage', 0.0)
46
47import time
48t0 = time.time()
49bathymetry_filename=project.bathymetry_filename
50print 'Starting domain.set_quantity.  Loading ', bathymetry_filename
51domain.set_quantity('elevation',
52                    filename=bathymetry_filename,
53                    alpha=0.02,                   
54                    verbose=True,
55                    use_cache=False)
56
57print 'Set_quantity elevation took %.2f seconds' %(time.time()-t0)
58import sys; sys.exit() 
59
60#-------------------------
61# Distribute domain if run in parallel
62#-------------------------
63if numprocs > 1:
64    domain = distribute(domain)
65
66
67#-------------------------
68# Set simulation parameters
69#-------------------------
70domain.set_name(project.output_filename)  # Name of output sww file
71domain.set_default_order(2)               # Apply second order scheme
72domain.set_all_limiters(0.9)              # Max second order scheme (old lim)
73domain.set_minimum_storable_height(0.001) # Don't store w < 0.001m
74domain.set_maximum_allowed_speed(0.1)     # Allow a little runoff (0.1 is OK)
75
76
77#-------------------------
78# Boundary Conditions
79#-------------------------
80
81# Create boundary function from timeseries provided in file
82function = file_function(project.boundary_filename,
83                         domain, verbose=True)
84
85# Create and assign boundary objects
86Bts = Transmissive_Momentum_Set_Stage_boundary(domain, function)
87Br = Reflective_boundary(domain)
88domain.set_boundary({'wave': Bts, 'wall': Br})
89
90
91#-------------------------
92# Evolve through time
93#-------------------------
94import time
95t0 = time.time()
96
97for t in domain.evolve(yieldstep = 0.05, finaltime = 22.5):
98    domain.write_time()
99
100print 'That took %.2f seconds' %(time.time()-t0)
Note: See TracBrowser for help on using the repository browser.