source: anuga_work/development/convergence_okushiri_2008/run_okushiri_truescale.py @ 5396

Last change on this file since 5396 was 5396, checked in by Leharne, 16 years ago

Updating output directory in project and run scripts to automatically include run time, user and mesh resolution. Still in progress.

File size: 3.6 KB
Line 
1"""Validation of the AnuGA implementation of the shallow water wave equation.
2
3This script sets up a modified version of the Okushiri Island benchmark
4
5as published at
6
7THE THIRD INTERNATIONAL WORKSHOP ON LONG-WAVE RUNUP MODELS
8June 17-18 2004
9Wrigley Marine Science Center
10Catalina Island, California
11http://www.cee.cornell.edu/longwave/
12
13This version up-scales the original 1:400 scale wave-tank experiment, to
14"true-scale".
15
16The original validation data was downloaded and made available in this directory
17for convenience but the original data is available at
18http://www.cee.cornell.edu/longwave/index.cfm?page=benchmark&problem=2
19where a detailed description of the problem is also available.
20
21
22Run create_okushiri_truescale.py to process the boundary condition and build a the
23mesh before running this script.
24
25"""
26
27# Module imports
28from anuga.shallow_water import Domain
29from anuga.shallow_water import Reflective_boundary
30from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
31from anuga.abstract_2d_finite_volumes.util import file_function
32
33import project_truescale
34
35
36#-------------------------
37# Create Domain from mesh
38#-------------------------
39domain = Domain(project_truescale.mesh_filename, use_cache=True, verbose=True)
40print domain.statistics()
41
42z = domain.get_vertex_coordinates()
43
44# Write vertex coordinates to file
45filename='okushiri_mesh_vertex_coordinates_truescale.txt'
46fid=open(filename,'w')
47fid.write('x (m), y (m)\n')
48for i in range(len(z)):
49    pt=z[i]
50    x=pt[0]
51    y=pt[1]
52    fid.write('%.6f, %.6f\n' %(x, y))
53       
54#-------------------------
55# Initial Conditions
56#-------------------------
57domain.set_quantity('friction', 0.0)
58domain.set_quantity('stage', 0.0)
59domain.set_quantity('elevation',
60                    filename=project_truescale.bathymetry_filename,
61                    alpha=0.02,                   
62                    verbose=True,
63                    use_cache=True)
64
65
66#-------------------------
67# Set simulation parameters
68#-------------------------
69domain.set_name(project_truescale.output_filename)  # Name of output sww file
70domain.set_datadir(project_truescale.output_dir)
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.4)   # Don't store h < 0.4m
74domain.tight_slope_limiters = 1
75domain.beta_h = 0.0
76
77#Timings on AMD64-242 (beta_h=0)
78#  tight_slope_limiters = 0:
79#    3035s - 3110s
80#  tight_slope_limiters = 1:
81#    3000s - 3008s
82#
83# beta_h>0: In the order of 3200s
84
85#-------------------------
86# Boundary Conditions
87#-------------------------
88
89# Create boundary function from timeseries provided in file
90function = file_function(project_truescale.boundary_filename,
91                         domain, verbose=True)
92
93# Create and assign boundary objects
94Bts = Transmissive_Momentum_Set_Stage_boundary(domain, function)
95Br = Reflective_boundary(domain)
96domain.set_boundary({'wave': Bts, 'wall': Br})
97
98
99# Select triangle containing ch5 for diagnostic output
100# around known gauge
101triangle_id = domain.get_triangle_containing_point([1808.4, 478.4])
102# This should get triangle id 32833 with centroid (4.5244, 1.1972)
103
104
105#-------------------------
106# Evolve through time
107#-------------------------
108import time
109t0 = time.time()
110
111for t in domain.evolve(yieldstep = 1, finaltime = 450):
112    print domain.timestepping_statistics(track_speeds=False,
113                                         triangle_id=triangle_id)
114    print domain.boundary_statistics()
115
116print 'That took %.2f seconds' %(time.time()-t0)
Note: See TracBrowser for help on using the repository browser.