source: inundation/ga/storm_surge/validation/LWRU2/create_mesh.py @ 1707

Last change on this file since 1707 was 1707, checked in by ole, 19 years ago
File size: 3.2 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 pyvolution.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_ml1 = [xleft + (xright-xleft)/3, ytop]
30    point_ml2 = [xleft + (xright-xleft)/3, ybottom]
31   
32    #Midway points (right)
33    point_mr1 = [xleft + 2*(xright-xleft)/3, ytop]
34    point_mr2 = [xleft + 2*(xright-xleft)/3, ybottom]
35
36
37    geo = Geo_reference(xllcorner = xleft,
38                        yllcorner = ybottom)
39   
40                       
41    print "***********************"
42    print "geo ref", geo
43    print "***********************"
44   
45    m = Mesh(geo_reference=geo)
46
47    #Boundary
48    dict = {}
49    dict['points'] = [point_se,   #se
50                      point_ne,
51                      point_mr1,
52                      point_ml1,                     
53                      point_nw,
54                      point_sw,
55                      point_ml2,                                           
56                      point_mr2]
57
58   
59    dict['segments'] = [[0,1], [1,2], [2,3], [3,4],
60                        [4,5], [5,6], [6,7], [7,0], #The outer border
61                        [2,7], [3,6]]               #Separators
62   
63    dict['segment_tags'] = ['wall',
64                            'wall',
65                            'wall',
66                            'wall',
67                            'wave',
68                            'wall',
69                            'wall',
70                            'wall',                                 
71                            '',           #Interior                           
72                            '']           #Interior
73
74       
75    m.addVertsSegs(dict)
76
77
78
79    #Localised refined area for gulleys
80    dict = {}
81    dict['points'] = [ [4.5, 1.8],
82                       [5.0, 1.8],
83                       [5.0, 2.5],
84                       [4.5, 2.5] ]                       
85                       
86    dict['segments'] = [[0,1], [1,2], [2,3], [3,0]]
87    dict['segment_tags'] = ['', '', '', '']
88    m.addVertsSegs(dict)   
89
90   
91    base_resolution = 1 
92
93    ocean = m.addRegionEN(xleft+1, ybottom+1)
94    ocean.setMaxArea(0.01*base_resolution)
95
96    mid = m.addRegionEN(point_ml2[0]+1, ybottom+1)
97    mid.setMaxArea(0.001*base_resolution)
98   
99
100    inner = m.addRegionEN(point_mr2[0]+1, ybottom+1)
101    inner.setMaxArea(0.0001*base_resolution)
102
103    gulleys = m.addRegionEN(dict['points'][0]+0.1, dict['points'][1]+0.1)
104    gulleys.setMaxArea(0.00001*base_resolution)   
105   
106   
107    m.generateMesh('pzq28.0za1000000a')
108
109    import filenames
110    m.export_mesh_file(filenames.mesh_filename)
111   
Note: See TracBrowser for help on using the repository browser.