1 | """Create mesh for lwru2 validation of the Oshiri island tsunami |
---|
2 | """ |
---|
3 | |
---|
4 | #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
5 | # Assume that the root AnuGA dir is included in your pythonpath |
---|
6 | #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
7 | |
---|
8 | from pmesh.mesh import * |
---|
9 | from pyvolution.coordinate_transforms.geo_reference import Geo_reference |
---|
10 | from pyvolution.coordinate_transforms.redfearn import redfearn |
---|
11 | |
---|
12 | |
---|
13 | import project |
---|
14 | |
---|
15 | #------------------------------------------------------------- |
---|
16 | if __name__ == "__main__": |
---|
17 | |
---|
18 | |
---|
19 | |
---|
20 | #Basic geometry |
---|
21 | |
---|
22 | south = project.south |
---|
23 | north = project.north |
---|
24 | west = project.west |
---|
25 | east = project.east |
---|
26 | |
---|
27 | refzone = project.refzone |
---|
28 | |
---|
29 | |
---|
30 | #SW |
---|
31 | zone, easting, northing = redfearn(south, west) |
---|
32 | assert zone == refzone |
---|
33 | point_sw = [easting, northing] |
---|
34 | |
---|
35 | #SE |
---|
36 | zone, easting, northing = redfearn(south, east) |
---|
37 | assert zone == refzone |
---|
38 | point_se = [easting, northing] |
---|
39 | |
---|
40 | #NW |
---|
41 | zone, easting, northing = redfearn(north, west) |
---|
42 | assert zone == refzone |
---|
43 | point_nw = [easting, northing] |
---|
44 | |
---|
45 | #NE |
---|
46 | zone, easting, northing = redfearn(north, east) |
---|
47 | assert zone == refzone |
---|
48 | point_ne = [easting, northing] |
---|
49 | |
---|
50 | |
---|
51 | geo = Geo_reference(xllcorner = 421544.35127423, #from dem |
---|
52 | yllcorner = 7677669.5257159, |
---|
53 | zone = refzone) |
---|
54 | |
---|
55 | |
---|
56 | print "***********************" |
---|
57 | print "geo ref", geo |
---|
58 | print "***********************" |
---|
59 | |
---|
60 | m = Mesh(geo_reference=geo) |
---|
61 | |
---|
62 | #Boundary |
---|
63 | dict = {} |
---|
64 | dict['points'] = [point_sw, |
---|
65 | point_se, |
---|
66 | point_ne, |
---|
67 | point_nw] |
---|
68 | |
---|
69 | |
---|
70 | dict['segments'] = [[0,1], [1,2], [2,3], [3,0]] |
---|
71 | dict['segment_tags'] = ['wall', 'wall', 'wall', 'wall'] |
---|
72 | |
---|
73 | m.addVertsSegs(dict) |
---|
74 | |
---|
75 | |
---|
76 | base_resolution = 100000 |
---|
77 | |
---|
78 | inner = m.addRegionEN(point_sw[0]+1, point_sw[1]+1) |
---|
79 | inner.setMaxArea(base_resolution) |
---|
80 | |
---|
81 | m.generateMesh('pzq28.0za1000000a') |
---|
82 | |
---|
83 | m.export_mesh_file(project.meshname + '.msh') |
---|
84 | |
---|