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

Last change on this file since 7463 was 5720, checked in by Leharne, 17 years ago

Updates to okushiri convergence study

File size: 5.1 KB
Line 
1"""Anuga convergence study using a true-scale version of the Okushiri
2Island tsunami wavetank experiment
3
4This script runs a modified version of the Okushiri Island benchmark
5
6as published at
7
8THE THIRD INTERNATIONAL WORKSHOP ON LONG-WAVE RUNUP MODELS
9June 17-18 2004
10Wrigley Marine Science Center
11Catalina Island, California
12http://www.cee.cornell.edu/longwave/
13
14This version up-scales the original 1:400 scale wave-tank experiment, to
15"true-scale" with mesh defined using interior polygons. The resolution is then
16varied by a factor of 2 to investigate convergence behaviour (refer to script
17project_truescale.py for details).
18
19The original validation data is available at
20http://www.cee.cornell.edu/longwave/index.cfm?page=benchmark&problem=2
21where a detailed description of the problem is also available.
22
23Run create_okushiri_truescale.py to convert bathymetry and input boundary
24condition into NetCDF format.
25
26"""
27#----------------------------------------
28# Import necessary modules
29#----------------------------------------
30
31# Standard modules
32from os import sep,umask
33from os.path import dirname, basename
34from os import mkdir, access, F_OK
35from shutil import copy
36import time
37import sys
38
39# Related major packages
40from anuga.shallow_water import Domain
41from anuga.shallow_water import Reflective_boundary
42from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
43from anuga.abstract_2d_finite_volumes.util import file_function
44from anuga.shallow_water.data_manager import copy_code_files, start_screen_catcher
45from anuga.pmesh.mesh_interface import create_mesh_from_regions
46
47
48import project_truescale # Definition of filenames and interior polygons
49
50copy_code_files(project_truescale.output_run_time_dir,'run_okushiri_truescale.py',
51                'project_truescale.py' )
52myid = 0
53numprocs = 1
54start_screen_catcher(project_truescale.output_run_time_dir, myid, numprocs)
55
56#--------------------------------------------------------------------------
57# Create the triangular mesh based on overall bounding polygon with a
58# tagged boundary and interior regions defined in project_truescale.py
59# along with resolutions (maximal area of per triangle) for each polygon
60#--------------------------------------------------------------------------
61
62create_mesh_from_regions(project_truescale.poly_all,
63                         boundary_tags={'wall': [0, 1, 3],'wave': [2]},
64                         maximum_triangle_area=project_truescale.res_poly_all,
65                         interior_regions=project_truescale.interior_regions, # comment out when not using interior polygon definitions
66                         filename=project_truescale.mesh_name+'.msh',
67                         verbose=True)
68
69#------------------------------
70# Create Domain from mesh
71#------------------------------
72domain = Domain(project_truescale.mesh_name+'.msh', use_cache=True, verbose=True)
73print domain.statistics()
74
75z = domain.get_vertex_coordinates()
76
77# Write vertex coordinates to file
78filename=project_truescale.vertex_filename
79fid=open(filename,'w')
80fid.write('x (m), y (m)\n')
81for i in range(len(z)):
82    pt=z[i]
83    x=pt[0]
84    y=pt[1]
85    fid.write('%.6f, %.6f\n' %(x, y))
86       
87#-------------------------
88# Initial Conditions
89#-------------------------
90domain.set_quantity('friction', 0.0)
91domain.set_quantity('stage', 0.0)
92domain.set_quantity('elevation',
93                    filename=project_truescale.bathymetry_filename,
94                    alpha=0.02,                   
95                    verbose=True,
96                    use_cache=True)
97
98
99#-------------------------
100# Set simulation parameters
101#-------------------------
102domain.set_name(project_truescale.output_filename)  # Name of output sww file
103domain.set_datadir(project_truescale.output_run_time_dir) # Name of output directory
104domain.set_default_order(2)               # Apply second order scheme
105domain.set_all_limiters(0.9)              # Max second order scheme (old lim)
106domain.set_minimum_storable_height(0.1)   # Don't store h < 0.1m
107
108
109#-------------------------
110# Boundary Conditions
111#-------------------------
112
113# Create boundary function from timeseries provided in file
114function = file_function(project_truescale.boundary_filename,
115                         domain, verbose=True)
116
117# Create and assign boundary objects
118Bts = Transmissive_Momentum_Set_Stage_boundary(domain, function)
119Br = Reflective_boundary(domain)
120domain.set_boundary({'wave': Bts, 'wall': Br})
121
122
123# Select triangle containing ch5 for diagnostic output
124# around known gauge
125triangle_id = domain.get_triangle_containing_point([1808.4, 478.4])
126# This should get triangle id 32833 with centroid (4.5244, 1.1972)
127
128
129#-------------------------
130# Evolve through time
131#-------------------------
132import time
133t0 = time.time()
134
135for t in domain.evolve(yieldstep=project_truescale.yieldstep, finaltime = 450):
136    print domain.timestepping_statistics(track_speeds=False,
137                                         triangle_id=triangle_id)
138    print domain.boundary_statistics()
139
140print 'That took %.2f seconds' %(time.time()-t0)
Note: See TracBrowser for help on using the repository browser.