source: anuga_work/development/friction_dam_2006/create_mesh.py @ 5599

Last change on this file since 5599 was 4043, checked in by duncan, 17 years ago

Simulate dam break flume experiments to find an optimum Mannnings friction value

File size: 1.7 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
8
9def generate(mesh_filename, gate_position, is_coarse = False):
10    """
11    Generate mesh for University of Queensland 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  = gate_position
19    ybottom = 0
20    ytop    = 0.4
21    xdam = 0.0
22    xleft = gate_position  - 3.0
23
24    #Outline
25    point_sw = [xleft, ybottom]
26    point_se = [xright, ybottom]
27    point_nw = [xleft, ytop]   
28    point_ne = [xright, ytop]
29
30    # Dam seperation (left)
31    point_dam_top = [xdam, ytop]
32    point_dam_bottom = [xdam, ybottom]   
33
34    m = Mesh()
35
36    #Boundary
37    points = [point_sw,   #se
38              point_nw,
39              point_dam_top,
40              point_ne, 
41              point_se, 
42              point_dam_bottom
43              ]
44   
45    segments = [[0,1], [1,2], [2,3],
46                        [3,4 ],[4,5], [5,0],  #The outer border
47                        [2,5]]         #dam Separator
48   
49    segment_tags = {'wall':[0,1,2,4,5],'edge':[3]} # '':[6]
50       
51    m.add_points_and_segments(points, segments, segment_tags)
52   
53    dam = m.add_region(-0.0000001,(ytop - ybottom)/2)
54    # this is the location of the region.
55    dam.setTag("dam")
56   
57    if is_coarse:
58        m.generate_mesh(maximum_triangle_area=0.01)
59    else:
60        m.generate_mesh(maximum_triangle_area=0.0001)
61
62    m.export_mesh_file(mesh_filename)
63    print "mesh created"
64
65#-------------------------------------------------------------
66if __name__ == "__main__":
67    generate("aa.tsh", 0.75, is_course = True)
Note: See TracBrowser for help on using the repository browser.