Changeset 2312 for development/cairns_2006
- Timestamp:
- Feb 1, 2006, 2:03:12 PM (19 years ago)
- Location:
- development/cairns_2006
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
development/cairns_2006/create_mesh.py
r2286 r2312 22 22 coord_sw = convert_latlon_to_xycoords(-157,-24,latlong_origin) 23 23 coord_nw = convert_latlon_to_xycoords(-157,-8,latlong_origin) 24 25 """26 xleft = 027 ybottom = 028 xright = 10029 ytop = 10030 31 point_sw = [xleft, ybottom]32 point_se = [xright, ybottom]33 point_nw = [xleft, ytop]34 point_ne = [xright, ytop]35 36 """37 38 """39 #Outline40 point_sw = [coord_sw[0], coord_sw[1]]41 point_se = [coord_se[0], coord_se[1]]42 point_nw = [coord_nw[0], coord_nw[1]]43 point_ne = [coord_ne[0], coord_ne[1]]44 """45 24 46 25 # Sets origin which is needed by an instance of a mesh object 47 26 geo = Geo_reference(xllcorner = coord_se[0], 48 27 yllcorner = coord_se[1]) 49 50 # geo = Geo_reference(xllcorner = xleft,51 # yllcorner = ybottom)52 53 """54 coord_nw = [3.6e6,1e6]55 coord_ne = [0.0,1e6]56 coord_sw = [3.6e6,0.0]57 coord_se = [0.0,0.0]58 59 geo = Geo_reference(xllcorner = 0.0,60 yllcorner = 0.0)61 """62 28 63 29 print "***********************" … … 69 35 #Boundary 70 36 dict = {} 71 72 """73 dict['points'] = [point_se,74 point_ne,75 point_nw,76 point_sw]77 78 """79 37 80 38 dict['points'] = [coord_se, … … 82 40 coord_nw, 83 41 coord_sw] 84 85 # print dict['points']86 42 87 43 dict['segments'] = [[0,1], [1,2], [2,3], [3,0]] #The outer border … … 91 47 'border', 92 48 'border'] 93 94 49 95 50 m.addVertsSegs(dict) 96 51 52 97 53 dict = {} 98 54 # rupture zone 99 55 # Tonga-Kermadec Subduction zone 100 56 # located between 180E and -173W and 15S and 35S 101 p0 = convert_latlon_to_xycoords(-173,-20,latlong_origin)102 p1 = convert_latlon_to_xycoords(-173,-15,latlong_origin)103 p2 = convert_latlon_to_xycoords(-171,-15,latlong_origin)104 p3 = convert_latlon_to_xycoords(-171,-20,latlong_origin)57 r0 = convert_latlon_to_xycoords(-173,-20,latlong_origin) 58 r1 = convert_latlon_to_xycoords(-173,-15,latlong_origin) 59 r2 = convert_latlon_to_xycoords(-171,-15,latlong_origin) 60 r3 = convert_latlon_to_xycoords(-171,-20,latlong_origin) 105 61 106 """ 107 rupture_south = degminsec2decimal_degrees(-15,0,0) 108 rupture_north = degminsec2decimal_degrees(-17,0,0) 109 rupture_west = degminsec2decimal_degrees(-165,0,0) 110 rupture_east = degminsec2decimal_degrees(-166,0,0) 111 112 p0 = [rupture_south, rupture_west] 113 p1 = [rupture_south, rupture_east] 114 p2 = [rupture_north, rupture_east] 115 p3 = [rupture_north, rupture_west] 116 """ 117 118 119 dict['points'] = [p0, p1, p2, p3] 62 dict['points'] = [r0, r1, r2, r3] 120 63 dict['segments'] = [[0,1], [1,2], [2,3], [3,0]] 121 64 dict['segment_tags'] = ['', '', '', ''] … … 124 67 #Interior regions 125 68 # Cairns lat and long (16.575S, 145.45E) 126 c0 = convert_latlon_to_xycoords(145,-24,latlong_origin) 127 c1 = convert_latlon_to_xycoords(145,-8,latlong_origin) 128 c2 = convert_latlon_to_xycoords(146,-8,latlong_origin) 129 c3 = convert_latlon_to_xycoords(153,-24,latlong_origin) 69 c0 = convert_latlon_to_xycoords(149,-22,latlong_origin) 70 c1 = convert_latlon_to_xycoords(146,-19,latlong_origin) 71 c2 = convert_latlon_to_xycoords(145,-15,latlong_origin) 72 c3 = convert_latlon_to_xycoords(145,-13,latlong_origin) 73 c4 = convert_latlon_to_xycoords(146,-13,latlong_origin) 74 c5 = convert_latlon_to_xycoords(147,-17,latlong_origin) 75 c6 = convert_latlon_to_xycoords(153,-21,latlong_origin) 76 c7 = convert_latlon_to_xycoords(153,-22,latlong_origin) 130 77 131 """ 132 coast_south = degminsec2decimal_degrees(-16,0,0) 133 coast_north = degminsec2decimal_degrees(-17,0,0) 134 coast_west = degminsec2decimal_degrees(145,0,0) 135 coast_east = degminsec2decimal_degrees(145,75,0) 136 137 d0 = [coast_south, coast_west] 138 d1 = [coast_south, coast_east] 139 d2 = [coast_north, coast_east] 140 d3 = [coast_north, coast_west] 141 """ 142 143 dict['points'] = [c0, c1, c2, c3] 144 dict['segments'] = [[0,1], [1,2], [2,3], [3,0]] 145 dict['segment_tags'] = ['', '', '', ''] 78 dict['points'] = [c0, c1, c2, c3, c4, c5, c6, c7] 79 dict['segments'] = [[0,1], [1,2], [2,3], [3,4], [4,5], [5,6], [6,7], [7,0]] 80 dict['segment_tags'] = ['', '', '', '', '', '', '', ''] 146 81 m.addVertsSegs(dict) 147 82 … … 179 114 m.addVertsSegs(dict) 180 115 181 """182 Generates a rectangular region in the mesh. Could reduce the number of183 traingles needed for this refined area by creating a polygon that better184 resmebles the shape of the reef so areas of deep sea floor are not covered185 by un-necessary small traiangels186 116 187 188 # Interior regions189 reef1_south = degminsec2decimal_degrees(-20,44,0)190 reef1_north = degminsec2decimal_degrees(-20,42,0)191 reef1_west = degminsec2decimal_degrees(116,48,0)192 reef1_east = degminsec2decimal_degrees(116,53,30)117 #Exclude PNG because land mass has no effect on the wave that hits Cairns 118 # Papua New Guinea 119 p0 = convert_latlon_to_xycoords(145.5,-12.0,latlong_origin) 120 p1 = convert_latlon_to_xycoords(145.5,-8.0,latlong_origin) 121 p2 = convert_latlon_to_xycoords(154.5,-8.0,latlong_origin) 122 p3 = convert_latlon_to_xycoords(154.5,-12.0,latlong_origin) 193 123 194 k0 = [reef1_south, reef1_west] 195 k1 = [reef1_south, reef1_east] 196 k2 = [reef1_north, reef1_east] 197 k3 = [reef1_north, reef1_west] 198 199 dict['points'] = reef1_polygon = [k0, k1, k2, k3] 124 dict['points'] = [p0, p1, p2, p3] 200 125 dict['segments'] = [[0,1], [1,2], [2,3], [3,0]] 201 126 dict['segment_tags'] = ['', '', '', ''] 202 127 m.addVertsSegs(dict) 203 """ 204 205 base_resolution = 5e11 128 206 129 207 130 """ … … 212 135 m^2 213 136 """ 214 print coord_nw[0]-0.1 215 print coord_ne[1]-0.1 137 138 # base resolution = 5e11 gives good size test grid 139 #base_resolution = 5e11 140 base_resolution = 5e9 141 216 142 ocean = m.addRegionEN(coord_nw[0]-0.1, coord_nw[1]-0.1) 217 143 ocean.setMaxArea(base_resolution) 144 218 145 219 # ocean = m.addRegionEN(xright-0.1, ytop-0.1) 220 # ocean.setMaxArea(base_resolution) 221 222 rupture = m.addRegionEN(p0[0]+0.1, p0[1]+0.1) 223 rupture.setMaxArea(base_resolution) 146 rupture = m.addRegionEN(r0[0]+0.1, r0[1]+0.1) 147 rupture.setMaxArea(100*base_resolution) 224 148 225 149 coast = m.addRegionEN(c0[0]+0.1, c0[1]+0.1) 226 coast.setMaxArea(0.00 1*base_resolution)150 coast.setMaxArea(0.003*base_resolution) 227 151 228 152 fiji = m.addRegionEN(f0[0]+0.1, f0[1]+0.1) … … 233 157 234 158 melanesia = m.addRegionEN(m0[0]+0.1, m0[1]+0.1) 235 melanesia.setMaxArea(0.001*base_resolution) 159 melanesia.setMaxArea(0.01*base_resolution) 160 161 png = m.addRegionEN(p0[0]+0.1, p0[1]+0.1) 162 png.setMaxArea(0.01*base_resolution) 236 163 237 164 #a10000a refers to the max area passed to triangle -
development/cairns_2006/run_cairns.py
r2270 r2312 10 10 import sys, os 11 11 from pyvolution.shallow_water import Domain, Reflective_boundary,\ 12 File_boundary, Transmissive_Momentum_Set_Stage_boundary, Transmissive_boundary 12 File_boundary, Transmissive_Momentum_Set_Stage_boundary,\ 13 Transmissive_boundary, Dirichlet_boundary 13 14 from pyvolution.mesh_factory import rectangular_cross 14 15 from pyvolution.pmesh2domain import pmesh_to_domain_instance … … 19 20 from utilities.polygon import read_polygon, Polygon_function 20 21 22 from conversion import convert_latlon_to_xycoords 23 21 24 #------------------------------- 22 25 # Domain 23 26 #------------------------------- 24 27 print 'Creating domain' 28 25 29 """ 26 30 M = 36 #float(len1)/m … … 36 40 37 41 """ 42 38 43 domain = cache(pmesh_to_domain_instance, 39 44 (project.mesh_filename, Domain), … … 53 58 print 'Initial values' 54 59 55 p0 = read_polygon('cairns_fault.xya') 60 latlong_origin = 145, -24 61 r0 = convert_latlon_to_xycoords(-173,-20,latlong_origin) 62 r1 = convert_latlon_to_xycoords(-173,-15,latlong_origin) 63 r2 = convert_latlon_to_xycoords(-171,-15,latlong_origin) 64 r3 = convert_latlon_to_xycoords(-171,-20,latlong_origin) 65 66 #p0 = read_polygon('cairns_fault.xya') 56 67 #p0 = read_polygon('cairns_fault_degrees.xya') 57 58 domain.set_quantity('stage',Polygon_function([(p0,1 000.0)]))68 p0 = [r0, r1, r2, r3] 69 domain.set_quantity('stage',Polygon_function([(p0,1.0)])) 59 70 60 71 #print domain.quantities['stage'].vertex_values … … 77 88 print 'Boundaries' 78 89 79 80 90 #Bts = Transmissive_Momentum_Set_Stage_boundary(domain, tide_function) 81 91 #Bd = Dirichlet_boundary([0,0,0]) 82 92 Br = Reflective_boundary(domain) 83 93 domain.set_boundary({'border': Br, 'border': Br, 'border': Br, 'border': Br}) 84 94 85 95 #Bt = Transmissive_boundary(domain) 86 #domain.set_boundary({'left': B t, 'right': Bt, 'top': Bt, 'bottom': Bt})96 #domain.set_boundary({'left': Br, 'right': Br, 'top': Br, 'bottom': Br}) 87 97 88 98 #------------------------------- … … 90 100 #------------------------------- 91 101 92 domain.visualise = True93 domain.visualise_color_stage = True102 #domain.visualise = True 103 #domain.visualise_color_stage = True 94 104 95 #domain.visualise = False 96 #domain.visualise_color_stage = False 105 #Set domain.visualise = False for large problem sizes 106 domain.visualise = False 107 domain.visualise_color_stage = False 97 108 98 109 base = os.path.basename(sys.argv[0]) … … 107 118 t0 = time.time() 108 119 yieldstep = 60.0 109 finaltime = 480.0120 finaltime = 21600.0 110 121 111 122 for t in domain.evolve(yieldstep = yieldstep, finaltime = finaltime): … … 113 124 114 125 print 'That took %.2f seconds' %(time.time()-t0) 115
Note: See TracChangeset
for help on using the changeset viewer.