[5076] | 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 | |
---|
[5092] | 8 | xslope = 5.0 # Distance between the boundary ande the start of the slope |
---|
[5076] | 9 | |
---|
[5092] | 10 | |
---|
[5076] | 11 | def generate(mesh_filename, maximum_triangle_area=0.01): |
---|
| 12 | """ |
---|
| 13 | Generate mesh for University of Aberbeen dam break flume. |
---|
| 14 | The gate position is the distance from the right wall of the wave tank |
---|
| 15 | to the gate. |
---|
| 16 | |
---|
| 17 | """ |
---|
| 18 | #Basic geometry |
---|
[5092] | 19 | global xslope |
---|
[5076] | 20 | |
---|
| 21 | xright = 19.0 |
---|
| 22 | ybottom = 0 |
---|
[5092] | 23 | ytop = 1.00 |
---|
[5076] | 24 | xleft = 0.0 |
---|
[5092] | 25 | ###xslope = slope |
---|
[5076] | 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 | |
---|
| 34 | # slope seperation (middle) |
---|
| 35 | point_slope_top = [xslope, ytop] |
---|
| 36 | point_slope_bottom = [xslope, ybottom] |
---|
| 37 | |
---|
| 38 | m = Mesh() |
---|
| 39 | |
---|
| 40 | #Boundary |
---|
| 41 | points = [point_sw, #se |
---|
| 42 | point_nw, |
---|
| 43 | point_slope_top, |
---|
| 44 | point_ne, |
---|
| 45 | point_se, |
---|
| 46 | point_slope_bottom |
---|
| 47 | ] |
---|
| 48 | |
---|
| 49 | segments = [ |
---|
| 50 | [0,1], |
---|
| 51 | [1,2], |
---|
| 52 | [2,3], |
---|
| 53 | [3,4], |
---|
| 54 | [4,5], |
---|
| 55 | [5,0], #The outer border |
---|
| 56 | [2,5] # slope separator |
---|
| 57 | ] |
---|
| 58 | |
---|
| 59 | segment_tags = {'wall':[1,2,3,4,5], |
---|
| 60 | 'wave':[0]} # '':[6] |
---|
| 61 | |
---|
| 62 | m.add_points_and_segments(points, segments, segment_tags) |
---|
| 63 | |
---|
| 64 | dam = m.add_region(xslope - 0.0000001,(ytop - ybottom)/2) |
---|
| 65 | # this is the location of the reservoir region. |
---|
| 66 | dam.setTag("flat") |
---|
| 67 | |
---|
| 68 | slope = m.add_region(xslope + 0.0000001,(ytop - ybottom)/2) |
---|
| 69 | # this is the location of the slope region. |
---|
| 70 | slope.setTag("slope") |
---|
| 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") |
---|