Changeset 5123


Ignore:
Timestamp:
Mar 5, 2008, 9:50:16 AM (16 years ago)
Author:
nick
Message:

updates to circular island model. Now uses Numeric sqrt instead of a sqrt table.

Location:
anuga_validation/circular_island
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_validation/circular_island/run_circular.py

    r5065 r5123  
    1616from anuga.pmesh.mesh_interface import create_mesh_from_regions
    1717from anuga.utilities.polygon import read_polygon#, plot_polygons
    18 from math import cos,pi,sin,tan,sqrt
    19 from Numeric import array, zeros, Float, allclose,resize
     18from math import cos,pi,sin,tan#,sqrt
     19from Numeric import array, zeros, Float, allclose,resize,sqrt
    2020from anuga.shallow_water.data_manager import csv2dict
    2121from time import localtime, strftime, gmtime
     
    3030time = strftime('%Y%m%d_%H%M%S',localtime())
    3131
    32 res=0.01
     32res=0.0025
    3333
    3434dir_comment = time+'_res_'+str(res)+'_'+str(user)
     
    3636anuga_dir = home+'anuga_validation'+sep+'circular_island_tsunami_benchmark'+sep+'anuga'+sep
    3737output_dir = anuga_dir+'outputs'+sep+dir_comment+sep
     38#output_dir = anuga_dir+'outputs'+sep+'20080222_062917_res_0.0025_nbartzis'+sep
    3839copy_code_files(output_dir,__file__)
    3940
     
    169170# Initial Conditions
    170171#-------------------------
    171 domain.set_quantity('friction', 0.0)
    172 water_height = 0.322
     172#domain.set_quantity('friction', 0.0)
     173domain.set_quantity('friction', 0.01)#for concrete
     174#water_height = 0.322
     175water_height = 0.0
     176
    173177domain.set_quantity('stage', water_height)
    174178
    175179
    176 attribute_dic, title_index_dic = csv2dict('sqrt_table.csv')
     180#attribute_dic, title_index_dic = csv2dict('sqrt_table.csv')
    177181#print attribute_dic
    178182#print attribute_dic['number'][10]
    179183
    180184def 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)
    183188    print 'x',min(x),max(x)
    184189    print 'y',min(y),max(y)
    185190    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
    198197#        z = zz*.25+0.8975
    199198
    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
    204203#        print 'hello',z
    205204        list_z.append(z)
     
    209208
    210209
    211 #-------------------------
    212 # Set simulation parameters
    213 #-------------------------
     210##-------------------------
     211## Set simulation parameters
     212##-------------------------
    214213model_name='wavetank_model'
    215214domain.set_name(model_name)  # Name of output sww file
    216215domain.set_datadir(output_dir)
    217 domain.set_default_order(1)               # Apply second order scheme
     216domain.set_default_order(2)               # Apply second order scheme
    218217#domain.set_all_limiters(0.9)              # Max second order scheme (old lim)
    219218domain.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)
    221220domain.tight_slope_limiters = 1
    222221domain.beta_h = 0.0
     222
    223223sww_file=output_dir+sep+model_name+'.sww'
    224224
     
    230230# Create boundary function from timeseries provided in file
    231231
    232 boundary_filename="ts2cnew1_input"
     232boundary_filename="ts2cnew1_input_20_80sec_new"
    233233prepare_timeboundary(boundary_filename+'.txt')
    234234
     
    239239Bts = Transmissive_Momentum_Set_Stage_boundary(domain, function)
    240240
    241 Bw = Time_boundary(domain=domain,
    242                    f=lambda t: [(0.1*sin(t*2*pi)), 0.0, 0.0])
    243241Br = Reflective_boundary(domain)
    244242Bd = 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})
     244domain.set_boundary({'wave': Bts, 'wall': Bd, 'buffer':Bd})
    246245#domain.set_time(20.0)
    247246#-------------------------
     
    251250t0 = time.time()
    252251
    253 for t in domain.evolve(yieldstep = 1, finaltime = 30):
     252for t in domain.evolve(yieldstep = 1, finaltime = 28):
    254253    domain.write_time()
    255254#    domain.write_time(track_speeds=False)
     
    294293    print 'maxd %.3f, %.6f, %.6f, %.5s, %.5s '%(((angle/pi)*180)+180, run_up*100, (run_up-water_height)*100, location[0],location[1])
    295294
    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'
    298297sww2csv_gauges(sww_file=sww_file,
     298                   gauge_file=anuga_dir+'gauges'+sep+'gauges.csv',
    299299                   gauge_file='gauges.csv',
    300300                   quantities = ['stage','depth', 'elevation', 'xmomentum', 'ymomentum'],
     
    302302                   use_cache = True)
    303303
    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.