source: trunk/anuga_work/development/mem_time_tests/hardware/template/runcairns.py @ 8311

Last change on this file since 8311 was 8311, checked in by pittj, 12 years ago

updating the python script files

  • Property svn:executable set to *
File size: 4.4 KB
Line 
1"""Script for running a tsunami inundation scenario for Cairns, QLD 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 directory named after the scenario, i.e
6slide or fixed_wave.
7
8The scenario is defined by a triangular mesh created from project.polygon,
9the elevation data and a tsunami wave generated by a submarine mass failure.
10
11Geoscience Australia, 2004-present
12"""
13
14#------------------------------------------------------------------------------
15# Import necessary modules
16#------------------------------------------------------------------------------
17# Standard modules
18import os
19import time
20import sys
21
22# Related major packages
23import anuga
24
25from anuga_parallel import distribute, myid
26import liststore
27from anuga.abstract_2d_finite_volumes.util import add_directories
28from anuga.utilities import system_tools, log
29
30
31home2 = os.getenv('INUNDATIONHOME')
32
33scenariodir2 = add_directories(home2, ["data", "mem_time_test", "triangles", "area"])
34
35store ='store.txt'
36file_path_store = os.path.join(scenariodir2, store)
37h = 'cairnsmesh.msh'
38file_pathh = os.path.join(scenariodir2, h)
39
40
41system_tools.MemoryUpdate()
42#------------------------------------------------------------------------------
43# Create the triangular mesh and domain based on
44# overall clipping polygon with a tagged
45# boundary and interior regions as defined in project.py
46#------------------------------------------------------------------------------
47if myid == 0:
48    domain = anuga.create_domain_from_regions([(0.0,0.0),(10000.0,10000.0),(0.0,10000.0),(10000.0,0.0)],
49                                    boundary_tags={'top': [0],
50                                                   'right': [1],
51                                                   'bottom': [2],
52                                                   'left': [3]},
53                                    maximum_triangle_area=100.0,
54                                    mesh_filename=file_pathh
55                                    #,interior_regions=INTERIORREGIONS#,
56                                    #use_cache=True,
57                                    #verbose=True)
58                                    )
59
60    # Print some stats about mesh and domain
61    #print 'Number of triangles = ', len(domain)
62    #print 'The extent is ', domain.get_extent()
63    #print domain.statistics()
64else:
65    domain = None
66     
67domain = distribute(domain)
68                               
69#------------------------------------------------------------------------------
70# Setup parameters of computational domain
71#------------------------------------------------------------------------------
72domain.set_name('CAIRNS') # Name of sww file
73domain.set_datadir(scenariodir2)                       # Store sww output here
74
75#------------------------------------------------------------------------------
76# Setup initial conditions
77#------------------------------------------------------------------------------
78
79def topography(x,y):
80    return 0.0
81
82tide = 100.0
83friction = 0.0
84domain.set_quantity('stage', tide)
85domain.set_quantity('friction', friction) 
86domain.set_quantity('elevation',topography,alpha=0.1)
87
88
89
90#------------------------------------------------------------------------------
91# Setup boundary conditions
92#------------------------------------------------------------------------------
93
94Bi = anuga.Dirichlet_boundary([tide, 223.52, 0]) # inflow
95Bo = anuga.Dirichlet_boundary([-tide, 223.52, 0]) # inflow
96Bs = anuga.Transmissive_stage_zero_momentum_boundary(domain) # Neutral boundary
97Br = anuga.Reflective_boundary(domain)
98#Bw = anuga.Time_boundary(domain=domain,function=lambda t: [(60<t<3660)*50, 0, 0])
99domain.set_boundary({'right': Bo,
100                     'bottom': Br,
101                     'left': Bi,
102                     'top': Br})
103
104#------------------------------------------------------------------------------
105# Evolve system through time
106#------------------------------------------------------------------------------
107
108# Save every two mins leading up to wave approaching land
109for t in domain.evolve(yieldstep=120, finaltime=2000): 
110    print domain.timestepping_statistics()
111   
112
113liststore.spacelist[myid] = system_tools.MemoryUpdate()[0]
114a = sum(liststore.spacelist)
115print liststore.spacelist
116
117f = open(file_path_store, 'r+')
118f.write(str(a))
119
Note: See TracBrowser for help on using the repository browser.