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

Last change on this file since 3877 was 3877, checked in by nick, 16 years ago

build_dampier works... run might needs some changes

File size: 4.2 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.output_run_time_dir
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 *
35from anuga.abstract_2d_finite_volumes.util import Screen_Catcher
36from anuga_parallel.parallel_api import distribute, numprocs, myid
37
38# Application specific imports
39import project                 # Definition of file names and polygons
40
41
42
43#------------------------------------------------------------------------------
44# Copy scripts to time stamped output directory and capture screen
45# output to file
46#------------------------------------------------------------------------------
47
48# filenames
49
50build_time = '20061025_113524_build'
51boundaries_name = project.boundaries_name
52meshes_dir_name = project.meshes_dir_name+'.msh'
53#source_dir = project.boundarydir
54boundaries_time_dir_name = project.boundaries_dir + build_time + sep + boundaries_name
55
56
57#-------------------------------------------------------------------------
58# Setup computational domain
59#-------------------------------------------------------------------------
60print 'Setup computational domain'
61domain = Domain(meshes_dir_name, use_cache=True, verbose=True)
62print domain.statistics()
63
64
65#-------------------------------------------------------------------------
66# Setup initial conditions
67#-------------------------------------------------------------------------
68tide = project.tide
69domain.set_quantity('stage', tide)
70domain.set_quantity('friction', 0.0) 
71#combined_time_dir_name = project.topographies_dir+build_time+project.combined_name
72domain.set_quantity('elevation', 
73                    filename = project.topographies_dir + build_time + sep + project.combined_name + '.pts',
74                    use_cache = True,
75                    verbose = True,
76                    alpha = 0.1)
77
78
79#------------------------------------------------------
80# Distribute domain to implement parallelism !!!
81#------------------------------------------------------
82
83if numprocs > 1:
84    domain=distribute(domain)
85
86
87#------------------------------------------------------
88# Set domain parameters
89#------------------------------------------------------
90
91domain.set_name(project.scenario_name)
92domain.set_datadir(project.output_run_time_dir)
93domain.set_default_order(2) #associate to the spatial order of the triangle
94domain.set_minimum_storable_height(0.01) # Don't store anything less than 1cm
95
96
97#-------------------------------------------------------------------------
98# Setup boundary conditions
99#-------------------------------------------------------------------------
100
101
102print 'Available boundary tags', domain.get_boundary_tags()
103
104
105Bf = File_boundary(boundaries_time_dir_name + '.sww',
106                   domain, verbose = True)
107Br = Reflective_boundary(domain)
108Bd = Dirichlet_boundary([tide,0,0])
109domain.set_boundary({'back': Br,
110                     'side': Bd,
111                     'ocean': Bf}) 
112
113#----------------------------------------------------------------------------
114# Evolve system through time
115#----------------------------------------------------------------------------
116import time
117t0 = time.time()
118
119for t in domain.evolve(yieldstep = 120, finaltime = 28800):
120    domain.write_time()
121    domain.write_boundary_statistics(tags = 'ocean')     
122   
123print 'That took %.2f seconds' %(time.time()-t0)
124
Note: See TracBrowser for help on using the repository browser.