Ignore:
Timestamp:
May 18, 2006, 10:01:58 AM (19 years ago)
Author:
nick
Message:

update onslow and pt hedland

File:
1 edited

Legend:

Unmodified
Added
Removed
  • production/pt_hedland_2006/run_pt_hedland.py

    r2855 r2902  
    1616
    1717# Standard modules
    18 import os
     18import os
     19
     20from os import sep
     21from os.path import dirname, basename
     22
    1923import time
    2024
     
    4751
    4852# filenames
     53print 'run home', project.home
    4954onshore_dem_name = project.onshore_dem_name
    5055offshore_points1 = project.offshore_dem_name1
     
    5459
    5560
     61
     62
     63#import sys; sys.exit()
     64
    5665# creates copy of code in output dir if dir doesn't exist
    5766if access(project.outputtimedir,F_OK) == 0 :
    5867    mkdir (project.outputtimedir)
    59 copy (project.codedirname, project.outputtimedir + project.codename)
    60 copy (project.codedir + 'run_pt_hedland.py', project.outputtimedir + 'run_pt_hedland.py')
    61 print'output dir', project.outputtimedir
     68copy (dirname(project.__file__) +sep+ project.__name__+'.py', project.outputtimedir + project.__name__+'.py')
     69copy (__file__, project.outputtimedir + basename(__file__))
     70
    6271
    6372#normal screen output is stored in
     
    6776#used to catch screen output to file
    6877sys.stdout = Screen_Catcher(screen_output_name)
    69 #sys.stderr = Screen_Catcher(screen_output_name)
    70 #sys.stderr = Screen_Catcher(screen_error_name)
    71 
    72 '''
    73 copied_files = False
    74 
    75 # files to be used
    76 files_used = [onshore_dem_name, offshore_points,]
    77 
    78 if sys.platform != 'win32':   
    79     copied_files = True
    80     for name in file_list:
    81         copy(name, )
    82 '''   
    83 #print' most file', project.MOST_dir + project.boundary_basename+'_ha.nc'
    84 #if access(project.MOST_dir + project.boundary_basename+'_ha.nc',F_OK) == 1 :
    85 #    print' most file', project.MOST_dir + project.boundary_basename
    86 
    87 
     78sys.stderr = Screen_Catcher(screen_error_name)
     79
     80
     81'''
    8882# fine data (clipping the points file to smaller area)
    8983# creates DEM from asc data
     
    114108G.export_points_file(project.combined_dem_name + '.pts')
    115109
    116 
     110'''
    117111#-------------------------------------------------------------------------------                                 
    118112# Create the triangular mesh based on overall clipping polygon with a tagged
     
    123117from pmesh.mesh_interface import create_mesh_from_regions
    124118
    125 region_res = 25000
     119region_res = 50000
    126120coast_res = 2500
    127 pt_hedland_res = 25000
     121pt_hedland_res = 5000
    128122# derive poly_coast from project.coast_name using alpha_shape
    129 interior_regions = []#[[project.poly_pt_hedland, pt_hedland_res]]#,
    130                     #[project.poly_coast, coast_res],
    131                     #[project.poly_region, region_res]]
     123interior_regions = [[project.poly_pt_hedland, pt_hedland_res],
     124                    [project.poly_region, region_res]]
    132125
    133126print 'number of interior regions', len(interior_regions)
     
    136129_ = cache(create_mesh_from_regions,
    137130          project.polyAll,
    138           {'boundary_tags': {'right': [0], 'bottomright': [1],
    139                              'bottomleft': [2], 'left': [3], 'top': [4]},
    140            'maximum_triangle_area': 250000,
     131#          {'boundary_tags': {'right': [0], 'bottomright': [1],
     132#                             'bottomleft': [2], 'left': [3], 'top': [4]},
     133          {'boundary_tags': {'top': [0], 'left': [1],
     134                             'bottomleft': [2], 'bottomright': [3], 'right': [4]},
     135           'maximum_triangle_area': 400000,
    141136           'filename': meshname,           
    142137           'interior_regions': interior_regions},
     
    147142# Setup computational domain
    148143#-------------------------------------------------------------------------------                                 
    149 
     144'''
    150145domain = pmesh_to_domain_instance(meshname, Domain,
    151146                                  use_cache = False,
    152147                                  verbose = True)
     148'''
     149
     150domain = Domain(meshname, use_cache = False, verbose = True)
    153151
    154152print 'Number of triangles = ', len(domain)
     
    171169
    172170domain.set_quantity('elevation',
    173 #                    filename = project.onshore_dem_name + '.pts',
    174171                    filename = project.combined_dem_name + '.pts',
    175 #                    filename = project.offshore_dem_name1 + '.xya',
    176 #                    filename = project.offshore_dem_name2 + '.xya',
    177172                    use_cache = True,
    178173                    verbose = True,
     
    181176
    182177print 'hi1'
    183 print 'have sent quantities OK - now exiting'
    184 import sys; sys.exit()
     178#print 'have sent quantities OK - now exiting'
     179#import sys; sys.exit()
    185180
    186181#-------------------------------------------------------------------------------                                 
     
    188183#-------------------------------------------------------------------------------
    189184print 'start ferret2sww'
     185# skipped as results in file SU-AU_clipped is correct for all WA
     186
    190187from pyvolution.data_manager import ferret2sww
    191188
     
    199196      (source_dir + project.boundary_basename,
    200197       source_dir + project.boundary_basename),
    201 #      (project.MOST_dir + project.boundary_basename,
    202 #       source_dir + project.boundary_basename),
    203198      {'verbose': True,
    204 # note didn't work with the below
    205 #       'minlat': south - 1,
    206 #       'maxlat': north + 1,
    207 #       'minlon': west - 1,
    208 #       'maxlon': east + 1,
    209199       'minlat': south,
    210200       'maxlat': north,
     
    228218Bd = Dirichlet_boundary([tide,0,0])
    229219
    230 
    231220# 7 min square wave starting at 1 min, 6m high
    232221Bw = Time_boundary(domain = domain,
    233222                   f=lambda t: [(60<t<480)*6, 0, 0])
    234223
    235 domain.set_boundary( {'right': Br, 'bottomright': Br,
    236                              'bottomleft': Br, 'left': Br, 'top': Bf} )
     224#domain.set_boundary( {'right': Br, 'bottomright': Br,
     225#                             'bottomleft': Br, 'left': Br, 'top': Bf} )
     226domain.set_boundary( {'top': Bf, 'left': Br, 'bottomleft': Br, 'bottomright': Br, 'right': Br} )
    237227                             
    238228#-------------------------------------------------------------------------------                                 
     
    242232t0 = time.time()
    243233
    244 for t in domain.evolve(yieldstep = 240, finaltime = 7201):
    245     domain.write_time()
    246     domain.write_boundary_statistics(tags = 'top')     
    247 
    248 for t in domain.evolve(yieldstep = 120, finaltime = 12601
    249                        ,skip_initial_step = True):
    250     domain.write_time()
    251     domain.write_boundary_statistics(tags = 'top')     
    252 
    253 for t in domain.evolve(yieldstep = 60, finaltime = 19801
     234for t in domain.evolve(yieldstep = 240, finaltime = 7200):
     235    domain.write_time()
     236    domain.write_boundary_statistics(tags = 'top')     
     237
     238for t in domain.evolve(yieldstep = 240, finaltime = 12600
     239                       ,skip_initial_step = True):
     240    domain.write_time()
     241    domain.write_boundary_statistics(tags = 'top')     
     242
     243for t in domain.evolve(yieldstep = 240, finaltime = 19800
    254244                       ,skip_initial_step = True):
    255245    domain.write_time()
    256246    domain.write_boundary_statistics(tags = 'top')     
    257247   
    258 for t in domain.evolve(yieldstep = 120, finaltime = 25201
    259                        ,skip_initial_step = True):
    260     domain.write_time()
    261     domain.write_boundary_statistics(tags = 'top')     
    262 
    263 for t in domain.evolve(yieldstep = 240, finaltime = 36001
     248for t in domain.evolve(yieldstep = 240, finaltime = 25200
     249                       ,skip_initial_step = True):
     250    domain.write_time()
     251    domain.write_boundary_statistics(tags = 'top')     
     252
     253for t in domain.evolve(yieldstep = 240, finaltime = 36000
    264254                       ,skip_initial_step = True):
    265255    domain.write_time()
Note: See TracChangeset for help on using the changeset viewer.