source: anuga_work/debug/bad_time_step/create_mesh.py @ 6982

Last change on this file since 6982 was 5084, checked in by ole, 17 years ago

Simplified debug of transmissive_momentum_set_stage

File size: 1.8 KB
RevLine 
[5073]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, maximum_triangle_area=0.01):
10    """
11    Generate mesh for University of Aberbeen dam break flume.
12    The gate position is the distance from the right wall of the wave tank
13    to the gate.
14   
15    """
[5084]16   
[5073]17    #Basic geometry
18    xright  = 19.0
19    ybottom = 0
20    ytop    = 0.45
21    xleft = 0.0
22    xslope = 4.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
31    # slope seperation (middle)
32    point_slope_top = [xslope, ytop]
33    point_slope_bottom = [xslope, ybottom]   
34
35    m = Mesh()
36
37    #Boundary
38    points = [point_sw,   #se
39              point_nw,
40              point_slope_top,
41              point_ne, 
42              point_se,
43              point_slope_bottom
44              ]
45   
46    segments = [
47        [0,1],
48        [1,2],
49        [2,3],
50        [3,4],
51        [4,5],
52        [5,0],  #The outer border
53        [2,5]       # slope separator
54        ]   
55   
56    segment_tags = {'wall':[1,2,3,4,5],
57                    'wave':[0]} # '':[6]
58       
59    m.add_points_and_segments(points, segments, segment_tags)
60   
61    dam = m.add_region(xslope - 0.0000001,(ytop - ybottom)/2)
62    # this is the location of the reservoir region.
63    dam.setTag("flat")
64   
65    slope = m.add_region(xslope + 0.0000001,(ytop - ybottom)/2)
66    # this is the location of the slope region.
67    slope.setTag("slope")
68   
69    m.generate_mesh(maximum_triangle_area=maximum_triangle_area)
70
71    m.export_mesh_file(mesh_filename)
72    print "mesh created"
73
74#-------------------------------------------------------------
75if __name__ == "__main__":
76    generate("aa.tsh")
Note: See TracBrowser for help on using the repository browser.