Changeset 5065


Ignore:
Timestamp:
Feb 20, 2008, 3:12:21 PM (16 years ago)
Author:
nick
Message:

update run_circular.py with exporting gauges

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_validation/circular_island/run_circular.py

    r5038 r5065  
    1212from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
    1313from anuga.shallow_water import Dirichlet_boundary, Time_boundary
    14 from anuga.shallow_water.data_manager import get_maximum_inundation_data, start_screen_catcher
    15 from anuga.abstract_2d_finite_volumes.util import file_function, sww2csv_gauges
     14from anuga.shallow_water.data_manager import get_maximum_inundation_data, start_screen_catcher, copy_code_files
     15from anuga.abstract_2d_finite_volumes.util import file_function, sww2csv_gauges,csv2timeseries_graphs
    1616from anuga.pmesh.mesh_interface import create_mesh_from_regions
    1717from anuga.utilities.polygon import read_polygon#, plot_polygons
     
    1919from Numeric import array, zeros, Float, allclose,resize
    2020from anuga.shallow_water.data_manager import csv2dict
    21 
     21from time import localtime, strftime, gmtime
     22from anuga.utilities.system_tools import get_user_name, get_host_name
     23from os import sep, environ, getenv
    2224#-------------------------
    2325# Create Domain from mesh
    2426#-------------------------
    2527
    26 #start_screen_catcher()
     28user = get_user_name()
     29home = getenv('INUNDATIONHOME') + sep +'data'+sep #Sandpit's parent dir 
     30time = strftime('%Y%m%d_%H%M%S',localtime())
     31
     32res=0.01
     33
     34dir_comment = time+'_res_'+str(res)+'_'+str(user)
     35
     36anuga_dir = home+'anuga_validation'+sep+'circular_island_tsunami_benchmark'+sep+'anuga'+sep
     37output_dir = anuga_dir+'outputs'+sep+dir_comment+sep
     38copy_code_files(output_dir,__file__)
     39
     40start_screen_catcher(output_dir)
    2741
    2842def get_xy(x=0,y=0,r=1,angle=1):
     
    91105
    92106
    93 
     107# angle to make circular interior polygons
    94108angles1 = (0.0, 22.5, 45.0, 67.5, 90.0, 112.5, 135.0, 157.5, 180.0, 202.5, 225.0,
    95109          247.5, 270.0, 292.5, 315.0, 337.5)
     
    98112center_y = 13.80
    99113
    100 d=0.75
    101 res=0.05
    102 res=1.
     114#d=0.75
    103115#L=3.6 and therefore the gauges 1,2,3 and 4 are located 1.8 from the toe of the island
    104116# 13.8 - 3.6(radii of island) - 1.8 = 8.4
     
    202214model_name='wavetank_model'
    203215domain.set_name(model_name)  # Name of output sww file
     216domain.set_datadir(output_dir)
    204217domain.set_default_order(1)               # Apply second order scheme
    205218#domain.set_all_limiters(0.9)              # Max second order scheme (old lim)
     
    208221domain.tight_slope_limiters = 1
    209222domain.beta_h = 0.0
     223sww_file=output_dir+sep+model_name+'.sww'
    210224
    211225
     
    261275r2 = 2.6
    262276#degrees to check
    263 d=2
     277d=1
    264278
    265279poly_segment = []
     
    276290    #print i,poly[i]
    277291   
    278     run_up, location = get_maximum_inundation_data(filename=model_name+'.sww',polygon=poly_segment, verbose=False)
     292    run_up, location = get_maximum_inundation_data(filename=sww_file,polygon=poly_segment, verbose=False)
    279293   
    280294    print 'maxd %.3f, %.6f, %.6f, %.5s, %.5s '%(((angle/pi)*180)+180, run_up*100, (run_up-water_height)*100, location[0],location[1])
    281295
    282 
    283 
    284 
    285 
    286 
    287 
     296sww_file=anuga_dir+'outputs'+sep+'20080220_010628_res_0.05_nbartzis'+sep+'wavetank_model.sww'
     297sww_file=anuga_dir+'outputs'+sep+'20080219_233611_res_0.05_nbartzis'+sep+'wavetank_model.sww'
     298sww2csv_gauges(sww_file=sww_file,
     299                   gauge_file='gauges.csv',
     300                   quantities = ['stage','depth', 'elevation', 'xmomentum', 'ymomentum'],
     301                   verbose=True,
     302                   use_cache = True)
     303
     304csv2timeseries_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.