Changeset 3276 for production/onslow_2006/run_onslow.py
- Timestamp:
- Jul 4, 2006, 2:51:19 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
production/onslow_2006/run_onslow.py
r3264 r3276 18 18 import os 19 19 import time 20 from shutil import copy 21 from os import mkdir, access, F_OK 22 import sys 20 23 21 24 # Related major packages … … 25 28 from pyvolution.combine_pts import combine_rectangular_points_files 26 29 from pyvolution.pmesh2domain import pmesh_to_domain_instance 27 #from geospatial_data import add_points_files 30 from geospatial_data import * 31 from pyvolution.util import Screen_Catcher 28 32 29 33 # Application specific imports 30 34 import 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 #------------------------------------------------------------------------------- 59 40 60 41 # creates copy of code in output dir if dir doesn't exist … … 74 55 sys.stderr = Screen_Catcher(screen_error_name) 75 56 57 print '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 68 onshore_dem_name = project.onshore_dem_name 69 islands_dem_name = project.islands_dem_name 70 coast_points = project.coast_dem_name 71 offshore_points = project.offshore_dem_name 72 meshname = project.meshname+'.msh' 73 source_dir = project.boundarydir 76 74 77 75 copied_files = False … … 80 78 files_used = [onshore_dem_name, offshore_points, coast_points,] 81 79 82 if sys.platform != 'win32':83 copied_files = True84 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_basename90 91 '''92 80 # fine data (clipping the points file to smaller area) 93 81 # creates DEM from asc data … … 110 98 print'create G1' 111 99 G1 = Geospatial_data(file_name = project.offshore_dem_name + '.xya') 112 113 100 print'create G2' 114 101 G2 = Geospatial_data(file_name = project.onshore_dem_name + '.pts') 115 116 102 print'create G3' 117 103 G3 = Geospatial_data(file_name = project.coast_dem_name + '.xya') 118 119 104 print'create G4' 120 105 G4 = Geospatial_data(file_name = project.islands_dem_name + '.pts') 121 122 106 print'add G1+G2+G3+G4' 123 107 G = G1 + G2 + G3 + G4 124 125 108 print'export G' 126 109 G.export_points_file(project.combined_dem_name + '.pts') 127 128 110 129 111 #------------------------------------------------------------------------------- … … 134 116 135 117 from 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 144 119 #new 145 region_res = 2 5000146 coast_res = 2500 147 onslow_res = 500 120 region_res = 200000 121 coast_res = 25000 122 onslow_res = 5000 148 123 interior_regions = [[project.poly_onslow, onslow_res], 149 124 [project.poly_coast, coast_res], … … 181 156 domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum']) 182 157 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 199 159 #------------------------------------------------------------------------------- 200 160 # Setup initial conditions … … 253 213 'inverted_bathymetry': True}, 254 214 #evaluate = True, 255 verbose = True,256 dependencies = source_dir + project.boundary_basename + '.sww')215 verbose = True, 216 dependencies = source_dir + project.boundary_basename + '.sww') 257 217 258 218 … … 270 230 271 231 domain.set_boundary( {'top': Bf, 'topleft': Bf, 272 273 232 'topleft1': Bf, 'bottomleft': Bd, 233 'bottom': Br, 'bottomright': Br, 'topright': Bd} ) 274 234 275 235 #------------------------------------------------------------------------------- … … 279 239 t0 = time.time() 280 240 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 = 17760286 ,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 = 36000241 for t in domain.evolve(yieldstep = 240, finaltime = 7200): 242 domain.write_time() 243 domain.write_boundary_statistics(tags = 'top') 244 245 for 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 250 for t in domain.evolve(yieldstep = 60, finaltime = 19800 291 251 ,skip_initial_step = True): 292 252 domain.write_time() 293 253 domain.write_boundary_statistics(tags = 'top') 294 254 295 255 for 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 260 for 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 296 265 print 'That took %.2f seconds' %(time.time()-t0) 297 266
Note: See TracChangeset
for help on using the changeset viewer.