Changeset 4525 for anuga_work


Ignore:
Timestamp:
Jun 1, 2007, 4:06:46 PM (17 years ago)
Author:
nick
Message:

update run

Location:
anuga_work/production
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/production/exmouth_2006/build_exmouth.py

    r4509 r4525  
    8181dem2pts(onshore_dir_name, use_cache=True, verbose=True)
    8282dem2pts(onshore1_dir_name, use_cache=True, verbose=True)
    83 '''
     83
    8484print'create Geospatial data1 objects from topographies',onshore_dir_name + '.pts'
    8585G1 = Geospatial_data(file_name = onshore_dir_name + '.pts',verbose=True)
     
    112112G_small.export_points_file(project.combined_small_dir_name + '.txt')
    113113#G_clipped.export_points_file(project.combined_dir_name + '.xya')
    114 '''
     114
    115115
    116116
     
    123123print'export 2'
    124124G_all_2.export_points_file(project.combined_dir_name+'_other1' + '.xya')
    125 
     125'''
    126126
    127127#-------------------------------------------------------------------------
     
    136136print 'project.boundaries_dir_name',project.boundaries_dir_name
    137137
    138 urs_ungridded2sww(boundaries_in_dir_name, project.boundaries_in_dir_name,
     138urs_ungridded2sww(boundaries_in_dir_name, boundaries_in_dir_name,
    139139                  verbose=True, mint=4000, maxt=35000, zscale=1)
    140 
    141 '''
    142140
    143141
    144142
    145143
     144
     145
  • anuga_work/production/exmouth_2006/project.py

    r4509 r4525  
    3030
    3131#tide = -1.4
    32 #tide = 0
    33 tide = 1.4
     32tide = 0
     33#tide = 1.4
    3434
    3535#Maybe will try to make project a class to allow these parameters to be passed in.
     
    3838starttime=3600
    3939finaltime=25000
    40 setup='store'
     40setup='final'
     41extra='exmouth'
    4142
    4243if setup =='trial':
     
    6263
    6364
    64 dir_comment='_'+setup+'_'+str(tide)+'_'+str(user)
     65dir_comment='_'+setup+'_'+str(tide)+'_'+str(extra)+'_'+str(user)
    6566
    6667onshore_name = 'DLI'
     
    111112
    112113#boundaries locations
    113 boundaries_name = 'exmouth_3854_17042007'
    114 
    115 boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'dampier'+sep+'1_10000'+sep
     114#boundaries_name = 'exmouth_3854_17042007' #dampier
     115#boundaries_name = 'exmouth_3103_18052007' #exmouth
     116boundaries_name = 'exmouth_3859_16052007' #onslow
     117
     118#boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'dampier'+sep+'1_10000'+sep
     119#boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'exmouth'+sep+'1_10000'+sep
     120boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'onslow_hedland_broome'+sep+'1_10000'+sep
    116121boundaries_in_dir_name = boundaries_in_dir + boundaries_name
    117122boundaries_dir = anuga_dir+'boundaries'+sep
     
    121126output_dir = anuga_dir+'outputs'+sep
    122127output_build_time_dir = output_dir+build_time+sep
    123 output_run_time_dir = output_dir +run_time+dir_comment+sep
     128#output_run_time_dir = output_dir +run_time+dir_comment+sep
     129output_run_time_dir = output_dir +'20070528_061822_run_final_1.4_nbartzis'+sep
    124130output_run_time_dir_name = output_run_time_dir + scenario_name  #Used by post processing
    125131
     
    132138community_exmouth = gauges_dir + 'community_exmouth.csv'
    133139
    134 buildings_filename = 'Exmouth_res_Project.csv'
    135 buildings_filename_out = 'Exmouth_res_Project_modified.csv'
     140buildings_filename = gauges_dir +'Exmouth_res_Project.csv'
     141buildings_filename_out = output_run_time_dir +'Exmouth_res_Project_modified.csv'
    136142
    137143###############################
  • anuga_work/production/exmouth_2006/run_exmouth.py

    r4509 r4525  
    3737from anuga_parallel.parallel_abstraction import get_processor_name
    3838from anuga.caching import myhash
     39from anuga.damage_modelling.inundation_damage import add_depth_and_momentum2csv, inundation_damage
     40
    3941# Application specific imports
    4042import project                 # Definition of file names and polygons
     
    4244def run_model(**kwargs):
    4345   
    44 #    tide = kwargs['tide']
    45 #    alpha = kwargs['alpha']
    46 #    friction = kwargs['friction']
    47 #    time_thinning = kwargs['time_thinning']
    4846    scenario_name = kwargs['aa_scenario_name']
    4947   
     
    6765#    kwargs['bathy_file']=project.combined_small_dir_name + '.txt'
    6866    kwargs['boundary_file']=project.boundaries_in_dir_name + '.sww'
    69 
     67   
     68   
     69    '''
    7070    print 'output_dir',kwargs['output_dir']
    7171    if myid == 0:
     
    166166    domain.set_store_vertices_uniquely(False)
    167167    domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
    168     domain.set_maximum_allowed_speed(0.1) # Allow a little runoff (0.1 is OK)
    169     print 'domain id', id(domain)
    170     domain.beta_h = 0
    171     #domain.limit2007 = 1
     168    #domain.set_maximum_allowed_speed(0.1) # Allow a little runoff (0.1 is OK)
     169    #print 'domain id', id(domain)
     170    domain.beta_h = 0 #sets the surface of the triangle to follow the bathy
     171    #domain.H0=0.01 #controls the flux limiter (limiter2007)
     172    #domain.limit2007 = 1 #minimises creep
    172173
    173174    #-------------------------------------------------------------------------
     
    229230    barrier()
    230231
    231     export_grid(kwargs['aa_scenario_name'], extra_name_out = 'town',
    232                 quantities = ['elevation','stage'], # '(xmomentum**2 + ymomentum**2)**0.5' defaults to elevation
     232
     233    '''
     234    print'hello'
     235    swwfile = kwargs['output_dir']+kwargs['aa_scenario_name']
     236    export_grid(swwfile, extra_name_out = 'town',
     237                quantities = ['elevation','stage','speed'], # '(xmomentum**2 + ymomentum**2)**0.5' defaults to elevation
    233238                timestep = None,
    234239                reduction = max,
     
    244249                format = 'asc')
    245250   
    246     swwfile = kwargs['output_dir']+kwargs['aa_scenario_name']+'.sww'
    247251    buildings_filename = project.buildings_filename
    248252    buildings_filename_out = project.buildings_filename_out
    249253               
    250     inundation_damage(swwfile, buildings_filename, buildings_filename_out)
    251     print '\n Augmented building file written to %s \n' \
    252            %buildings_filename_out
     254    inundation_damage(swwfile+'.sww', buildings_filename, buildings_filename_out)
     255    print '\n Augmented building file written to %s \n' %buildings_filename_out
    253256
    254257
  • anuga_work/production/onslow_2006/build_onslow.py

    r4432 r4525  
    151151
    152152print 'boundaries_in_dir_name',project_urs.boundaries_in_dir_name
    153 print 'project.boundaries_dir_name',project_urs.boundaries_dir_name
     153#print 'project.boundaries_dir_name',project_urs.boundaries_dir_name
    154154
    155 urs_ungridded2sww(project_urs.boundaries_in_dir_name, project_urs.boundaries_dir_name,
     155urs_ungridded2sww(project_urs.boundaries_in_dir_name, project_urs.boundaries_in_dir_name,
    156156                  verbose=True, mint=5000, maxt=34000, zscale=1)
    157157
  • anuga_work/production/onslow_2006/project_urs.py

    r4477 r4525  
    1818host = get_host_name()
    1919#needed when running using mpirun, mpirun doesn't inherit umask from .bashrc
    20 umask(002)
     20#umask(002)
    2121
    2222
     
    3030
    3131#tide = -1.5
    32 #tide = 0.0
    33 tide = 1.5
     32tide = 0.0
     33#tide = 1.5
    3434
    3535#Maybe will try to make project a class to allow these parameters to be passed in.
    36 res_factor=1
    3736alpha = 0.1
    3837friction=0.01
    39 time_thinning=4
    40 dir_comment='_final_'+str(tide)+'_'+str(user)
    4138starttime=3600
    42 yieldstep=60
    4339finaltime=25000
    44  
     40setup='final'
     41extra='onslow'
     42
     43if setup =='trial':
     44    print'trial'
     45    res_factor=10
     46    time_thinning=48
     47    yieldstep=240
     48if setup =='basic':
     49    print'basic'
     50    res_factor=4
     51    time_thinning=12
     52    yieldstep=120
     53if setup =='final':
     54    print'final'
     55    res_factor=1
     56    time_thinning=1
     57    yieldstep=60
     58if setup =='store':
     59    print'store'
     60    res_factor=10
     61    time_thinning=48
     62    yieldstep=240   
     63
     64dir_comment='_'+setup+'_'+str(tide)+'_'+str(extra)+'_'+str(user)
     65
    4566#Making assumptions about the location of scenario data
    4667state = 'western_australia'
     
    99120
    100121boundaries_source = ''
    101 boundaries_name = 'onslow_3854_17042007'
     122#boundaries_name = 'onslow_3854_17042007' #Dampier gun
     123boundaries_name = 'onslow_3859_16052007' #onslow_hedland_broome gun
     124#boundaries_name = 'onslow_3103_18052007' #exmouth gun
    102125
    103126#boundaries locations
    104127#boundaries_in_dir = anuga_dir+'boundaries'+sep
    105 boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'1_10000'+sep
     128#boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'1_10000'+sep
     129boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'onslow_hedland_broome'+sep+'1_10000'+sep
     130#boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'exmouth'+sep+'1_10000'+sep
    106131boundaries_in_dir_name = boundaries_in_dir + boundaries_name
     132
    107133boundaries_dir = anuga_dir+'boundaries'+sep
    108134boundaries_dir_name = boundaries_dir + boundaries_name
     
    111137output_dir = anuga_dir+'outputs'+sep
    112138output_build_time_dir = output_dir+build_time+sep
    113 output_run_time_dir = output_dir +run_time+dir_comment+sep
     139#output_run_time_dir = output_dir +run_time+dir_comment+sep
     140output_run_time_dir = output_dir +'20070530_082920_run_final_1.5_nbartzis'+sep
    114141output_run_time_dir_name = output_run_time_dir + scenario_name  #Used by post processing
    115142
     
    126153community_scenario = gauges_dir + 'community_onslow.csv'
    127154buildings_filename = gauges_dir + 'Onslow_res_Project.csv'
    128 buildings_filename_out = 'Onslow_res_Project_modified.csv'
     155buildings_filename_out =output_run_time_dir + 'Onslow_res_Project_modified.csv'
    129156###############################
    130157# Domain definitions
     
    215242
    216243# region to export
    217 e_min_area = 300000
    218 e_max_area = 310000
    219 n_min_area = 7600000
    220 n_max_area = 7610000
    221 
     244eastingmin = 300000
     245eastingmax = 310000
     246northingmin = 7600000
     247northingmax = 7610000
     248
  • anuga_work/production/onslow_2006/run_onslow_urs.py

    r4466 r4525  
    3030from anuga.shallow_water import Field_boundary
    3131from Numeric import allclose
     32from anuga.shallow_water.data_manager import export_grid
     33
    3234
    3335from anuga.pmesh.mesh_interface import create_mesh_from_regions
    34 from anuga.abstract_2d_finite_volumes.util import start_screen_catcher, copy_code_files,store_parameters
     36from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files,store_parameters
    3537from anuga_parallel.parallel_api import distribute, numprocs, myid, barrier
    3638from anuga_parallel.parallel_abstraction import get_processor_name
    3739from anuga.caching import myhash
     40from anuga.damage_modelling.inundation_damage import add_depth_and_momentum2csv, inundation_damage
     41
    3842# Application specific imports
    3943import project_urs                 # Definition of file names and polygons
     
    4145def run_model(**kwargs):
    4246   
    43     tide = kwargs['tide']
    44     alpha = kwargs['alpha']
    45     friction = kwargs['friction']
    46     time_thinning = kwargs['time_thinning']
    4747    scenario_name = kwargs['aa_scenario_name']
    48    
    49    
    5048   
    5149    #------------------------------------------------------------------------------
     
    5553
    5654    #copy script must be before screen_catcher
    57     print 'tide',tide
     55    print 'tide',kwargs['tide']
    5856    kwargs['est_num_trigs']=project_urs.trigs_min
    5957    kwargs['num_cpu']=numprocs
    6058    kwargs['host']=project_urs.host
    6159    kwargs['res_factor']=project_urs.res_factor
    62     kwargs['starttime']=project_urs.starttime   
     60    kwargs['starttime']=project_urs.starttime
    6361    kwargs['yieldstep']=project_urs.yieldstep
    6462    kwargs['finaltime']=project_urs.finaltime
     
    6664    kwargs['output_dir']=project_urs.output_run_time_dir
    6765    kwargs['bathy_file']=project_urs.combined_dir_name + '.pts'
    68     kwargs['boundary_file']=project_urs.boundaries_dir_name + '.sww'
    69 #    kwargs['Completed']=''
    70 
     66#    kwargs['bathy_file']=project_urs.combined_small_dir_name + '.txt'
     67    kwargs['boundary_file']=project_urs.boundaries_in_dir_name + '.sww'
     68    '''
    7169    print 'output_dir',kwargs['output_dir']
    72    
    73     print 'myid',myid
    7470    if myid == 0:
    7571        copy_code_files(kwargs['output_dir'],__file__,
     
    8379
    8480    print "Processor Name:",get_processor_name()
    85 #    barrier()
    86 
    87     # filenames
    88     #boundaries_name = project_urs.boundaries_name
    89     meshes_dir_name = project_urs.meshes_dir_name+'.msh'
    90     #boundaries_dir_name = project_urs.boundaries_dir_name
    91 
    92 #    tide = project_urs.tide
    9381
    9482    # creates copy of code in output dir
    9583    print 'min triangles', project_urs.trigs_min,
    9684    print 'Note: This is generally about 20% less than the final amount'
     85
    9786
    9887    #--------------------------------------------------------------------------
     
    10291    # resolutions (maximal area of per triangle) for each polygon
    10392    #--------------------------------------------------------------------------
     93    #IMPORTANT don't cache create_mesh_from_region and Domain(mesh....) as it
     94    # causes problems with the ability to cache set quantity which takes alot of times
    10495
    10596    if myid == 0:
     
    112103                             maximum_triangle_area=project_urs.res_poly_all,
    113104                             interior_regions=project_urs.interior_regions,
    114                              filename=meshes_dir_name,
     105                             filename=project_urs.meshes_dir_name+'.msh',
    115106                             use_cache=False,
    116107                             verbose=True)
     
    126117    #domain = cache(Domain, (meshes_dir_name), {'use_cache':True, 'verbose':True}, verbose=True)
    127118    #above don't work
    128     domain = Domain(meshes_dir_name, use_cache=False, verbose=True)
    129 #    print 'domain id', id(domain)
    130 #    print 'myhash', myhash(domain)     
     119    domain = Domain(project_urs.meshes_dir_name+'.msh', use_cache=False, verbose=True)
    131120       
    132121    print domain.statistics()
    133 #    domain.
    134122    print 'triangles',len(domain)
    135123   
    136124    kwargs['act_num_trigs']=len(domain)
    137 #    print len(domain.mesh)
    138 
    139125
    140126    #-------------------------------------------------------------------------
     
    147133        from polygon import Polygon_function
    148134        #following sets the stage/water to be offcoast only
    149         IC = Polygon_function( [(project_urs.poly_mainland, -1.0)], default = tide,
     135        IC = Polygon_function( [(project_urs.poly_mainland, -1.0)], default = kwargs['tide'],
    150136                                 geo_reference = domain.geo_reference)
    151137        domain.set_quantity('stage', IC)
    152         domain.set_quantity('friction', friction)
     138        domain.set_quantity('friction', kwargs['friction'])
    153139       
    154140        print 'Start Set quantity'
     
    158144                            use_cache = True,
    159145                            verbose = True,
    160                             alpha = alpha)
     146                            alpha = kwargs['alpha'])
    161147        print 'Finished Set quantity'
    162148    barrier()
     
    174160    #------------------------------------------------------
    175161    print 'domain id', id(domain)
    176     domain.set_name(scenario_name)
     162    domain.set_name(kwargs['aa_scenario_name'])
    177163    domain.set_datadir(kwargs['output_dir'])
    178164    domain.set_default_order(2) # Apply second order scheme
     
    180166    domain.set_store_vertices_uniquely(False)
    181167    domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
    182     domain.set_maximum_allowed_speed(0.1) # Allow a little runoff (0.1 is OK)
    183     domain.beta_h = 0
    184     domain.limit2007 = 1
    185     domain.H0=0.01
     168#    domain.set_maximum_allowed_speed(0.1) # Allow a little runoff (0.1 is OK)
     169    domain.beta_h = 0 #sets the surface of the triangle to follow the bathy
     170    #domain.H0=0.01 #controls the flux limiter (limiter2007)
     171    #domain.limit2007 = 1 #minimises creep
    186172
    187173    #-------------------------------------------------------------------------
     
    193179
    194180    Bf = Field_boundary(kwargs['boundary_file'],
    195                     domain, time_thinning=time_thinning, mean_stage=tide,
     181                    domain, time_thinning=kwargs['time_thinning'], mean_stage=kwargs['tide'],
    196182                    use_cache=True, verbose=True)
    197183                   
     
    201187
    202188    Br = Reflective_boundary(domain)
    203     Bd = Dirichlet_boundary([tide,0,0])
     189    Bd = Dirichlet_boundary([kwargs['tide'],0,0])
    204190
    205191    print'set_boundary'
     
    218204    for t in domain.evolve(yieldstep = 240, finaltime = kwargs['starttime']):
    219205        domain.write_time()
    220         domain.write_boundary_statistics(tags = 'ocean')
    221 
    222     for t in domain.evolve(yieldstep = kwargs['yieldstep'], finaltime = kwargs['finaltime']
     206        domain.write_boundary_statistics(tags = 'ocean')     
     207
     208    for t in domain.evolve(yieldstep = kwargs['yieldstep'], finaltime = 21600
    223209                       ,skip_initial_step = True):
    224210        domain.write_time()
    225         domain.write_boundary_statistics(tags = 'ocean')
     211        domain.write_boundary_statistics(tags = 'ocean')     
     212   
     213    for t in domain.evolve(yieldstep = 240, finaltime = kwargs['finaltime']
     214                       ,skip_initial_step = True):
     215        domain.write_time()
     216        domain.write_boundary_statistics(tags = 'ocean')
    226217
    227218    x, y = domain.get_maximum_inundation_location()
     
    237228        store_parameters(**kwargs)
    238229    barrier()
     230    '''
     231    swwfile = kwargs['output_dir']+kwargs['aa_scenario_name']
     232    print 'swwfile',swwfile
     233    export_grid(swwfile, extra_name_out = 'town',
     234                quantities = ['elevation','stage','speed'], # '(xmomentum**2 + ymomentum**2)**0.5' defaults to elevation
     235                timestep = None,
     236                reduction = max,
     237                cellsize = 25,
     238                NODATA_value = -9999,
     239                easting_min = project_urs.eastingmin,
     240                easting_max = project_urs.eastingmax,
     241                northing_min = project_urs.northingmin,
     242                northing_max = project_urs.northingmax,
     243                verbose = True,
     244                origin = None,
     245                datum = 'WGS84',
     246                format = 'asc')
     247   
     248    swwfile = kwargs['output_dir']+kwargs['aa_scenario_name']+'.sww'
     249    buildings_filename = project_urs.buildings_filename
     250    buildings_filename_out = project_urs.buildings_filename_out
     251               
     252    inundation_damage(swwfile+'.sww', buildings_filename, buildings_filename_out)
     253    print '\n Augmented building file written to %s \n' \
     254           %buildings_filename_out
    239255
    240256
  • anuga_work/production/test_dampier_2006/test.py

    r4288 r4525  
    33import os
    44
    5 import project
     5#import project
     6#from Numeric import allclose
    67from anuga.pmesh.mesh_interface import create_mesh_from_regions
    78from anuga.shallow_water import Domain
    89from anuga.shallow_water import File_boundary
     10from time import localtime, strftime, gmtime
    911
    1012home = getenv('INUNDATIONHOME') #Sandpit's parent dir   
     
    1315state = 'western_australia'
    1416scenario_name = 'dampier'
    15 scenario = 'dampier_tsunami_scenario_2006'
     17scenario = 'test_dampier'
    1618an = 'anuga'
    1719bo = 'boundaries'
     20topo = 'topographies'
     21out = 'outputs'
    1822urs = 'urs'
    1923gridded = '1_10000'
    20 best_boundary_sww_file = 'o_test_8500_12000.sww'
     24#best_boundary_sww_file = 'o_test_8500_12000.sww'
     25best_boundary_sww_file = 'o_8500_12000_no_zone.sww'
     26
     27time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir
     28gtime = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir
     29run_time = time+'_run'
     30print 'gtime: ', gtime
     31print 'time: ', time
     32
    2133
    2234mesh_filename = 'small.tsh' # this will be local
    23 best_boundary_sww = os.path.join(data,state,scenario_name,
    24                                  scenario,an,bo,best_boundary_sww_file)
     35best_boundary_sww = os.path.join(home,data,state,scenario,an,bo,best_boundary_sww_file)
     36#J:\inundation\data\western_australia\dampier_tsunami_scenario_2006\anuga\topographies
     37                                 
     38elevation_file = 'dampier_combined_elevation_smallest.txt'
     39smallest_elevation= os.path.join(home,data,state,scenario,an,topo,elevation_file)
     40
     41output= os.path.join(home,data,state,scenario,an,out,run_time)
    2542
    2643#pro_instance = project.Project([data,state,scenario_name],
    2744#                                       outputdir_name=outputdir_name)
    2845
    29 poly_all = [[250000,7660000],[280000,7660000],
    30                              [280000,7630000]]
     46#poly_all = [[250000,7660000],[280000,7660000], [280000,7630000]]
     47poly_all = [[469000,7760000],[470000,7758000],[468000,7758000]]
     48
     49print 'create mesh'
    3150create_mesh_from_regions(poly_all,
    3251                             boundary_tags={'back': [0,1,2]},
     
    3857print domain.statistics()
    3958
    40 domain.set_quantity('stage', 0.0)
     59domain.set_quantity('stage', 2.4)
    4160domain.set_quantity('friction', 0.01)
     61domain.set_name(scenario_name)
     62domain.set_datadir(output)
     63
     64print 'set elevation',smallest_elevation
     65
    4266domain.set_quantity('elevation',
    43 #                    filename = project.combined_dir_name + '.pts',
    44 # MUST USE TXT FILES FOR CACHING TO WORK!
    45                     filename = project.combined_smaller_dir_name + '.txt',
     67                    filename = smallest_elevation,
    4668                    use_cache = True,
    4769                    verbose = True,
    4870                    alpha = 0.1)
    49    
     71                   
     72
     73print 'best_boundary_sww',best_boundary_sww
     74
     75print 'get file boundary'
    5076Bf = File_boundary(best_boundary_sww,
    51                   domain,  use_cache=False, verbose=True)
     77                  domain,  time_thinning=24, use_cache=False, verbose=True)
     78                 
     79domain.set_boundary({'back': Bf})
     80                     
     81                     
     82#t0 = time.time()
     83
     84print 'evolve'
     85for t in domain.evolve(yieldstep = 120, finaltime = 3400):
     86    domain.write_time()
     87    domain.write_boundary_statistics(tags = 'back')
     88
     89
     90
     91
Note: See TracChangeset for help on using the changeset viewer.