source: anuga_work/production/dampier_2006/run_dampier.py @ 3802

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

Made sure Dampier 2006 runs

File size: 4.9 KB
Line 
1"""Script for running tsunami inundation scenario for Dampier, WA, Australia.
2
3Source data such as elevation and boundary data is assumed to be available in
4directories specified by project.py
5The output sww file is stored in project.outputtimedir
6
7The scenario is defined by a triangular mesh created from project.polygon,
8the elevation data and a simulated submarine landslide.
9
10Ole Nielsen and Duncan Gray, GA - 2005 and Jane Sexton, Nick Bartzis, GA - 2006
11"""
12
13#------------------------------------------------------------------------------
14# Import necessary modules
15#------------------------------------------------------------------------------
16
17# Standard modules
18from os import sep
19from os.path import dirname, basename
20from os import mkdir, access, F_OK
21from shutil import copy
22import time
23import sys
24
25
26# Related major packages
27from anuga.shallow_water import Domain
28from anuga.shallow_water import Dirichlet_boundary
29from anuga.shallow_water import File_boundary
30from anuga.shallow_water import Reflective_boundary
31
32from anuga.pmesh.mesh_interface import create_mesh_from_regions
33
34from anuga.geospatial_data.geospatial_data import *
35
36# Application specific imports
37import project                 # Definition of file names and polygons
38
39
40
41#------------------------------------------------------------------------------
42# Copy scripts to time stamped output directory and capture screen
43# output to file
44#------------------------------------------------------------------------------
45
46# filenames
47meshname = project.meshname+'.msh'
48source_dir = project.boundarydir
49
50
51# creates copy of code in output dir if dir doesn't exist
52if access(project.outputtimedir,F_OK) == 0:
53    mkdir (project.outputtimedir)
54copy (dirname(project.__file__) +sep+ project.__name__+'.py',
55      project.outputtimedir + project.__name__+'.py')
56copy (__file__, project.outputtimedir + basename(__file__))
57print 'project.outputtimedir',project.outputtimedir
58
59
60
61#--------------------------------------------------------------------------
62# Create the triangular mesh based on overall clipping polygon with a
63# tagged
64# boundary and interior regions defined in project.py along with
65# resolutions (maximal area of per triangle) for each polygon
66#--------------------------------------------------------------------------
67
68
69interior_regions = [#[project.karratha_polygon, 25000],
70                    #[project.dampier_polygon, 2000],
71                    #[project.refinery_polygon, 2000],
72                    #[project.point_polygon, 2000]]
73                    #[project.cipma_polygon, 20000]]
74                    [project.cipma_polygon, 4000]]    # Caused memory error?
75
76
77
78print 'start create mesh from regions'
79meshname = project.meshname + '.msh'
80create_mesh_from_regions(project.bounding_polygon,
81                         boundary_tags={'back': [7, 8], 'side': [0, 6],
82                                        'ocean': [1, 2, 3, 4, 5]},
83                         maximum_triangle_area=200000,
84                         interior_regions=interior_regions,
85                         filename=meshname,
86                         use_cache=True,
87                         verbose=True)
88
89
90#-------------------------------------------------------------------------
91# Setup computational domain
92#-------------------------------------------------------------------------
93domain = Domain(meshname, use_cache=True, verbose=True)
94print domain.statistics()
95domain.set_name(project.basename)
96domain.set_datadir(project.outputtimedir)
97domain.set_default_order(2)
98domain.set_minimum_storable_height(0.01) # Don't store anything less than 1cm
99
100
101
102#-------------------------------------------------------------------------
103# Setup initial conditions
104#-------------------------------------------------------------------------
105tide = 0.
106domain.set_quantity('stage', tide)
107domain.set_quantity('friction', 0.0) 
108domain.set_quantity('elevation', 
109                    filename = project.datadir + project.basename + '.pts',
110                    use_cache = False,
111                    verbose = True,
112                    alpha = 0.1)
113
114
115#-------------------------------------------------------------------------
116# Setup boundary conditions
117#-------------------------------------------------------------------------
118
119print 'Available boundary tags', domain.get_boundary_tags()
120
121Bf = File_boundary(source_dir + project.boundary_basename + '.sww',
122                   domain, verbose = True)
123Br = Reflective_boundary(domain)
124Bd = Dirichlet_boundary([tide,0,0])
125domain.set_boundary({'back': Br,
126                     'side': Bd,
127                     'ocean': Bf}) 
128
129
130#----------------------------------------------------------------------------
131# Evolve system through time
132#----------------------------------------------------------------------------
133import time
134t0 = time.time()
135
136for t in domain.evolve(yieldstep = 60, finaltime = 28600):
137    domain.write_time()
138    domain.write_boundary_statistics(tags = 'ocean')     
139   
140print 'That took %.2f seconds' %(time.time()-t0)
141
Note: See TracBrowser for help on using the repository browser.