Changeset 5123
- Timestamp:
- Mar 5, 2008, 9:50:16 AM (16 years ago)
- Location:
- anuga_validation/circular_island
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_validation/circular_island/run_circular.py
r5065 r5123 16 16 from anuga.pmesh.mesh_interface import create_mesh_from_regions 17 17 from anuga.utilities.polygon import read_polygon#, plot_polygons 18 from math import cos,pi,sin,tan ,sqrt19 from Numeric import array, zeros, Float, allclose,resize 18 from math import cos,pi,sin,tan#,sqrt 19 from Numeric import array, zeros, Float, allclose,resize,sqrt 20 20 from anuga.shallow_water.data_manager import csv2dict 21 21 from time import localtime, strftime, gmtime … … 30 30 time = strftime('%Y%m%d_%H%M%S',localtime()) 31 31 32 res=0.0 132 res=0.0025 33 33 34 34 dir_comment = time+'_res_'+str(res)+'_'+str(user) … … 36 36 anuga_dir = home+'anuga_validation'+sep+'circular_island_tsunami_benchmark'+sep+'anuga'+sep 37 37 output_dir = anuga_dir+'outputs'+sep+dir_comment+sep 38 #output_dir = anuga_dir+'outputs'+sep+'20080222_062917_res_0.0025_nbartzis'+sep 38 39 copy_code_files(output_dir,__file__) 39 40 … … 169 170 # Initial Conditions 170 171 #------------------------- 171 domain.set_quantity('friction', 0.0) 172 water_height = 0.322 172 #domain.set_quantity('friction', 0.0) 173 domain.set_quantity('friction', 0.01)#for concrete 174 #water_height = 0.322 175 water_height = 0.0 176 173 177 domain.set_quantity('stage', water_height) 174 178 175 179 176 attribute_dic, title_index_dic = csv2dict('sqrt_table.csv')180 #attribute_dic, title_index_dic = csv2dict('sqrt_table.csv') 177 181 #print attribute_dic 178 182 #print attribute_dic['number'][10] 179 183 180 184 def circular_island_elevation(x,y): 181 182 list_xy_square = (center_x-x)**2+(center_y-L-y)**2 185 water_depth = 0.32 186 # list_xy_square = (center_x-x)**2+(center_y-L-y)**2 187 list_xy = sqrt((center_x-x)**2+(center_y-L-y)**2) 183 188 print 'x',min(x),max(x) 184 189 print 'y',min(y),max(y) 185 190 list_z=[] 186 for xy in list_xy_square: 187 # this finds the int that relates to the correct sqrt in the table 188 nn=int(round(xy,2)*100) 189 #the square root is to find the distance from the center to the current xy 190 distance = float(attribute_dic['sqrt'][nn]) 191 # zz=-float(attribute_dic['sqrt'][nn]) 192 # print nn,zz 193 194 # slope of cone is 1/4 and has a radii of 3.6 therefore the cone is 0.9 high. 195 # So to have the elevation positive 0.90 has been added 196 # z = zz*.25+0.90 197 z = -distance*.25+0.90 191 # for xy in list_xy_square: 192 for distance in list_xy: 193 194 # z = -distance*.25+0.9 195 # z = -distance*.25+0.578 196 z = -distance*.25+0.9-water_depth 198 197 # z = zz*.25+0.8975 199 198 200 if z <0 :201 z=0 202 if z > .625 :203 z=0.625 199 if z <0-water_depth: 200 z=0-water_depth 201 if z > .625-water_depth: 202 z=0.625-water_depth 204 203 # print 'hello',z 205 204 list_z.append(z) … … 209 208 210 209 211 # -------------------------212 # Set simulation parameters213 # -------------------------210 ##------------------------- 211 ## Set simulation parameters 212 ##------------------------- 214 213 model_name='wavetank_model' 215 214 domain.set_name(model_name) # Name of output sww file 216 215 domain.set_datadir(output_dir) 217 domain.set_default_order( 1) # Apply second order scheme216 domain.set_default_order(2) # Apply second order scheme 218 217 #domain.set_all_limiters(0.9) # Max second order scheme (old lim) 219 218 domain.set_minimum_storable_height(0.001) # Don't store w < 0.001m 220 domain.set_maximum_allowed_speed(0.1) # Allow a little runoff (0.1 is OK)219 #domain.set_maximum_allowed_speed(0.1) # Allow a little runoff (0.1 is OK) 221 220 domain.tight_slope_limiters = 1 222 221 domain.beta_h = 0.0 222 223 223 sww_file=output_dir+sep+model_name+'.sww' 224 224 … … 230 230 # Create boundary function from timeseries provided in file 231 231 232 boundary_filename="ts2cnew1_input "232 boundary_filename="ts2cnew1_input_20_80sec_new" 233 233 prepare_timeboundary(boundary_filename+'.txt') 234 234 … … 239 239 Bts = Transmissive_Momentum_Set_Stage_boundary(domain, function) 240 240 241 Bw = Time_boundary(domain=domain,242 f=lambda t: [(0.1*sin(t*2*pi)), 0.0, 0.0])243 241 Br = Reflective_boundary(domain) 244 242 Bd = Dirichlet_boundary([water_height,0,0]) 245 domain.set_boundary({'wave': Bts, 'wall': Br, 'buffer':Bd}) 243 #domain.set_boundary({'wave': Bts, 'wall': Br, 'buffer':Bd}) 244 domain.set_boundary({'wave': Bts, 'wall': Bd, 'buffer':Bd}) 246 245 #domain.set_time(20.0) 247 246 #------------------------- … … 251 250 t0 = time.time() 252 251 253 for t in domain.evolve(yieldstep = 1, finaltime = 30):252 for t in domain.evolve(yieldstep = 1, finaltime = 28): 254 253 domain.write_time() 255 254 # domain.write_time(track_speeds=False) … … 294 293 print 'maxd %.3f, %.6f, %.6f, %.5s, %.5s '%(((angle/pi)*180)+180, run_up*100, (run_up-water_height)*100, location[0],location[1]) 295 294 296 sww_file=anuga_dir+'outputs'+sep+'20080220_010628_res_0.05_nbartzis'+sep+'wavetank_model.sww'297 sww_file=anuga_dir+'outputs'+sep+'20080219_233611_res_0.05_nbartzis'+sep+'wavetank_model.sww'295 #sww_file=anuga_dir+'outputs'+sep+'20080220_010628_res_0.05_nbartzis'+sep+'wavetank_model.sww' 296 #sww_file=anuga_dir+'outputs'+sep+'20080219_233611_res_0.05_nbartzis'+sep+'wavetank_model.sww' 298 297 sww2csv_gauges(sww_file=sww_file, 298 gauge_file=anuga_dir+'gauges'+sep+'gauges.csv', 299 299 gauge_file='gauges.csv', 300 300 quantities = ['stage','depth', 'elevation', 'xmomentum', 'ymomentum'], … … 302 302 use_cache = True) 303 303 304 csv2timeseries_graphs(directories_dic={anuga_dir+sep+'boundaries'+sep:['wavetank',0, 0],305 anuga_dir+'outputs'+sep+'20080219_233611_res_0.05_nbartzis'+sep:['Fixed Wave',0,0]},306 output_dir=anuga_dir+'outputs'+sep+'20080219_233611_res_0.05_nbartzis'+sep,307 base_name='gauge_',308 plot_numbers='',309 quantities=['stage'],310 extra_plot_name='',311 assess_all_csv_files=True,312 create_latex=False,313 verbose=True)314 315 316 317 318 304 #csv2timeseries_graphs(directories_dic={anuga_dir+sep+'boundaries'+sep:['wavetank',0, 0], 305 # anuga_dir+'outputs'+sep+'20080219_233611_res_0.05_nbartzis'+sep:['Fixed Wave',0,0]}, 306 # output_dir=anuga_dir+'outputs'+sep+'20080219_233611_res_0.05_nbartzis'+sep, 307 # base_name='gauge_', 308 # plot_numbers='', 309 # quantities=['stage'], 310 # extra_plot_name='', 311 # assess_all_csv_files=True, 312 # create_latex=False, 313 # verbose=True) 314 315 316 317 318
Note: See TracChangeset
for help on using the changeset viewer.