Ignore:
Timestamp:
Jan 8, 2007, 5:59:47 PM (18 years ago)
Author:
sexton
Message:

(1) updates to Dampier script based on Perth script (2) minor updates to Onslow report

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/production/dampier_2006/run_dampier.py

    r4066 r4147  
    66
    77The scenario is defined by a triangular mesh created from project.polygon,
    8 the elevation data and a simulated submarine landslide.
     8the elevation data and a simulated tsunami generated with URS code.
    99
    1010Ole Nielsen and Duncan Gray, GA - 2005 and Jane Sexton, Nick Bartzis, GA - 2006
     
    2323import sys
    2424
    25 
    2625# Related major packages
    2726from anuga.shallow_water import Domain
     
    3231
    3332from anuga.pmesh.mesh_interface import create_mesh_from_regions
    34 
    35 from anuga.geospatial_data.geospatial_data import *
    3633from anuga.abstract_2d_finite_volumes.util import start_screen_catcher, copy_code_files
    3734from anuga_parallel.parallel_api import distribute, numprocs, myid, barrier
     
    4542#------------------------------------------------------------------------------
    4643
     44start_screen_catcher(project.output_run_time_dir, myid, numprocs)
    4745
    4846# filenames
    49 
    50 #build_time = '20061029_231935_build_tide_24'
    51 #build_time = '20061030_165746_build_tide_24'
    52 #build_time = '20061102_215532_build_plus_old_data'
    53 #build_time = '20061103_055258_build'
    5447build_time = '20061107_063840_build'
    55 #build_time = '20061025_153643_build_basic'
    5648bound_time = '20061102_221245_build'
    5749
    5850boundaries_name = project.boundaries_name
    59 #meshes_time_dir_name = project.meshes_time_dir_name+'.msh'
    6051meshes_dir_name = project.meshes_dir_name+'.msh'
    61 #source_dir = project.boundarydir
    62 #boundaries_time_dir_name = project.boundaries_dir + build_time + sep + boundaries_name
    63 boundaries_time_dir_name = project.boundaries_time_dir_name
    6452boundaries_dir_name = project.boundaries_dir_name
     53
    6554tide = project.tide
    6655
     
    7059                 dirname(project.__file__)+sep+ project.__name__+'.py' )
    7160barrier()
    72 #start_screen_catcher(project.output_run_time_dir, myid, numprocs)
    7361
    7462print 'USER: ', project.user
    75 #sys.exit()
     63print 'min triangles', project.trigs_min,
     64print 'Note: This is generally about 20% less than the final amount'
     65
    7666#--------------------------------------------------------------------------
    7767# Create the triangular mesh based on overall clipping polygon with a
     
    8474   
    8575    print 'start create mesh from regions'
    86     interior_regions = [#[project.karratha_polygon, 25000],
    87                     [project.poly_coast, 10000],
    88                     [project.poly_pipeline, 2000],
    89                     [project.poly_facility, 500]]   
    90 #                    [project.poly_interior, 1000]]       
    91     from anuga.utilities.polygon import plot_polygons
    92     figname = project.output_run_time_dir + 'poly_pic'
    93     plot_polygons([project.poly_coast,project.poly_pipeline,project.poly_facility,
    94                project.bounding_polygon],
    95                figname,
    96                verbose = True)
    97 #    if access(project.meshes_time_dir,F_OK) == 0:
    98 #        mkdir(project.meshes_time_dir)
    99 #    if access(project.meshes_dir,F_OK) == 0:
    100 #        mkdir(project.meshes_dir)
    101     import sys; sys.exit()
    102     print 'start create mesh from regions'
    103     interior_regions = [#[project.karratha_polygon, 25000],
    104 #                    [project.cipma_polygon, 1000],
    105 #                    [project.poly_pipeline, 5000],
    106 #                    [project.poly_facility, 500]]   
    107                     [project.poly_interior, 1000]]   
    108 #    meshes_dir_name = project.meshes_dir_name + '.msh'
    109 
    110     create_mesh_from_regions(project.bounding_polygon,
    111                          boundary_tags={'back': [7, 8], 'side': [0, 6],
    112                                         'ocean': [1, 2, 3, 4, 5]},
    113                          maximum_triangle_area=100000,
    114                          interior_regions=interior_regions,
    115 #                         filename=meshes_time_dir_name,
    116                          filename=meshes_dir_name,
    117                          use_cache=True,
    118                          verbose=True)
     76    create_mesh_from_regions(project.poly_all,
     77                             boundary_tags={'back': [7, 8], 'side': [0, 6],
     78                                            'ocean': [1, 2, 3, 4, 5]},
     79                             maximum_triangle_area=project.res_poly_all,
     80                             interior_regions=project.interior_regions,
     81                             filename=meshes_dir_name,
     82                             use_cache=True,
     83                             verbose=True)
    11984
    12085# to sync all processors are ready
     
    12590#-------------------------------------------------------------------------
    12691print 'Setup computational domain'
    127 #domain = Domain(meshes_time_dir_name, use_cache=True, verbose=True)
    12892domain = Domain(meshes_dir_name, use_cache=True, verbose=True)
    12993print domain.statistics()
    13094
     95"""
    13196print 'starting to create boundary conditions'
    13297boundaries_in_dir_name = project.boundaries_in_dir_name
    13398
    134 from anuga.shallow_water.data_manager import urs2sww, ferret2sww
    135 
    136 print 'maxlat=project.south_boundary, minlat=project.north_boundary', project.south_boundary,project.north_boundary
    137 print 'minlon= project.west_boundary, maxlon=project.east_boundary',project.west_boundary, project.east_boundary
    138 print ' maxlon=project.east',project.east
    139 
    140 print 'origin: domain.geo_reference.get_origin()',domain.geo_reference.get_origin()
    141 
    142 #import sys; sys.exit()
    143 
    144 #if access(project.boundaries_time_dir,F_OK) == 0:
    145 #    mkdir (project.boundaries_time_dir)
     99from anuga.shallow_water.data_manager import urs2sw
     100
    146101# put above distribute
    147102print 'boundary file is: ',boundaries_dir_name
    148103from caching import cache
    149104if myid == 0:
    150     cache(ferret2sww,
     105    cache(urs2sww,
    151106          (boundaries_in_dir_name,
    152107    #       boundaries_time_dir_name),
     
    169124           )
    170125barrier()
    171 
     126"""
    172127
    173128#-------------------------------------------------------------------------
     
    179134
    180135    domain.set_quantity('stage', tide)
    181     domain.set_quantity('friction', 0.0)
     136    domain.set_quantity('friction', 0.01)
    182137    #combined_time_dir_name = project.topographies_dir+build_time+project.combined_name
    183138    print 'Start Set quantity'
    184139
    185 
    186140    domain.set_quantity('elevation',
    187                     filename = project.topographies_dir + build_time + sep + project.combined_final_name + '.pts',
     141                    filename = project.combined_dir_name + '.txt',
    188142                    use_cache = True,
    189143                    verbose = True,
    190144                    alpha = 0.1)
    191     #domain.set_quantity('elevation', -50)
    192145    print 'Finished Set quantity'
    193146barrier()
     
    211164domain.set_store_vertices_uniquely(False)
    212165domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
    213 domain.set_maximum_allowed_speed(0.0) # Allow a little runoff (0.1 is OK)
     166domain.set_maximum_allowed_speed(0.1) # Allow a little runoff (0.1 is OK)
    214167
    215168#-------------------------------------------------------------------------
     
    217170#-------------------------------------------------------------------------
    218171print 'Available boundary tags', domain.get_boundary_tags()
    219 
     172print 'domain id', id(domain)
    220173print 'Reading Boundary file'
    221 #boundariesname = project.boundaries_dir + '20061101_003322_build'+sep+boundaries_name
    222 #print'boundariesname',boundariesname
    223 #Bf = File_boundary(boundaries_time_dir_name + '.sww',
    224 
    225 #Bf = File_boundary(boundariesname + '.sww',
    226 
    227 print 'domain id', id(domain)
    228 Bf = File_boundary(boundaries_dir_name + '.sww',
    229                   domain, time_thinning=5, use_cache=True, verbose=True)
     174#Bf = File_boundary(boundaries_dir_name + '.sww',
     175#                  domain, time_thinning=5, use_cache=True, verbose=True)
    230176
    231177print 'finished reading boundary file'
     
    246192t0 = time.time()
    247193
    248 #for t in domain.evolve(yieldstep = 60, finaltime = 34000):
     194for t in domain.evolve(yieldstep = 60, finaltime = 34000):
     195    domain.write_time()
     196    domain.write_boundary_statistics(tags = 'ocean')
     197
     198#for t in domain.evolve(yieldstep = 120, finaltime = 9000):
    249199#    domain.write_time()
    250200#    domain.write_boundary_statistics(tags = 'ocean')
    251 
    252 for t in domain.evolve(yieldstep = 120, finaltime = 9000):
    253     domain.write_time()
    254     domain.write_boundary_statistics(tags = 'ocean')
    255 #    print 'time: ',time.time()
    256  
    257     if allclose(t, 6000):
    258         domain.set_quantity('xmomentum', 0)
    259         domain.set_quantity('ymomentum', 0)
    260 #import sys; sys.exit()
    261201     
    262 for t in domain.evolve(yieldstep = 60, finaltime = 28800
    263                        ,skip_initial_step = True):
    264     domain.write_time()
    265     domain.write_boundary_statistics(tags = 'ocean')   
    266 
    267 for t in domain.evolve(yieldstep = 120, finaltime = 34800
    268                        ,skip_initial_step = True):
    269     domain.write_time()
    270     domain.write_boundary_statistics(tags = 'ocean')   
     202#for t in domain.evolve(yieldstep = 60, finaltime = 28800
     203#                       ,skip_initial_step = True):
     204#    domain.write_time()
     205#    domain.write_boundary_statistics(tags = 'ocean')   
     206
     207#for t in domain.evolve(yieldstep = 120, finaltime = 34800
     208#                       ,skip_initial_step = True):
     209#    domain.write_time()
     210#    domain.write_boundary_statistics(tags = 'ocean')   
    271211   
    272212print 'That took %.2f seconds' %(time.time()-t0)
Note: See TracChangeset for help on using the changeset viewer.