1 | """Create mesh for University of Queensland dam break flume |
---|
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, maximum_triangle_area=0.01): |
---|
10 | """ |
---|
11 | Generate mesh for University of Aberbeen dam break flume. |
---|
12 | The gate position is the distance from the right wall of the wave tank |
---|
13 | to the gate. |
---|
14 | |
---|
15 | """ |
---|
16 | #Basic geometry |
---|
17 | |
---|
18 | xright = 19.0 # web site says a 20 m long flume |
---|
19 | #(http://www.eng.abdn.ac.uk/envhrg/facilities/swashrig.hti) |
---|
20 | # Therefore 19 +1 (for reservoir)= 20 |
---|
21 | ybottom = 0 |
---|
22 | ytop = 0.45 |
---|
23 | xdam = 0.0 |
---|
24 | xleft = -1.0 |
---|
25 | xslope = 4.0 # note, get in gen meshparrallel run dam as well! |
---|
26 | |
---|
27 | #Outline |
---|
28 | point_sw = [xleft, ybottom] |
---|
29 | point_se = [xright, ybottom] |
---|
30 | point_nw = [xleft, ytop] |
---|
31 | point_ne = [xright, ytop] |
---|
32 | |
---|
33 | # Dam seperation (left) |
---|
34 | point_dam_top = [xdam, ytop] |
---|
35 | point_dam_bottom = [xdam, ybottom] |
---|
36 | |
---|
37 | # slope seperation (middle) |
---|
38 | point_slope_top = [xslope, ytop] |
---|
39 | point_slope_bottom = [xslope, ybottom] |
---|
40 | |
---|
41 | m = Mesh() |
---|
42 | |
---|
43 | #Boundary |
---|
44 | points = [point_sw, #se |
---|
45 | point_nw, |
---|
46 | point_dam_top, |
---|
47 | point_slope_top, |
---|
48 | point_ne, |
---|
49 | point_se, |
---|
50 | point_slope_bottom, |
---|
51 | point_dam_bottom |
---|
52 | ] |
---|
53 | |
---|
54 | segments = [[0,1], [1,2], [2,3], |
---|
55 | [3,4 ],[4,5], [5,6],[6,7],[7,0], #The outer border |
---|
56 | [2,7], #dam Separator |
---|
57 | [3,6]] # slope separator |
---|
58 | |
---|
59 | segment_tags = {'wall':[0,1,2,3,5,6,7],'edge':[4]} # '':[6] |
---|
60 | |
---|
61 | m.add_points_and_segments(points, segments, segment_tags) |
---|
62 | |
---|
63 | dam = m.add_region(-0.0000001,(ytop - ybottom)/2) |
---|
64 | # this is the location of the reservoir region. |
---|
65 | dam.setTag("dam") |
---|
66 | |
---|
67 | slope = m.add_region(xslope + 0.0000001,(ytop - ybottom)/2) |
---|
68 | # this is the location of the slope region. |
---|
69 | slope.setTag("slope") |
---|
70 | #slope.setTag("dam") |
---|
71 | |
---|
72 | m.generate_mesh(maximum_triangle_area=maximum_triangle_area) |
---|
73 | |
---|
74 | m.export_mesh_file(mesh_filename) |
---|
75 | print "mesh created" |
---|
76 | |
---|
77 | #------------------------------------------------------------- |
---|
78 | if __name__ == "__main__": |
---|
79 | generate("aa.tsh", is_coarse = True) |
---|