1 | |
---|
2 | from os import sep, environ, getenv, getcwd |
---|
3 | import os |
---|
4 | |
---|
5 | import project |
---|
6 | from anuga.pmesh.mesh_interface import create_mesh_from_regions |
---|
7 | from anuga.shallow_water import Domain |
---|
8 | from anuga.shallow_water import File_boundary |
---|
9 | |
---|
10 | home = getenv('INUNDATIONHOME') #Sandpit's parent dir |
---|
11 | #user = get_user_name() |
---|
12 | data = 'data' |
---|
13 | state = 'western_australia' |
---|
14 | scenario_name = 'dampier' |
---|
15 | scenario = 'dampier_tsunami_scenario_2006' |
---|
16 | an = 'anuga' |
---|
17 | bo = 'boundaries' |
---|
18 | urs = 'urs' |
---|
19 | gridded = '1_10000' |
---|
20 | best_boundary_sww_file = 'o_test_8500_12000.sww' |
---|
21 | |
---|
22 | mesh_filename = 'small.tsh' # this will be local |
---|
23 | best_boundary_sww = os.path.join(data,state,scenario_name, |
---|
24 | scenario,an,bo,best_boundary_sww_file) |
---|
25 | |
---|
26 | #pro_instance = project.Project([data,state,scenario_name], |
---|
27 | # outputdir_name=outputdir_name) |
---|
28 | |
---|
29 | poly_all = [[250000,7660000],[280000,7660000], |
---|
30 | [280000,7630000]] |
---|
31 | create_mesh_from_regions(poly_all, |
---|
32 | boundary_tags={'back': [0,1,2]}, |
---|
33 | maximum_triangle_area=100000000000000000000, |
---|
34 | filename=mesh_filename, |
---|
35 | use_cache=False, |
---|
36 | verbose=True) |
---|
37 | domain = Domain( mesh_filename, verbose=True) |
---|
38 | print domain.statistics() |
---|
39 | |
---|
40 | domain.set_quantity('stage', 0.0) |
---|
41 | domain.set_quantity('friction', 0.01) |
---|
42 | domain.set_quantity('elevation', |
---|
43 | # filename = project.combined_dir_name + '.pts', |
---|
44 | # MUST USE TXT FILES FOR CACHING TO WORK! |
---|
45 | filename = project.combined_smaller_dir_name + '.txt', |
---|
46 | use_cache = True, |
---|
47 | verbose = True, |
---|
48 | alpha = 0.1) |
---|
49 | |
---|
50 | Bf = File_boundary(best_boundary_sww, |
---|
51 | domain, use_cache=False, verbose=True) |
---|