source: trunk/anuga_work/development/mem_time_tests/triangles/fromregions/runcairns.py @ 8300

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

Adding files to measure time and memory use

  • Property svn:executable set to *
File size: 3.7 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
16#------------------------------------------------------------------------------
17# Import necessary modules
18#------------------------------------------------------------------------------
19# Standard modules
20import os
21import time
22import sys
23import random
24
25# Related major packages
26import anuga
27
28import PyVM
29import liststore
30
31def runex(l,a):
32
33    PyVM.MemoryUpdate()
34#------------------------------------------------------------------------------
35# Create the triangular mesh and domain based on
36# overall clipping polygon with a tagged
37# boundary and interior regions as defined in project.py
38#------------------------------------------------------------------------------
39    domain = anuga.create_domain_from_regions([(0.0,0.0),(l,l),(0.0,l),(l,0.0)],
40                                    boundary_tags={'top': [0],
41                                                   'right': [1],
42                                                   'bottom': [2],
43                                                   'left': [3]},
44                                    maximum_triangle_area=a,
45                                    mesh_filename='cairnsmesh.msh'
46                                    #,interior_regions=INTERIORREGIONS#,
47                                    #use_cache=True,
48                                    #verbose=True)
49                                    )
50
51    number=len(domain)
52
53                               
54#------------------------------------------------------------------------------
55# Setup parameters of computational domain
56#------------------------------------------------------------------------------
57    domain.set_name('CAIRNS') # Name of sww file
58    domain.set_datadir('.')                       # Store sww output here
59
60#------------------------------------------------------------------------------
61# Setup initial conditions
62#------------------------------------------------------------------------------
63
64    def topography(x,y):
65        return 0.0
66
67    tide = 100.0
68    friction = 0.0
69    domain.set_quantity('stage', tide)
70    domain.set_quantity('friction', friction) 
71    domain.set_quantity('elevation',topography,alpha=0.1)
72
73
74
75#------------------------------------------------------------------------------
76# Setup boundary conditions
77#------------------------------------------------------------------------------
78
79    Bi = anuga.Dirichlet_boundary([tide, 223.52, 0]) # inflow
80    Bo = anuga.Dirichlet_boundary([-tide, 223.52, 0]) # inflow
81    Bs = anuga.Transmissive_stage_zero_momentum_boundary(domain) # Neutral boundary
82    Br = anuga.Reflective_boundary(domain)
83#Bw = anuga.Time_boundary(domain=domain,function=lambda t: [(60<t<3660)*50, 0, 0])
84    domain.set_boundary({'right': Bo,
85                     'bottom': Br,
86                     'left': Bi,
87                     'top': Br})
88
89#------------------------------------------------------------------------------
90# Evolve system through time
91#------------------------------------------------------------------------------
92
93# Save every two mins leading up to wave approaching land
94    for t in domain.evolve(yieldstep=120, finaltime=2000): 
95        print domain.timestepping_statistics()
96   
97
98    return number
99
Note: See TracBrowser for help on using the repository browser.