source: anuga_work/development/dam_2006/create_mesh.py @ 5102

Last change on this file since 5102 was 4033, checked in by duncan, 18 years ago

Getting the dam break simulation going

File size: 1.7 KB
RevLine 
[4007]1"""Create mesh for University of Queensland dam break flume
[3125]2"""
3
4
[3535]5from anuga.pmesh.mesh import *
6from anuga.coordinate_transforms.geo_reference import Geo_reference
[3125]7
[3421]8
[4008]9def generate(mesh_filename, gate_position, is_coarse = False):
[4007]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    """
[3125]16    #Basic geometry
17   
[3446]18    xright  = gate_position
[3125]19    ybottom = 0
20    ytop    = 0.4
[3421]21    xdam = 0.0
[3446]22    xleft = gate_position  - 3.0
[3125]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]
[3428]32    point_dam_bottom = [xdam, ybottom]   
[3125]33
34    m = Mesh()
35
36    #Boundary
[3541]37    points = [point_sw,   #se
38              point_nw,
39              point_dam_top,
40              point_ne, 
41              point_se, 
42              point_dam_bottom
43              ]
[3426]44   
[3541]45    segments = [[0,1], [1,2], [2,3],
[3428]46                        [3,4 ],[4,5], [5,0],  #The outer border
47                        [2,5]]         #dam Separator
[3125]48   
[3541]49    segment_tags = {'wall':[0,1,2,4,5],'edge':[3]} # '':[6]
[3125]50       
[3541]51    m.add_points_and_segments(points, segments, segment_tags)
[3408]52   
[3446]53    dam = m.add_region(-0.0000001,(ytop - ybottom)/2)
[3420]54    # this is the location of the region.
[3421]55    dam.setTag("dam")
56   
[4033]57    if is_coarse:
[3420]58        m.generate_mesh(maximum_triangle_area=0.01)
59    else:
60        m.generate_mesh(maximum_triangle_area=0.0001)
[3125]61
[3421]62    m.export_mesh_file(mesh_filename)
[3125]63    print "mesh created"
64
65#-------------------------------------------------------------
66if __name__ == "__main__":
[3421]67    generate("aa.tsh", 0.75, is_course = True)
Note: See TracBrowser for help on using the repository browser.