Changeset 3799
- Timestamp:
- Oct 16, 2006, 5:47:09 PM (18 years ago)
- Location:
- anuga_validation/automated_validation_tests/okushiri_tank_validation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_validation/automated_validation_tests/okushiri_tank_validation/create_okushiri.py
r3708 r3799 2 2 """ 3 3 4 #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!5 # Assume that the root AnuGA dir is included in your pythonpath6 #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!7 4 8 5 from Numeric import array, zeros, Float, allclose 9 6 10 7 from anuga.pmesh.mesh import * 8 from anuga.pmesh.mesh_interface import create_mesh_from_regions 11 9 from anuga.coordinate_transforms.geo_reference import Geo_reference 12 10 … … 73 71 if __name__ == "__main__": 74 72 75 #Preparing points76 #(Only when using original Benchmark_2_Bathymetry.txt file)77 #from anuga.abstract_2d_finite_volumes.data_manager import xya2pts78 #xya2pts(project.bathymetry_filename, verbose = True,79 # z_func = lambda z: -z)80 81 82 83 84 85 73 # Prepare time boundary 86 74 prepare_timeboundary(project.boundary_filename) 87 75 88 76 89 # Create Mesh 90 91 #Basic geometry 92 77 #-------------------------------------------------------------------------- 78 # Create the triangular mesh based on overall clipping polygon with a 79 # tagged 80 # boundary and interior regions defined in project.py along with 81 # resolutions (maximal area of per triangle) for each polygon 82 #-------------------------------------------------------------------------- 83 84 base_resolution = 1 85 86 # Basic geometry 93 87 xleft = 0 94 88 xright = 5.448 … … 96 90 ytop = 3.402 97 91 98 # Outline92 # Outline 99 93 point_sw = [xleft, ybottom] 100 94 point_se = [xright, ybottom] … … 102 96 point_ne = [xright, ytop] 103 97 104 # Midway points (left)98 # Midway points (left) 105 99 point_mtop = [xleft + (xright-xleft)/3+1, ytop] 106 100 point_mbottom = [xleft + (xright-xleft)/3+1, ybottom] 107 101 108 109 geo = Geo_reference(xllcorner = xleft, 110 yllcorner = ybottom) 111 112 113 print "***********************" 114 print "geo ref", geo 115 print "***********************" 116 117 m = Mesh(geo_reference=geo) 118 119 #Boundary 120 dict = {} 121 dict['points'] = [point_se, #se 122 point_ne, 123 point_mtop, 124 point_nw, 125 point_sw, 126 point_mbottom] 127 128 129 dict['segments'] = [[0,1], [1,2], [2,3], [3,4], 130 [4,5], [5,0], #The outer border 131 [2,5]] #Separator 132 133 dict['segment_tags'] = ['wall', 134 'wall', 135 'wall', 136 'wave', 137 'wall', 138 'wall', 139 ''] #Interior 140 141 142 m.addVertsSegs(dict) 143 144 102 #Localised refined area for gulleys 103 xl = 4.8 104 xr = 5.3 105 yb = 1.6 106 yt = 2.3 107 p0 = [xl, yb] 108 p1 = [xr, yb] 109 p2 = [xr, yt] 110 p3 = [xl, yt] 111 gulleys = [p0, p1, p2, p3] 112 113 #Island area 114 island_0 = [xleft + 2*(xright-xleft)/3+1.2, ytop-0.5] 115 island_1 = [xleft + 2*(xright-xleft)/3+0.5, ybottom + 2*(ytop-ybottom)/3] 116 island_2 = [xleft + (xright-xleft)/2+0.3, ybottom + 2*(ytop-ybottom)/3-0.3] 117 island_3 = [xleft + (xright-xleft)/2+0.3, ybottom + (ytop-ybottom)/3+0.3] 118 island_4 = [xleft + 2*(xright-xleft)/3+0.4, ybottom + (ytop-ybottom)/3-0.3] 119 island_5 = [xleft + 2*(xright-xleft)/3+1.2, ybottom+0.2] 120 island_6 = [xl-.01, yb] #OK 121 island_7 = [xl-.01, yt] #OK 122 123 island = [island_0, island_1, island_2, 124 island_3, island_4, island_5, 125 island_6, island_7] 126 127 128 129 130 bounding_polygon = [point_se, 131 point_ne, 132 point_mtop, 133 point_nw, 134 point_sw, 135 point_mbottom] 136 137 138 interior_regions = [[gulleys, 0.00002*base_resolution], 139 [island, 0.0003*base_resolution]] 140 141 142 143 144 145 print 'start create mesh from regions' 146 147 meshname = project.mesh_filename + '.msh' 148 m = create_mesh_from_regions(bounding_polygon, 149 boundary_tags={'wall': [0, 1, 2, 4, 5], 150 'wave': [3]}, 151 maximum_triangle_area=0.1, 152 interior_regions=interior_regions, 153 use_cache=True, 154 verbose=True) 155 156 m.generateMesh('pzq28.0za1000000a') #??? 157 158 import project 159 m.export_mesh_file(project.mesh_filename) 160 161 import sys; sys.exit() 145 162 146 163 … … 175 192 dict['points'] = [island_0, island_1, island_2, 176 193 island_3, island_4, island_5, 177 #p0, p3]178 194 island_6, island_7] 179 195 … … 190 206 # 191 207 192 base_resolution = 1 208 base_resolution = 10 193 209 194 210 ocean = m.addRegionEN(xleft+.1, ybottom+.1) … … 207 223 208 224 209 # From r 1709 11 August 2005210 #base_resolution = 100211 #212 #ocean = m.addRegionEN(xleft+.1, ybottom+.1)213 #ocean.setMaxArea(0.01*base_resolution)214 #215 #mid = m.addRegionEN(point_mbottom[0]+.1, ybottom+.1)216 #mid.setMaxArea(0.001*base_resolution)217 218 #inner = m.addRegionEN(island_3[0]+.1, island_3[1]+.1)219 #inner.setMaxArea(0.0001*base_resolution)220 221 222 #gulleys = m.addRegionEN(p0[0]+0.1, p0[1]+0.1)223 #gulleys.setMaxArea(0.00001*base_resolution)224 225 226 225 m.generateMesh('pzq28.0za1000000a') 227 226 -
anuga_validation/automated_validation_tests/okushiri_tank_validation/validate_okushiri.py
r3794 r3799 37 37 #------------------------- 38 38 #N = 50 39 N = 50 40 points, vertices, boundary = rectangular_cross(N, N/5*3, 41 len1=5.448, len2=3.402) 42 domain = Domain(points, vertices, boundary) 43 44 domain.set_name('okushiri_automated_validation') 39 #N = 50 40 #points, vertices, boundary = rectangular_cross(N, N/5*3, 41 # len1=5.448, len2=3.402) 42 #domain = Domain(points, vertices, boundary) 43 44 45 print 'Creating domain from', project.mesh_filename 46 47 domain = Domain(project.mesh_filename, use_cache=True, verbose=True) 48 49 50 domain.set_name('okushiri_automated_validation_varmesh') 45 51 domain.set_default_order(2) 46 52 domain.set_minimum_storable_height(0.001) 53 domain.set_maximum_allowed_speed(0) # The default in August 2005 54 47 55 domain.check_integrity() 48 56 … … 67 75 domain, 68 76 verbose=True) 77 69 78 Bts = Transmissive_Momentum_Set_Stage_boundary(domain, function) 70 domain.set_boundary({'left': Bts, 'right': Br, 'bottom': Br, 'top': Br}) 79 80 domain.set_boundary({'wave': Bts, 'wall': Br}) 81 82 71 83 72 84 … … 127 139 t0 = time.time() 128 140 141 w_max = 0 129 142 for j, t in enumerate(domain.evolve(yieldstep = timestep, 130 143 finaltime = finaltime)): … … 139 152 #print 'difference', x, y,\ 140 153 # predicted_gauge_values[i][j] - reference_gauge_values[i][j] 154 155 156 w = domain.get_maximum_inundation_elevation() 157 x, y = domain.get_maximum_inundation_location() 158 print ' Coastline elevation = %.2f at (x,y)=(%.2f, %.2f)' %(w, x, y) 159 print 160 161 if w > w_max: 162 w_max = w 163 x_max = x 164 y_max = y 165 166 167 print '**********************************************' 168 print 'Max coastline elevation = %.2f at (%.2f, %.2f)' %(w_max, x_max, y_max) 169 print '**********************************************' 170 141 171 142 172
Note: See TracChangeset
for help on using the changeset viewer.