1 | """Create mesh for lwru2 validation of the Oshiri island tsunami |
---|
2 | """ |
---|
3 | |
---|
4 | |
---|
5 | from anuga.pmesh.mesh import * |
---|
6 | from anuga.coordinate_transforms.geo_reference import Geo_reference |
---|
7 | |
---|
8 | |
---|
9 | def generate(mesh_filename, distance_offshore, beach_length, longshore_length, is_course = False): |
---|
10 | #Basic geometry |
---|
11 | |
---|
12 | xright = beach_length |
---|
13 | ybottom = 0 |
---|
14 | ytop = longshore_length |
---|
15 | xleft = -distance_offshore |
---|
16 | |
---|
17 | #Outline |
---|
18 | point_sw = [xleft, ybottom] |
---|
19 | point_se = [xright, ybottom] |
---|
20 | point_nw = [xleft, ytop] |
---|
21 | point_ne = [xright, ytop] |
---|
22 | |
---|
23 | |
---|
24 | m = Mesh() |
---|
25 | |
---|
26 | #Boundary |
---|
27 | points = [point_sw, #se |
---|
28 | point_nw, |
---|
29 | point_ne, |
---|
30 | point_se, |
---|
31 | ] |
---|
32 | |
---|
33 | segments = [[0,1], [1,2], [2,3], [3,0] |
---|
34 | ] #The outer border |
---|
35 | |
---|
36 | segment_tags = {'wall':[1,3],'edge':[2], 'back':[0]} # '':[6] |
---|
37 | |
---|
38 | m.add_points_and_segments(points, segments, segment_tags) |
---|
39 | |
---|
40 | if is_course: |
---|
41 | m.generate_mesh(maximum_triangle_area=20) |
---|
42 | else: |
---|
43 | m.generate_mesh(maximum_triangle_area=0.5) |
---|
44 | |
---|
45 | m.export_mesh_file(mesh_filename) |
---|
46 | print "mesh created" |
---|
47 | |
---|
48 | #------------------------------------------------------------- |
---|
49 | if __name__ == "__main__": |
---|
50 | generate("aa.tsh", 0.75, is_course = True) |
---|