source: trunk/anuga_work/development/mem_time_tests/triangles/serial/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.5 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
28
29def runex(l,a):
30
31#------------------------------------------------------------------------------
32# Create the triangular mesh and domain based on
33# overall clipping polygon with a tagged
34# boundary and interior regions as defined in project.py
35#------------------------------------------------------------------------------
36    domain = anuga.create_domain_from_regions([(0.0,0.0),(l,l),(0.0,l),(l,0.0)],
37                                    boundary_tags={'top': [0],
38                                                   'right': [1],
39                                                   'bottom': [2],
40                                                   'left': [3]},
41                                    maximum_triangle_area=a,
42                                    mesh_filename='cairnsmesh.msh'
43                                    #,interior_regions=INTERIORREGIONS#,
44                                    #use_cache=True,
45                                    #verbose=True)
46                                    )
47
48    number=len(domain)
49
50                               
51#------------------------------------------------------------------------------
52# Setup parameters of computational domain
53#------------------------------------------------------------------------------
54    domain.set_name('CAIRNS') # Name of sww file
55    domain.set_datadir('.')                       # Store sww output here
56#------------------------------------------------------------------------------
57# Setup initial conditions
58#------------------------------------------------------------------------------
59
60    def topography(x,y):
61        return 0.0
62
63    tide = 100.0
64    friction = 0.0
65    domain.set_quantity('stage', tide)
66    domain.set_quantity('friction', friction) 
67    domain.set_quantity('elevation',topography,alpha=0.1)
68
69
70
71#------------------------------------------------------------------------------
72# Setup boundary conditions
73#------------------------------------------------------------------------------
74
75    Bi = anuga.Dirichlet_boundary([tide, 0, 0]) # inflow
76    Bo = anuga.Dirichlet_boundary([-tide, 0, 0]) # inflow
77    Bs = anuga.Transmissive_stage_zero_momentum_boundary(domain) # Neutral boundary
78    Br = anuga.Reflective_boundary(domain)
79#Bw = anuga.Time_boundary(domain=domain,function=lambda t: [(60<t<3660)*50, 0, 0])
80    domain.set_boundary({'right': Bo,
81                     'bottom': Br,
82                     'left': Bi,
83                     'top': Br})
84
85#------------------------------------------------------------------------------
86# Evolve system through time
87#------------------------------------------------------------------------------
88
89# Save every two mins leading up to wave approaching land
90    for t in domain.evolve(yieldstep=0.01, finaltime=0.02): 
91        print domain.timestepping_statistics()
92   
93
94    return number
95
Note: See TracBrowser for help on using the repository browser.