source: development/okushiri_2005/create_mesh.py @ 3535

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

change imports so reflect the new structure

File size: 3.6 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 anuga.pmesh.mesh import *
9from anuga.coordinate_transforms.geo_reference import Geo_reference
10
11#-------------------------------------------------------------
12if __name__ == "__main__":
13
14
15    #Basic geometry
16   
17    xleft   = 0
18    xright  = 5.448
19    ybottom = 0
20    ytop    = 3.402
21
22    #Outline
23    point_sw = [xleft, ybottom]
24    point_se = [xright, ybottom]
25    point_nw = [xleft, ytop]   
26    point_ne = [xright, ytop]
27
28    #Midway points (left)
29    point_mtop = [xleft + (xright-xleft)/3+1, ytop]
30    point_mbottom = [xleft + (xright-xleft)/3+1, ybottom]
31
32
33    geo = Geo_reference(xllcorner = xleft,
34                        yllcorner = ybottom)
35   
36                       
37    print "***********************"
38    print "geo ref", geo
39    print "***********************"
40   
41    m = Mesh(geo_reference=geo)
42
43    #Boundary
44    dict = {}
45    dict['points'] = [point_se,   #se
46                      point_ne,
47                      point_mtop,
48                      point_nw,
49                      point_sw,
50                      point_mbottom]
51
52   
53    dict['segments'] = [[0,1], [1,2], [2,3], [3,4],
54                        [4,5], [5,0],  #The outer border
55                        [2,5]]         #Separator
56   
57    dict['segment_tags'] = ['wall',
58                            'wall',
59                            'wall',
60                            'wave',
61                            'wall',
62                            'wall',
63                            '']           #Interior
64
65       
66    m.addVertsSegs(dict)
67
68
69
70
71
72    #Localised refined area for gulleys
73    dict = {}
74    xl = 4.8
75    xr = 5.3
76    yb = 1.6
77    yt = 2.3
78    p0 = [xl, yb]
79    p1 = [xr, yb]
80    p2 = [xr, yt]
81    p3 = [xl, yt]
82   
83    dict['points'] = [p0, p1, p2, p3]
84    dict['segments'] = [[0,1], [1,2], [2,3], [3,0]]
85    dict['segment_tags'] = ['', '', '', '']
86    m.addVertsSegs(dict)   
87
88    #Island area
89    island_0 = [xleft + 2*(xright-xleft)/3+1.2, ytop-0.5]
90    island_1 = [xleft + 2*(xright-xleft)/3+0.5, ybottom + 2*(ytop-ybottom)/3]
91    island_2 = [xleft + (xright-xleft)/2+0.3, ybottom + 2*(ytop-ybottom)/3-0.3]
92    island_3 = [xleft + (xright-xleft)/2+0.3, ybottom + (ytop-ybottom)/3+0.3]
93    island_4 = [xleft + 2*(xright-xleft)/3+0.4, ybottom + (ytop-ybottom)/3-0.3] 
94    island_5 = [xleft + 2*(xright-xleft)/3+1.2, ybottom+0.2]
95    island_6 = [xl-.01, yb]  #OK
96    island_7 = [xl-.01, yt]  #OK     
97   
98
99    dict['points'] = [island_0, island_1, island_2,
100                      island_3, island_4, island_5,
101                      #p0, p3]                     
102                      island_6, island_7]
103
104                     
105    dict['segments'] = [[0,1], [1,2], [2,3], [3,4],
106                        [4,5], [5,6], [6,7], [7,0]]
107                       
108    dict['segment_tags'] = ['', '', '', '', '', '', '', '']
109
110
111    m.addVertsSegs(dict)   
112
113   
114#
115
116    #Fine resolution. Needs alpha >= 0.001   
117    base_resolution = 1
118
119    ocean = m.addRegionEN(xleft+.1, ybottom+.1)
120    ocean.setMaxArea(0.1*base_resolution)
121
122    mid = m.addRegionEN(point_mbottom[0]+.1, ybottom+.1)
123    mid.setMaxArea(0.0005*base_resolution)
124   
125
126    inner = m.addRegionEN(island_3[0]+.1, island_3[1]+.1)
127    inner.setMaxArea(0.00007*base_resolution)
128
129
130    gulleys = m.addRegionEN(p0[0]+0.1, p0[1]+0.1)
131    gulleys.setMaxArea(0.00002*base_resolution)
132
133
134
135    m.generateMesh('pzq28.0za1000000a')
136
137    import project
138    m.export_mesh_file(project.mesh_filename)
139   
Note: See TracBrowser for help on using the repository browser.