source: anuga_work/production/karratha_2006/run_karratha.py @ 3744

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

Made karratha production use newly resolved convert_from_latlon_to_UTM

File size: 4.9 KB
Line 
1"""Script for running tsunami inundation scenario for Karratha, 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                    #[project.neil1_polygon, 4000],
76                    #[project.neil2_polygon, 64000]]
77
78
79
80print 'start create mesh from regions'
81meshname = project.meshname + '.msh'
82create_mesh_from_regions(project.bounding_polygon,
83                         boundary_tags={'back': [7, 8], 'side': [0, 6],
84                                        'ocean': [1, 2, 3, 4, 5]},
85                         maximum_triangle_area=200000,
86                         interior_regions=interior_regions,
87                         filename=meshname,
88                         use_cache=True,
89                         verbose=True)
90
91#-------------------------------------------------------------------------
92# Setup computational domain
93#-------------------------------------------------------------------------
94domain = Domain(meshname, use_cache=True, verbose=True)
95print domain.statistics()
96domain.set_name(project.basename)
97domain.set_datadir(project.outputtimedir)
98
99
100#-------------------------------------------------------------------------
101# Setup initial conditions
102#-------------------------------------------------------------------------
103tide = 0.
104domain.set_quantity('stage', tide)
105domain.set_quantity('friction', 0.0) 
106domain.set_quantity('elevation', 
107                    filename = project.datadir + project.basename + '.pts',
108                    use_cache = False,
109                    verbose = True,
110                    alpha = 0.1)
111
112#-------------------------------------------------------------------------
113# Setup boundary conditions
114#-------------------------------------------------------------------------
115
116print 'Available boundary tags', domain.get_boundary_tags()
117
118Bf = File_boundary(source_dir + project.boundary_basename + '.sww',
119                   domain, verbose = True)
120Br = Reflective_boundary(domain)
121Bd = Dirichlet_boundary([tide,0,0])
122domain.set_boundary({'back': Br,
123                     'side': Bd,
124                     'ocean': Bf}) 
125
126
127#----------------------------------------------------------------------------
128# Evolve system through time
129#----------------------------------------------------------------------------
130import time
131t0 = time.time()
132
133for t in domain.evolve(yieldstep = 60, finaltime = 28600):
134    domain.write_time()
135    domain.write_boundary_statistics(tags = 'ocean')     
136   
137print 'That took %.2f seconds' %(time.time()-t0)
138
Note: See TracBrowser for help on using the repository browser.