Changeset 4476


Ignore:
Timestamp:
May 23, 2007, 9:38:52 AM (17 years ago)
Author:
nick
Message:

update to exmouth

Location:
anuga_work/production/exmouth_2006
Files:
3 edited

Legend:

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

    r4465 r4476  
    6969#offshore_dir_name1 = project.offshore_dir_name1
    7070#offshore_dir_name2 = project.offshore_dir_name2
    71 
     71'''
    7272# creates DEM from asc data
    7373print "creates DEMs from asc data"
     
    7979dem2pts(onshore_dir_name, use_cache=True, verbose=True)
    8080dem2pts(onshore1_dir_name, use_cache=True, verbose=True)
    81 
     81'''
    8282print'create Geospatial data1 objects from topographies',onshore_dir_name + '.pts'
    8383G1 = Geospatial_data(file_name = onshore_dir_name + '.pts')
     
    9696    mkdir (project.topographies_dir)
    9797print'export',project.combined_dir_name+'_unclipped' + '.txt'
    98 G.export_points_file(project.combined_dir_name+ '.txt')
     98#G.export_points_file(project.combined_dir_name+ '.txt')
     99
     100print'create Geospatial data1 objects from topographies',onshore_dir_name + '.pts'
     101#G = Geospatial_data(file_name = project.combined_dir_name+ '.txt',verbose=True)
    99102
    100103print'split'
    101 G_small, G_other = G_clipped.split(.10,verbose=True)
     104G_small, G_other = G.split(.10,verbose=True)
    102105
    103106print 'export', project.combined_small_dir_name + '.txt'
    104107G_small.export_points_file(project.combined_small_dir_name + '.txt')
    105108#G_clipped.export_points_file(project.combined_dir_name + '.xya')
     109'''
    106110
    107111
    108 '''
    109112print'project.combined_dir_name + 1.xya',project.combined_dir_name + '1.xya'
    110113G_all=Geospatial_data(file_name = project.combined_dir_name + '1.xya')
     
    115118print'export 2'
    116119G_all_2.export_points_file(project.combined_dir_name+'_other1' + '.xya')
    117 '''
     120
    118121
    119122#-------------------------------------------------------------------------
     
    128131print 'project.boundaries_dir_name',project.boundaries_dir_name
    129132
    130 urs_ungridded2sww(boundaries_in_dir_name, project.boundaries_dir_name,
     133urs_ungridded2sww(boundaries_in_dir_name, project.boundaries_in_dir_name,
    131134                  verbose=True, mint=4000, maxt=35000, zscale=1)
     135
     136'''
    132137
    133138
    134139
    135140
    136 
    137 
  • anuga_work/production/exmouth_2006/project.py

    r4465 r4476  
    9696#combined_dir_name_unclipped1 = topographies_dir + combined_name_unclipped1
    9797#combined_dir_name1 = topographies_dir + combined_name1
    98 combined_small_name_dir = topographies_dir + combined_small_name
     98combined_small_dir_name = topographies_dir + combined_small_name
    9999
    100100meshes_dir = anuga_dir+'meshes'+sep
     
    107107boundaries_name = 'exmouth_3854_17042007'
    108108
    109 boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'1_10000'+sep
     109boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'dampier'+sep+'1_10000'+sep
    110110boundaries_in_dir_name = boundaries_in_dir + boundaries_name
    111111boundaries_dir = anuga_dir+'boundaries'+sep
     
    133133from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon
    134134
    135 poly_all = read_polygon(polygons_dir+'extent_zone50a.csv')
     135poly_all = read_polygon(polygons_dir+'extent_more_points.csv')
    136136
    137137print 'Area of bounding polygon', polygon_area(poly_all)/1000000.0
     
    142142# Interior region definitions
    143143###############################
    144 '''
    145 poly_0 = read_polygon(polygons_dir+'neg20_coast_contour_pts.csv')
    146 res_0 = 20000*res_factor
    147144
    148 poly_1 = read_polygon(polygons_dir+'exmouth_north_coast_inside_extent.csv')
    149 res_1 = 5000*res_factor
    150145
    151 poly_2 = read_polygon(polygons_dir+'exmouth_south_coast_inside_extent.csv')
    152 res_2 = 5000*res_factor
     146poly_coast = read_polygon(polygons_dir+'pts_coast.csv')
     147res_coast = 10000*res_factor
    153148
    154 poly_3 = read_polygon(polygons_dir+'exmouth_town_pts.csv')
    155 res_3 = 2000*res_factor
     149poly_coast1 = read_polygon(polygons_dir+'pts_coast1.csv')
     150#res_0 = 20000*res_factor
    156151
    157 poly_4 = read_polygon(polygons_dir+'exmouth_inner_town_pts.csv')
    158 res_4 = 500*res_factor
     152poly_coast2 = read_polygon(polygons_dir+'pts_coast2.csv')
     153#res_0 = 20000*res_factor
    159154
    160 interior_regions = [[poly_0,res_0],[poly_1,res_1],[poly_2,res_2]
    161                      ,[poly_3,res_3],[poly_4,res_4]]
     155poly_coast3 = read_polygon(polygons_dir+'pts_coast3.csv')
     156#res_0 = 20000*res_factor
     157
     158poly_exmouth = read_polygon(polygons_dir+'pts_exmouth.csv')
     159res_exmouth = 500*res_factor
     160
     161poly_nth_defence = read_polygon(polygons_dir+'pts_nth_defence.csv')
     162res_nth_defence = 5000*res_factor
     163
     164poly_middle = read_polygon(polygons_dir+'pts_middle.csv')
     165res_middle = 30000*res_factor
     166
     167poly_airport = read_polygon(polygons_dir+'pts_airport.csv')
     168res_airport = 5000*res_factor
     169
     170interior_regions = [[poly_coast,res_coast],[poly_coast1,res_coast],[poly_coast2,res_coast]
     171                   ,[poly_coast3,res_coast],[poly_middle,res_middle],[poly_exmouth,res_exmouth]
     172                   ,[poly_nth_defence,res_nth_defence],[poly_airport,res_airport]]
    162173
    163174trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all)
     
    166177
    167178poly_mainland = read_polygon(polygons_dir+'Initial_Condition.csv')
    168 '''
     179
    169180###################################################################
    170181# Clipping regions for export to asc and regions for clipping data
  • anuga_work/production/exmouth_2006/run_exmouth.py

    r4465 r4476  
    22
    33Source data such as elevation and boundary data is assumed to be available in
    4 directories specified by project_urs.py
    5 The output sww file is stored in project_urs.output_run_time_dir
    6 
    7 The scenario is defined by a triangular mesh created from project_urs.polygon,
     4directories specified by project.py
     5The output sww file is stored in project.output_run_time_dir
     6
     7The scenario is defined by a triangular mesh created from project.polygon,
    88the elevation data and a simulated tsunami generated with URS code.
    99
     
    3737from anuga.caching import myhash
    3838# Application specific imports
    39 import project_urs                 # Definition of file names and polygons
     39import project                 # Definition of file names and polygons
    4040
    4141def run_model(**kwargs):
    4242   
    43     tide = kwargs['tide']
    44     alpha = kwargs['alpha']
    45     friction = kwargs['friction']
    46     time_thinning = kwargs['time_thinning']
     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
    58     kwargs['est_num_trigs']=project_urs.trigs_min
     55    print 'tide',kwargs['tide']
     56    kwargs['est_num_trigs']=project.trigs_min
    5957    kwargs['num_cpu']=numprocs
    60     kwargs['host']=project_urs.host
    61     kwargs['res_factor']=project_urs.res_factor
    62     kwargs['starttime']=project_urs.starttime
    63     kwargs['yieldstep']=project_urs.yieldstep
    64     kwargs['finaltime']=project_urs.finaltime
    65    
    66     kwargs['output_dir']=project_urs.output_run_time_dir
    67     kwargs['bathy_file']=project_urs.combined_dir_name_unclipped1+'.txt'
    68 #    kwargs['bathy_file']=project_urs.combined_small_dir_name + '.pts'
    69     kwargs['boundary_file']=project_urs.boundaries_dir_name + '.sww'
     58    kwargs['host']=project.host
     59    kwargs['res_factor']=project.res_factor
     60    kwargs['starttime']=project.starttime
     61    kwargs['yieldstep']=project.yieldstep
     62    kwargs['finaltime']=project.finaltime
     63   
     64    kwargs['output_dir']=project.output_run_time_dir
     65    kwargs['bathy_file']=project.combined_dir_name+'.txt'
     66#    kwargs['bathy_file']=project.combined_small_dir_name + '.pts'
     67    kwargs['boundary_file']=project.boundaries_in_dir_name + '.sww'
    7068
    7169    print 'output_dir',kwargs['output_dir']
    7270    if myid == 0:
    7371        copy_code_files(kwargs['output_dir'],__file__,
    74                  dirname(project_urs.__file__)+sep+ project_urs.__name__+'.py' )
     72                 dirname(project.__file__)+sep+ project.__name__+'.py' )
    7573
    7674        store_parameters(**kwargs)
     
    8381
    8482    # filenames
    85 #    meshes_dir_name = project_urs.meshes_dir_name+'.msh'
     83#    meshes_dir_name = project.meshes_dir_name+'.msh'
    8684
    8785    # creates copy of code in output dir
    88     print 'min triangles', project_urs.trigs_min,
     86    print 'min triangles', project.trigs_min,
    8987    print 'Note: This is generally about 20% less than the final amount'
    9088
     
    9290    # Create the triangular mesh based on overall clipping polygon with a
    9391    # tagged
    94     # boundary and interior regions defined in project_urs.py along with
     92    # boundary and interior regions defined in project.py along with
    9593    # resolutions (maximal area of per triangle) for each polygon
    9694    #--------------------------------------------------------------------------
     
    102100        print 'start create mesh from regions'
    103101
    104         create_mesh_from_regions(project_urs.poly_all,
    105                          boundary_tags={'back': [1, 2], 'side': [0,3],
    106                                         'ocean': [4]},
    107                              maximum_triangle_area=project_urs.res_poly_all,
    108                              interior_regions=project_urs.interior_regions,
    109                              filename=project_urs.meshes_dir_name+'.msh',
     102        create_mesh_from_regions(project.poly_all,
     103                         boundary_tags={'back': [3,4,5], 'side': [2,6],
     104                                        'ocean': [0,1,7]},
     105                             maximum_triangle_area=project.res_poly_all,
     106                             interior_regions=project.interior_regions,
     107                             filename=project.meshes_dir_name+'.msh',
    110108                             use_cache=False,
    111109                             verbose=True)
    112110    barrier()
    113    
    114111
    115112    #-------------------------------------------------------------------------
     
    120117    #domain = cache(Domain, (meshes_dir_name), {'use_cache':True, 'verbose':True}, verbose=True)
    121118    #above don't work
    122     domain = Domain(project_urs.meshes_dir_name+'.msh', use_cache=False, verbose=True)
     119    domain = Domain(project.meshes_dir_name+'.msh', use_cache=False, verbose=True)
    123120       
    124121    print domain.statistics()
     
    127124    kwargs['act_num_trigs']=len(domain)
    128125
    129 
    130126    #-------------------------------------------------------------------------
    131127    # Setup initial conditions
     
    137133        from polygon import Polygon_function
    138134        #following sets the stage/water to be offcoast only
    139         IC = Polygon_function( [(project_urs.poly_mainland, -1.0)], default = tide,
     135        IC = Polygon_function( [(project.poly_mainland, -1.0)], default = kwargs['tide'],
    140136                                 geo_reference = domain.geo_reference)
    141137        domain.set_quantity('stage', IC)
    142         domain.set_quantity('friction', friction)
     138        domain.set_quantity('friction', kwargs['friction'])
    143139       
    144140        print 'Start Set quantity'
     
    148144                            use_cache = True,
    149145                            verbose = True,
    150                             alpha = alpha)
     146                            alpha = kwargs['alpha'])
    151147        print 'Finished Set quantity'
    152148    barrier()
    153 
    154149
    155150    #------------------------------------------------------
     
    164159    #------------------------------------------------------
    165160    print 'domain id', id(domain)
    166     domain.set_name(scenario_name)
     161    domain.set_name(kwargs['aa_scenario_name'])
    167162    domain.set_datadir(kwargs['output_dir'])
    168163    domain.set_default_order(2) # Apply second order scheme
     
    180175    print 'Available boundary tags', domain.get_boundary_tags()
    181176    print 'domain id', id(domain)
    182     #print 'Reading Boundary file',project_urs.boundaries_dir_namea + '.sww'
     177    #print 'Reading Boundary file',project.boundaries_dir_namea + '.sww'
    183178
    184179    Bf = Field_boundary(kwargs['boundary_file'],
    185                     domain, time_thinning=time_thinning, mean_stage=tide,
     180                    domain, time_thinning=kwargs['time_thinning'], mean_stage=kwargs['tide'],
    186181                    use_cache=True, verbose=True)
    187182                   
     
    191186
    192187    Br = Reflective_boundary(domain)
    193     Bd = Dirichlet_boundary([tide,0,0])
     188    Bd = Dirichlet_boundary([kwargs['tide'],0,0])
    194189
    195190    print'set_boundary'
     
    237232if __name__ == "__main__":
    238233
    239     run_model(file_name=project_urs.home+'detail.csv', aa_scenario_name=project_urs.scenario_name,
    240               ab_time=project_urs.time, res_factor= project_urs.res_factor, tide=project_urs.tide, user=project_urs.user,
    241               alpha = project_urs.alpha, friction=project_urs.friction,
    242               time_thinning = project_urs.time_thinning,
    243               dir_comment=project_urs.dir_comment)
    244 
    245 
     234    run_model(file_name=project.home+'detail.csv', aa_scenario_name=project.scenario_name,
     235              ab_time=project.time, res_factor= project.res_factor, tide=project.tide, user=project.user,
     236              alpha = project.alpha, friction=project.friction,
     237              time_thinning = project.time_thinning,
     238              dir_comment=project.dir_comment)
     239
     240
Note: See TracChangeset for help on using the changeset viewer.