source: development/dam_2006/create_mesh.py @ 3420

Last change on this file since 3420 was 3420, checked in by duncan, 19 years ago

checking in scenario changes

File size: 2.0 KB
Line 
1"""Create mesh for lwru2 validation of the Oshiri island tsunami
2"""
3
4#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
5# Assume that the root AnuGA dir is included in your pythonpath
6#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7
8from pmesh.mesh import *
9from coordinate_transforms.geo_reference import Geo_reference
10
11import project
12def generate(gate_position, is_course = False):
13    #Basic geometry
14   
15    xleft   = - gate_position
16    xright  = 3.0 - gate_position
17    ybottom = 0
18    ytop    = 0.4
19    xdam = 0.0 
20
21    #Outline
22    point_sw = [xleft, ybottom]
23    point_se = [xright, ybottom]
24    point_nw = [xleft, ytop]   
25    point_ne = [xright, ytop]
26
27    # Dam seperation (left)
28    point_dam_top = [xdam, ytop]
29    point_dam_bottom = [xdam, ybottom]
30
31
32    m = Mesh()
33
34    #Boundary
35    # FIXME (DSG-DSG): Update this to use new interface.
36    dict = {}
37    dict['points'] = [point_se,   #se
38                      point_ne,
39                      point_dam_top,
40                      point_nw,
41                      point_sw,
42                      point_dam_bottom]
43
44    dict['segments'] = [[0,1], [1,2], [2,3], [3,4],
45                        [4,5], [5,0],  #The outer border
46                        [2,5]]         #Separator
47   
48    dict['segment_tags'] = ['wall',
49                            'wall',
50                            'wall',
51                            'wall', #back of the dam
52                            'wall',
53                            'wall',
54                            '']           #Interior
55
56       
57    m.addVertsSegs(dict)
58   
59    dam = m.add_region(0.0000001,(ytop - ybottom)/2)
60    # this is the location of the region.
61
62    dam.setTag("dam")
63    if is_course:
64        m.generate_mesh(maximum_triangle_area=0.01)
65    else:
66        m.generate_mesh(maximum_triangle_area=0.0001)
67
68    m.export_mesh_file(project.mesh_filename)
69    print "mesh created"
70
71#-------------------------------------------------------------
72if __name__ == "__main__":
73    pass
Note: See TracBrowser for help on using the repository browser.