Changeset 3854
- Timestamp:
- Oct 25, 2006, 4:54:28 PM (18 years ago)
- Location:
- anuga_validation/okushiri_2005
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_validation/okushiri_2005/create_okushiri.py
r3850 r3854 1 1 """Create mesh and time boundary for the Okushiri island validation 2 2 """ 3 3 4 4 5 from Numeric import array, zeros, Float, allclose 5 6 6 7 from anuga.pmesh.mesh import * 8 from anuga.pmesh.mesh_interface import create_mesh_from_regions 7 9 from anuga.coordinate_transforms.geo_reference import Geo_reference 8 10 … … 84 86 85 87 86 # Create Mesh 88 #-------------------------------------------------------------------------- 89 # Create the triangular mesh based on overall clipping polygon with a 90 # tagged 91 # boundary and interior regions defined in project.py along with 92 # resolutions (maximal area of per triangle) for each polygon 93 #-------------------------------------------------------------------------- 87 94 88 #Basic geometry 89 95 base_resolution = 10 96 97 # Basic geometry 90 98 xleft = 0 91 99 xright = 5.448 … … 93 101 ytop = 3.402 94 102 95 # Outline103 # Outline 96 104 point_sw = [xleft, ybottom] 97 105 point_se = [xright, ybottom] … … 99 107 point_ne = [xright, ytop] 100 108 101 # Midway points (left)109 # Midway points (left) 102 110 point_mtop = [xleft + (xright-xleft)/3+1, ytop] 103 111 point_mbottom = [xleft + (xright-xleft)/3+1, ybottom] 104 112 105 106 geo = Geo_reference(xllcorner = xleft,107 yllcorner = ybottom)108 109 110 print "***********************"111 print "geo ref", geo112 print "***********************"113 114 m = Mesh(geo_reference=geo)115 116 #Boundary117 dict = {}118 dict['points'] = [point_se, #se119 point_ne,120 point_mtop,121 point_nw,122 point_sw,123 point_mbottom]124 125 126 dict['segments'] = [[0,1], [1,2], [2,3], [3,4],127 [4,5], [5,0], #The outer border128 [2,5]] #Separator129 130 dict['segment_tags'] = ['wall',131 'wall',132 'wall',133 'wave',134 'wall',135 'wall',136 ''] #Interior137 138 139 m.addVertsSegs(dict)140 141 142 143 144 145 113 #Localised refined area for gulleys 146 dict = {}147 114 xl = 4.8 148 115 xr = 5.3 … … 153 120 p2 = [xr, yt] 154 121 p3 = [xl, yt] 155 156 dict['points'] = [p0, p1, p2, p3] 157 dict['segments'] = [[0,1], [1,2], [2,3], [3,0]] 158 dict['segment_tags'] = ['', '', '', ''] 159 m.addVertsSegs(dict) 122 gulleys = [p0, p1, p2, p3] 160 123 161 124 #Island area … … 164 127 island_2 = [xleft + (xright-xleft)/2+0.3, ybottom + 2*(ytop-ybottom)/3-0.3] 165 128 island_3 = [xleft + (xright-xleft)/2+0.3, ybottom + (ytop-ybottom)/3+0.3] 166 island_4 = [xleft + 2*(xright-xleft)/3+0.4, ybottom + (ytop-ybottom)/3-0.3] 129 island_4 = [xleft + 2*(xright-xleft)/3+0.4, ybottom + (ytop-ybottom)/3-0.3] 167 130 island_5 = [xleft + 2*(xright-xleft)/3+1.2, ybottom+0.2] 168 131 island_6 = [xl-.01, yb] #OK 169 132 island_7 = [xl-.01, yt] #OK 133 134 island = [island_0, island_1, island_2, 135 island_3, island_4, island_5, 136 island_6, island_7] 137 138 170 139 171 140 172 dict['points'] = [island_0, island_1, island_2, 173 island_3, island_4, island_5, 174 #p0, p3] 175 island_6, island_7] 141 bounding_polygon = [point_se, 142 point_ne, 143 point_mtop, 144 point_nw, 145 point_sw, 146 point_mbottom] 147 176 148 177 178 dict['segments'] = [[0,1], [1,2], [2,3], [3,4], 179 [4,5], [5,6], [6,7], [7,0]] 180 181 dict['segment_tags'] = ['', '', '', '', '', '', '', ''] 149 interior_regions = [[gulleys, 0.00002*base_resolution], 150 [island, 0.00007*base_resolution]] 151 182 152 183 153 184 m.addVertsSegs(dict)154 185 155 186 187 # 188 189 base_resolution = 1 156 print 'start create mesh from regions' 190 157 191 ocean = m.addRegionEN(xleft+.1, ybottom+.1) 192 ocean.setMaxArea(0.1*base_resolution) 158 meshname = project.mesh_filename + '.msh' 159 m = create_mesh_from_regions(bounding_polygon, 160 boundary_tags={'wall': [0, 1, 2, 4, 5], 161 'wave': [3]}, 162 maximum_triangle_area=0.1*base_resolution, 163 interior_regions=interior_regions, 164 filename=project.mesh_filename, 165 use_cache=True, 166 verbose=True) 193 167 194 mid = m.addRegionEN(point_mbottom[0]+.1, ybottom+.1)195 mid.setMaxArea(0.0005*base_resolution)196 197 198 inner = m.addRegionEN(island_3[0]+.1, island_3[1]+.1)199 inner.setMaxArea(0.00007*base_resolution)200 201 202 gulleys = m.addRegionEN(p0[0]+0.1, p0[1]+0.1)203 gulleys.setMaxArea(0.00002*base_resolution)204 205 206 # From r 1709 11 August 2005207 #base_resolution = 100208 #209 #ocean = m.addRegionEN(xleft+.1, ybottom+.1)210 #ocean.setMaxArea(0.01*base_resolution)211 #212 #mid = m.addRegionEN(point_mbottom[0]+.1, ybottom+.1)213 #mid.setMaxArea(0.001*base_resolution)214 215 #inner = m.addRegionEN(island_3[0]+.1, island_3[1]+.1)216 #inner.setMaxArea(0.0001*base_resolution)217 218 219 #gulleys = m.addRegionEN(p0[0]+0.1, p0[1]+0.1)220 #gulleys.setMaxArea(0.00001*base_resolution)221 222 223 m.generateMesh('pzq28.0za1000000a')224 225 import project226 m.export_mesh_file(project.mesh_filename)227 -
anuga_validation/okushiri_2005/extract_timeseries.py
r3850 r3854 21 21 plotting = True 22 22 23 plotting = False 23 24 24 25 #------------------------- … … 42 43 'ch7': 1.121816242516758e-04, 43 44 'ch9': 1.249543278366778e-04} 45 46 # old limiters 47 expected_covariances = {'Boundary': 5.288601162783020386e-05, 48 'ch5': 1.167001054284431472e-04, 49 'ch7': 1.121474766904651861e-04, 50 'ch9': 1.249244820847215335e-04} 44 51 45 52 … … 81 88 # Read and interpolate model output 82 89 #-------------------------------------------------- 83 #f = file_function('okushiri_new_limiters.sww', 90 #f = file_function('okushiri_new_limiters.sww', #The best so far 84 91 #f = file_function('okushiri_as2005_with_mxspd=0.1.sww', 85 92 f = file_function(project.output_filename, … … 111 118 print 'Result is better than expected by: %.18e'\ 112 119 %(res-expected_covariances[name]) 113 print 'Result = %.18e' %res114 120 print 'Expect = %.18e' %expected_covariances[name] 115 121 elif res > expected_covariances[name]+eps: 116 print 'FAIL: %.18e' %res 122 print 'FAIL: Result is worse than expected by: %.18e'\ 123 %(res-expected_covariances[name]) 124 print 'Expect = %.18e' %expected_covariances[name] 117 125 else: 118 126 pass -
anuga_validation/okushiri_2005/project.py
r3850 r3854 15 15 16 16 # Model output 17 output_filename = 'okushiri_old_limiters.sww' 17 #output_filename = 'okushiri_old_limiters.sww' 18 output_filename = 'okushiri_nl_new_mesh.sww' 18 19 19 20 -
anuga_validation/okushiri_2005/run_okushiri.py
r3850 r3854 53 53 domain.set_name(project.output_filename) # Name of output sww file 54 54 domain.set_default_order(2) # Apply second order scheme 55 domain.set_all_limiters(0.9) # Maximal second order scheme (old lim)55 #domain.set_all_limiters(0.9) # Maximal second order scheme (old lim) 56 56 domain.set_minimum_storable_height(0.001) # Don't store w < 0.001m 57 57 domain.set_maximum_allowed_speed(0.1) # Allow a little runoff (0.1 is OK)
Note: See TracChangeset
for help on using the changeset viewer.