source:anuga_work/development/Hinwood_2008/create_mesh.py@5092

Last change on this file since 5092 was 5092, checked in by duncan, 15 years ago

updated simulations

File size: 1.9 KB
Line
1"""Create mesh for University of Queensland dam break flume
2"""
3
4
5from anuga.pmesh.mesh import *
6from anuga.coordinate_transforms.geo_reference import Geo_reference
7
8xslope = 5.0 # Distance between the boundary ande the start of the slope
9
10
11def 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
19    global xslope
20
21    xright  = 19.0
22    ybottom = 0
23    ytop    = 1.00
24    xleft = 0.0
25    ###xslope = slope
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
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#-------------------------------------------------------------
78if __name__ == "__main__":
79    generate("aa.tsh")
Note: See TracBrowser for help on using the repository browser.