Changeset 5031
 Timestamp:
 Feb 14, 2008, 1:50:57 PM (15 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

anuga_validation/conical_island/run_circular.py
r4987 r5031 10 10 from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary 11 11 from anuga.shallow_water import Dirichlet_boundary, Time_boundary 12 from anuga.shallow_water.data_manager import get_maximum_inundation_data 12 from anuga.shallow_water.data_manager import get_maximum_inundation_data, start_screen_catcher 13 13 from anuga.abstract_2d_finite_volumes.util import file_function, sww2csv_gauges 14 14 from anuga.pmesh.mesh_interface import create_mesh_from_regions … … 23 23 # 24 24 25 #start_screen_catcher() 26 25 27 def get_xy(x=0,y=0,r=1,angle=1): 28 #return x and y coordinates 26 29 x1 = x + cos(angle)*r 27 30 y1 = y + sin(angle)*r … … 91 94 247.5, 270.0, 292.5, 315.0, 337.5) 92 95 93 x = 12.96 94 y = 13.80 96 #x = 12.96 97 #y = 13.80 98 center_x = 12.96 99 center_y = 13.80 100 101 #wavelenght = 102 95 103 r1 = 1.5 96 104 r2 = 2.5 … … 98 106 res=.05 99 107 #res=1. 108 L=4.11 109 100 110 101 111 #create polygons (circles) to have higher resolution … … 107 117 angle = ((angle180)/180.0)*pi 108 118 109 p = get_xy( x,y,3.6,angle)119 p = get_xy(center_x,center_y,3.6,angle) 110 120 poly1.append([p[0],p[1]]) 111 121 … … 117 127 #convert Degs to Rads 118 128 angle = ((angle180)/180.0)*pi 119 p = get_xy( x,y,2.4,angle)129 p = get_xy(center_x,center_y,2.4,angle) 120 130 poly2.append([p[0],p[1]]) 121 131 … … 127 137 #convert Degs to Rads 128 138 angle = ((angle180)/180.0)*pi 129 p = get_xy( x,y,1.6,angle)139 p = get_xy(center_x,center_y,1.6,angle) 130 140 poly3.append([p[0],p[1]]) 131 141 … … 137 147 #convert Degs to Rads 138 148 angle = ((angle180)/180.0)*pi 139 p = get_xy( x,y,1.1,angle)149 p = get_xy(center_x,center_y,1.1,angle) 140 150 poly4.append([p[0],p[1]]) 141 151 … … 145 155 #plot_polygons(poly,'poly.png') 146 156 147 poly_all= [[0,7],[0,25],[30,25],[30,7]] 157 #poly_all= [[0,7],[0,25],[30,25],[30,7]] 158 poly_all= [[0,L],[0,25],[30,25],[30,L]] 148 159 create_mesh_from_regions(poly_all, 149 160 boundary_tags={'wall': [0,2],'wave': [3], 'buffer':[1]}, … … 164 175 domain.set_quantity('stage', water_height) 165 176 166 #attribute_dic, title_index_dic = csv2dict('sqrt_table.csv') 167 attribute_dic, title_index_dic = csv2dict('sqrt_table_new.csv') 177 178 attribute_dic, title_index_dic = csv2dict('sqrt_table.csv') 179 #print attribute_dic 168 180 print attribute_dic['number'][10] 169 181 170 182 def test(x,y): 171 center_x = 12.96183 # center_x = 12.96 172 184 # center_y = 13.80 173 center_y = 6.80174 175 du = (center_xx)**2+(center_y y)**2185 # center_y = 6.80 186 187 du = (center_xx)**2+(center_yLy)**2 176 188 # print 'x',min(x),max(x) 177 189 # print 'y',min(y),max(y) … … 182 194 zz=float(attribute_dic['sqrt'][nn]) 183 195 # print nn,zz 184 # this is the elevation for a cone with 1/4 slope and is ?? below the water . 196 197 # z = square_root((center_xx)**2+(center_yy)**2) 185 198 z = zz*.25+0.8975 186 199 … … 189 202 if z > .625: 190 203 z=0.625 191 print 'hello',d,nn,zz,z 192 # print 'hello',d,n1,n2,n3,nn,zz,z 204 # print 'hello',z 193 205 z1.append(z) 194 206 return z1 195 207 196 domain.set_quantity('elevation',test, alpha=1.,verbose=True)208 domain.set_quantity('elevation',test, verbose=True) 197 209 198 210 … … 200 212 # Set simulation parameters 201 213 # 202 domain.set_name('test1') # Name of output sww file 214 model_name='wavetank_model' 215 domain.set_name(model_name) # Name of output sww file 203 216 domain.set_default_order(1) # Apply second order scheme 204 217 #domain.set_all_limiters(0.9) # Max second order scheme (old lim) … … 208 221 domain.beta_h = 0.0 209 222 210 #Timings on AMD64242 (beta_h=0)211 # tight_slope_limiters = 0:212 # 3035s  3110s213 # tight_slope_limiters = 1:214 # 3000s  3008s215 #216 # beta_h>0: In the order of 3200s217 223 218 224 # … … 223 229 #function = file_function(project.boundary_filename, 224 230 # domain, verbose=True) 225 def waveform(t):226 return (sin(t*2*pi))227 231 228 232 # Create and assign boundary objects … … 236 240 Bts = Transmissive_Momentum_Set_Stage_boundary(domain, function) 237 241 238 #Bts = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)239 242 Bw = Time_boundary(domain=domain, 240 243 f=lambda t: [(0.1*sin(t*2*pi)), 0.0, 0.0]) … … 281 284 angle = ((angle180)/180.0)*pi 282 285 # angle = angle1*3.14157 283 p1 = get_xy( x,y,r1,angle0.01745*d)284 p2 = get_xy( x,y,r2,angle0.01745*d)285 p3 = get_xy( x,y,r2,angle+0.01745*d)286 p4 = get_xy( x,y,r1,angle+0.01745*d)286 p1 = get_xy(center_x,center_y,r1,angle0.01745*d) 287 p2 = get_xy(center_x,center_y,r2,angle0.01745*d) 288 p3 = get_xy(center_x,center_y,r2,angle+0.01745*d) 289 p4 = get_xy(center_x,center_y,r1,angle+0.01745*d) 287 290 # print p1,p2,p3,p4,angle 288 291 poly_segment =[[p1[0],p1[1]],[p2[0],p2[1]],[p3[0],p3[1]],[p4[0],p4[1]]] … … 290 293 #print i,poly[i] 291 294 292 run_up, x_y = get_maximum_inundation_data(filename= 'test.sww',polygon=poly_segment, verbose=False)293 294 print 'max imum_inundation_data',((angle/pi)*180)+180, run_up, x_y295 296 297 298 299 300 301 295 run_up, x_y = get_maximum_inundation_data(filename=model_name+'.sww',polygon=poly_segment, verbose=False) 296 297 print 'maxd %.3f, %.6f, %.6f, %.5s, %.5s '%(((angle/pi)*180)+180, run_up*100, run_upwater_height*100, x_y[0],x_y[1]) 298 299 300 301 302 303 304
Note: See TracChangeset
for help on using the changeset viewer.