1 | """Script for running tsunami inundation scenario for Dampier, WA, 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 project.output_run_time_dir |
---|
6 | |
---|
7 | The scenario is defined by a triangular mesh created from project.polygon, |
---|
8 | the elevation data and a simulated tsunami generated with URS code. |
---|
9 | |
---|
10 | Ole Nielsen and Duncan Gray, GA - 2005 and Jane Sexton, Nick Bartzis, GA - 2006 |
---|
11 | """ |
---|
12 | |
---|
13 | #------------------------------------------------------------------------------ |
---|
14 | # Import necessary modules |
---|
15 | #------------------------------------------------------------------------------ |
---|
16 | |
---|
17 | # Standard modules |
---|
18 | from os import sep |
---|
19 | from os.path import dirname, basename |
---|
20 | from os import mkdir, access, F_OK |
---|
21 | from shutil import copy |
---|
22 | import time |
---|
23 | import sys |
---|
24 | |
---|
25 | # Related major packages |
---|
26 | from anuga.shallow_water import Domain |
---|
27 | from anuga.shallow_water import Dirichlet_boundary |
---|
28 | from anuga.shallow_water import File_boundary |
---|
29 | from anuga.shallow_water import Reflective_boundary |
---|
30 | from anuga.shallow_water import Field_boundary |
---|
31 | from Numeric import allclose |
---|
32 | |
---|
33 | from anuga.pmesh.mesh_interface import create_mesh_from_regions |
---|
34 | from anuga.abstract_2d_finite_volumes.util import start_screen_catcher, copy_code_files,store_parameters |
---|
35 | from anuga_parallel.parallel_api import distribute, numprocs, myid, barrier |
---|
36 | from anuga_parallel.parallel_abstraction import get_processor_name |
---|
37 | from anuga.caching import myhash |
---|
38 | # Application specific imports |
---|
39 | import project # Definition of file names and polygons |
---|
40 | |
---|
41 | def run_model(**kwargs): |
---|
42 | |
---|
43 | # tide = kwargs['tide'] |
---|
44 | # alpha = kwargs['alpha'] |
---|
45 | # friction = kwargs['friction'] |
---|
46 | # time_thinning = kwargs['time_thinning'] |
---|
47 | scenario_name = kwargs['aa_scenario_name'] |
---|
48 | |
---|
49 | #------------------------------------------------------------------------------ |
---|
50 | # Copy scripts to time stamped output directory and capture screen |
---|
51 | # output to file |
---|
52 | #------------------------------------------------------------------------------ |
---|
53 | ''' |
---|
54 | #copy script must be before screen_catcher |
---|
55 | print 'tide',tide |
---|
56 | kwargs['est_num_trigs']=444444 |
---|
57 | kwargs['num_cpu']=numprocs |
---|
58 | kwargs['host']=project.host |
---|
59 | kwargs['res_factor']=project.res_factor |
---|
60 | kwargs['starttime']=project.starttime |
---|
61 | kwargs['yieldstep']=project.yieldstep |
---|
62 | kwargs['finaltime']=project.finaltime |
---|
63 | ''' |
---|
64 | kwargs['output_dir']=project.output_run_time_dir |
---|
65 | kwargs['bathy_file']=project.combined_dir_name+'.txt' |
---|
66 | kwargs['boundary_file']=project.boundaries_dir_name + '.sww' |
---|
67 | |
---|
68 | print 'output_dir',kwargs['output_dir'] |
---|
69 | if myid == 0: |
---|
70 | copy_code_files(kwargs['output_dir'],__file__, |
---|
71 | dirname(project.__file__)+sep+ project.__name__+'.py' ) |
---|
72 | |
---|
73 | store_parameters(**kwargs) |
---|
74 | |
---|
75 | barrier() |
---|
76 | |
---|
77 | start_screen_catcher(kwargs['output_dir'], myid, numprocs) |
---|
78 | ''' |
---|
79 | |
---|
80 | kwargs['act_num_trigs']=7777777 |
---|
81 | |
---|
82 | kwargs['input_start_time']=666 |
---|
83 | #kwargs 'completed' must be added to write the final parameters to file |
---|
84 | ''' |
---|
85 | kwargs['completed']=6 |
---|
86 | if myid == 0: |
---|
87 | store_parameters(**kwargs) |
---|
88 | barrier() |
---|
89 | |
---|
90 | |
---|
91 | #------------------------------------------------------------- |
---|
92 | if __name__ == "__main__": |
---|
93 | |
---|
94 | run_model(file_name=project.home+'detail_test.csv', aa_scenario_name='test_store_parameters', |
---|
95 | ab_time=project.time, res_factor= project.res_factor, |
---|
96 | # tide=project.tide, user=project.user, |
---|
97 | # alpha = project.alpha, friction=project.friction, |
---|
98 | # time_thinning = project.time_thinning, |
---|
99 | dir_comment=project.dir_comment) |
---|
100 | |
---|
101 | |
---|