# source:anuga_work/development/Hinwood_2008/create_mesh.py@5413

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

Hinwood scenario

File size: 2.3 KB
Line
1"""Create mesh for Jon Hinwoods wave 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 and the start of the slope
9
10
11def generate(mesh_filename, slope, maximum_triangle_area=0.01):
12    """
13    Generate mesh for Monash University wave generation flume.
14
15    Origin of x coordinate is the toe of the beach, x measured
16    positive shorewards.
17
18    """
19    #Basic geometry
20    global xslope
21
22    xleft = slope['xleft'][0]
23    xtoe = slope['xtoe'][0]
24    xbeach = slope['xbeach'][0]
25    xright = slope['xright'][0]
26    ybottom = 0
27    ytop    = 1.00
28    ###xslope = slope
29
30    #Outline
31    point_sw = [xleft, ybottom]
32    point_se = [xright, ybottom]
33    point_nw = [xleft, ytop]
34    point_ne = [xright, ytop]
35
36
37    # 1st slope seperation (middle)
38    point_toe_top = [xtoe, ytop]
39    point_toe_bottom = [xtoe, ybottom]
40
41    # 2nd slope seperation (middle)
42    point_beach_top = [xbeach, ytop]
43    point_beach_bottom = [xbeach, ybottom]
44
45    m = Mesh()
46
47    #Boundary
48    points = [point_sw,   #se
49              point_nw,
50              point_toe_top, # 2
51              point_beach_top, # 3
52              point_ne,
53              point_se,
54              point_beach_bottom, # 6
55              point_toe_bottom # 7
56              ]
57
58    segments = [
59        [0,1],
60        [1,2],
61        [2,3],
62        [3,4],
63        [4,5],
64        [5,6],
65        [6,7],
66        [7,0],  #The outer border
67        [2,7],       # toe separator
68        [3,6]       # _beach separator
69        ]
70
71    segment_tags = {'wall':[1,2,3,4,5,6,7],
72                    'wave':[0]} # '':[6]
73
75
76#     dam = m.add_region(xslope - 0.0000001,(ytop - ybottom)/2)
77#     # this is the location of the reservoir region.
78#     dam.setTag("flat")
79
80#     slope = m.add_region(xslope + 0.0000001,(ytop - ybottom)/2)
81#     # this is the location of the slope region.
82#     slope.setTag("slope")
83
84    m.generate_mesh(maximum_triangle_area=maximum_triangle_area)
85
86    m.export_mesh_file(mesh_filename)
87    print "mesh created"
88
89#-------------------------------------------------------------
90if __name__ == "__main__":
91    generate("aa.tsh")
Note: See TracBrowser for help on using the repository browser.