Ignore:
Timestamp:
Jul 4, 2006, 2:51:19 PM (18 years ago)
Author:
sexton
Message:

update run_onslow

File:
1 edited

Legend:

Unmodified
Added
Removed
  • production/onslow_2006/run_onslow.py

    r3264 r3276  
    1818import os
    1919import time
     20from shutil import copy
     21from os import mkdir, access, F_OK
     22import sys
    2023
    2124# Related major packages
     
    2528from pyvolution.combine_pts import combine_rectangular_points_files
    2629from pyvolution.pmesh2domain import pmesh_to_domain_instance
    27 #from geospatial_data import add_points_files
     30from geospatial_data import *
     31from pyvolution.util import Screen_Catcher
    2832
    2933# Application specific imports
    3034import project                 # Definition of file names and polygons
    31 from smf import slump_tsunami  # Function for submarine mudslide
    32 
    33 from shutil import copy
    34 from os import mkdir, access, F_OK
    35 
    36 from geospatial_data import *
    37 import sys
    38 from pyvolution.util import Screen_Catcher
    39 
    40 #-------------------------------------------------------------------------------
    41 # Preparation of topographic data
    42 #
    43 # Convert ASC 2 DEM 2 PTS using source data and store result in source data
    44 # Do for coarse and fine data
    45 # Fine pts file to be clipped to area of interest
    46 #-------------------------------------------------------------------------------
    47 
    48 # filenames
    49 #coarsedemname = project.coarsedemname
    50 
    51 onshore_dem_name = project.onshore_dem_name
    52 islands_dem_name = project.islands_dem_name
    53 coast_points = project.coast_dem_name
    54 offshore_points = project.offshore_dem_name
    55 
    56 meshname = project.meshname+'.msh'
    57 
    58 source_dir = project.boundarydir
     35
     36#-------------------------------------------------------------------------------
     37# Copy scripts to time stamped output directory and capture screen
     38# output to file
     39#-------------------------------------------------------------------------------
    5940
    6041# creates copy of code in output dir if dir doesn't exist
     
    7455sys.stderr = Screen_Catcher(screen_error_name)
    7556
     57print 'USER:    ', project.user
     58
     59#-------------------------------------------------------------------------------
     60# Preparation of topographic data
     61#
     62# Convert ASC 2 DEM 2 PTS using source data and store result in source data
     63# Do for coarse and fine data
     64# Fine pts file to be clipped to area of interest
     65#-------------------------------------------------------------------------------
     66
     67# filenames
     68onshore_dem_name = project.onshore_dem_name
     69islands_dem_name = project.islands_dem_name
     70coast_points = project.coast_dem_name
     71offshore_points = project.offshore_dem_name
     72meshname = project.meshname+'.msh'
     73source_dir = project.boundarydir
    7674
    7775copied_files = False
     
    8078files_used = [onshore_dem_name, offshore_points, coast_points,]
    8179
    82 if sys.platform != 'win32':   
    83     copied_files = True
    84     for name in file_list:
    85         copy(name, )
    86 '''   
    87 #print' most file', project.MOST_dir + project.boundary_basename+'_ha.nc'
    88 #if access(project.MOST_dir + project.boundary_basename+'_ha.nc',F_OK) == 1 :
    89 #    print' most file', project.MOST_dir + project.boundary_basename
    90 
    91 '''
    9280# fine data (clipping the points file to smaller area)
    9381# creates DEM from asc data
     
    11098print'create G1'
    11199G1 = Geospatial_data(file_name = project.offshore_dem_name + '.xya')
    112 
    113100print'create G2'
    114101G2 = Geospatial_data(file_name = project.onshore_dem_name + '.pts')
    115 
    116102print'create G3'
    117103G3 = Geospatial_data(file_name = project.coast_dem_name + '.xya')
    118 
    119104print'create G4'
    120105G4 = Geospatial_data(file_name = project.islands_dem_name + '.pts')
    121 
    122106print'add G1+G2+G3+G4'
    123107G = G1 + G2 + G3 + G4
    124 
    125108print'export G'
    126109G.export_points_file(project.combined_dem_name + '.pts')
    127 
    128110
    129111#-------------------------------------------------------------------------------                                 
     
    134116
    135117from pmesh.mesh_interface import create_mesh_from_regions
    136 '''
    137 # original
    138 interior_res = 5000
    139 high_res = 1500
    140 interior_regions = [[project.poly_onslow, high_res],
    141                     [project.poly_thevenard, interior_res],
    142                     [project.poly_coast, interior_res]]
    143 '''
     118
    144119#new
    145 region_res = 25000
    146 coast_res = 2500
    147 onslow_res = 500
     120region_res = 200000
     121coast_res = 25000
     122onslow_res = 5000
    148123interior_regions = [[project.poly_onslow, onslow_res],
    149124                    [project.poly_coast, coast_res],
     
    181156domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
    182157
    183 #-------------------------------------------------------------------------------
    184 # Set up scenario (tsunami_source is a callable object used with set_quantity)
    185 #-------------------------------------------------------------------------------
    186 '''
    187 tsunami_source = slump_tsunami(length=30000.0,
    188                                depth=400.0,
    189                                slope=6.0,
    190                                thickness=176.0,
    191                                radius=3330,
    192                                dphi=0.23,
    193                                x0=project.slump_origin[0],
    194                                y0=project.slump_origin[1],
    195                                alpha=0.0,
    196                                domain=domain)
    197 
    198 '''
     158
    199159#-------------------------------------------------------------------------------                                 
    200160# Setup initial conditions
     
    253213       'inverted_bathymetry': True},
    254214      #evaluate = True,
    255       verbose = True,
    256       dependencies = source_dir + project.boundary_basename + '.sww')
     215       verbose = True,
     216       dependencies = source_dir + project.boundary_basename + '.sww')
    257217
    258218
     
    270230
    271231domain.set_boundary( {'top': Bf, 'topleft': Bf,
    272                              'topleft1': Bf, 'bottomleft': Bd,
    273                              'bottom': Br, 'bottomright': Br, 'topright': Bd} )
     232                      'topleft1': Bf, 'bottomleft': Bd,
     233                      'bottom': Br, 'bottomright': Br, 'topright': Bd} )
    274234
    275235#-------------------------------------------------------------------------------                                 
     
    279239t0 = time.time()
    280240
    281 for t in domain.evolve(yieldstep = 450, finaltime = 10800):
    282     domain.write_time()
    283     domain.write_boundary_statistics(tags = 'top')     
    284 
    285 for t in domain.evolve(yieldstep = 1, finaltime = 17760
    286                        ,skip_initial_step = True):
    287     domain.write_time()
    288     domain.write_boundary_statistics(tags = 'top')     
    289 
    290 for t in domain.evolve(yieldstep = 480, finaltime = 36000
     241for t in domain.evolve(yieldstep = 240, finaltime = 7200):
     242    domain.write_time()
     243    domain.write_boundary_statistics(tags = 'top')     
     244
     245for t in domain.evolve(yieldstep = 120, finaltime = 12600
     246                       ,skip_initial_step = True):
     247    domain.write_time()
     248    domain.write_boundary_statistics(tags = 'top')     
     249
     250for t in domain.evolve(yieldstep = 60, finaltime = 19800
    291251                       ,skip_initial_step = True):
    292252    domain.write_time()
    293253    domain.write_boundary_statistics(tags = 'top')     
    294254   
    295  
     255for t in domain.evolve(yieldstep = 120, finaltime = 25200
     256                       ,skip_initial_step = True):
     257    domain.write_time()
     258    domain.write_boundary_statistics(tags = 'top')     
     259
     260for t in domain.evolve(yieldstep = 240, finaltime = 36000
     261                       ,skip_initial_step = True):
     262    domain.write_time()
     263    domain.write_boundary_statistics(tags = 'top')
     264   
    296265print 'That took %.2f seconds' %(time.time()-t0)
    297266
Note: See TracChangeset for help on using the changeset viewer.