source: trunk/anuga_work/development/mem_time_tests/NCIparallel/area/runcairns.py @ 8317

Last change on this file since 8317 was 8317, checked in by pittj, 11 years ago

correcting the mistake in the last svn

  • Property svn:executable set to *
File size: 4.6 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
21import liststore
22
23# Related major packages
24import anuga
25from anuga_parallel import distribute, myid
26from anuga.abstract_2d_finite_volumes.util import add_directories
27from anuga.utilities import system_tools, log
28
29
30home2 = os.getenv('INUNDATIONHOME')
31
32scenariodir2 = add_directories(home2, ["data", "mem_time_test", "triangles", "area"])
33
34h = 'CAIRNS.msh'
35file_pathh = os.path.join(scenariodir2, h)
36store ='store.txt'
37file_path_store = os.path.join(scenariodir2, store)
38storen ='storen.txt'
39file_path_storen = os.path.join(scenariodir2, storen)
40storel = 'storel.txt'
41file_path_storel = os.path.join(scenariodir2, storel)
42storea = 'storea.txt'
43file_path_storea = os.path.join(scenariodir2, storea)
44
45f = open(file_path_storel,'r+') # SQRT extent this is set
46length = float(f.readline())
47f.close()
48
49f = open(file_path_storea,'r+') #maxarea this is set
50area = float(f.readline())
51f.close()
52
53system_tools.MemoryUpdate()
54#------------------------------------------------------------------------------
55# Create the triangular mesh and domain based on
56# overall clipping polygon with a tagged
57# boundary and interior regions as defined in project.py
58#------------------------------------------------------------------------------
59if myid == 0:
60    domain = anuga.create_domain_from_regions([(0.0,0.0),(length,length),(0.0,length),(length,0.0)],
61                                    boundary_tags={'top': [0],
62                                                   'right': [1],
63                                                   'bottom': [2],
64                                                   'left': [3]},
65                                    maximum_triangle_area=area,
66                                    mesh_filename=file_pathh
67                                    #,interior_regions=INTERIORREGIONS#,
68                                    #use_cache=True,
69                                    #verbose=True)
70                                    )
71
72    n = len(domain)
73else:
74    domain = None
75     
76domain = distribute(domain)
77                               
78#------------------------------------------------------------------------------
79# Setup parameters of computational domain
80#------------------------------------------------------------------------------
81domain.set_name('CAIRNS.sww') # Name of sww file
82domain.set_datadir(scenariodir2)                       # Store sww output here
83
84#------------------------------------------------------------------------------
85# Setup initial conditions
86#------------------------------------------------------------------------------
87
88def topography(x,y):
89    return 0.0
90
91tide = 100.0
92friction = 0.0
93domain.set_quantity('stage', tide)
94domain.set_quantity('friction', friction) 
95domain.set_quantity('elevation',topography,alpha=0.1)
96
97
98
99#------------------------------------------------------------------------------
100# Setup boundary conditions
101#------------------------------------------------------------------------------
102
103Bi = anuga.Dirichlet_boundary([tide, 0, 0]) # inflow
104Bo = anuga.Dirichlet_boundary([-tide,0, 0]) # inflow
105Bs = anuga.Transmissive_stage_zero_momentum_boundary(domain) # Neutral boundary
106Br = anuga.Reflective_boundary(domain)
107#Bw = anuga.Time_boundary(domain=domain,function=lambda t: [(60<t<3660)*50, 0, 0])
108domain.set_boundary({'right': Bo,
109                     'bottom': Br,
110                     'left': Bi,
111                     'top': Br})
112
113
114#------------------------------------------------------------------------------
115# Evolve system through time
116#------------------------------------------------------------------------------
117
118# Save every two mins leading up to wave approaching land
119for t in domain.evolve(yieldstep=500, finaltime=2000): 
120    print domain.timestepping_statistics()
121   
122
123liststore.store[myid] = system_tools.MemoryUpdate()[0]
124a = sum(liststore.store)
125
126v = open(file_path_store, 'r+')
127v.write(str(a))
128
129i = open(file_path_storen, 'r+')
130i.write(str(n))
131
132
Note: See TracBrowser for help on using the repository browser.