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

Last change on this file since 5577 was 5577, checked in by duncan, 16 years ago

Current Hinwood scenario calculating RMSD's

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