1 | """Script for running a tsunami inundation scenario for Cairns, QLD Australia. |
---|
2 | |
---|
3 | Source data such as elevation and boundary data is assumed to be available in |
---|
4 | directories specified by project.py |
---|
5 | The output sww file is stored in directory named after the scenario, i.e |
---|
6 | slide or fixed_wave. |
---|
7 | |
---|
8 | The scenario is defined by a triangular mesh created from project.polygon, |
---|
9 | the elevation data and a tsunami wave generated by a submarine mass failure. |
---|
10 | |
---|
11 | Geoscience Australia, 2004-present |
---|
12 | """ |
---|
13 | |
---|
14 | |
---|
15 | |
---|
16 | #------------------------------------------------------------------------------ |
---|
17 | # Import necessary modules |
---|
18 | #------------------------------------------------------------------------------ |
---|
19 | # Standard modules |
---|
20 | import os |
---|
21 | import time |
---|
22 | import sys |
---|
23 | import random |
---|
24 | |
---|
25 | # Related major packages |
---|
26 | import anuga |
---|
27 | |
---|
28 | |
---|
29 | def 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 | |
---|