Changeset 2292 for production/sydney_2006
- Timestamp:
- Jan 26, 2006, 10:40:35 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
production/sydney_2006/run_sydney_smf.py
r2240 r2292 21 21 from pyvolution.data_manager import convert_dem_from_ascii2netcdf,\ 22 22 dem2pts 23 from pyvolution.pmesh2domain import pmesh_to_domain_instance 23 from pyvolution.pmesh2domain import pmesh_to_domain_instance 24 from pyvolution.combine_pts import combine_rectangular_points_files 24 25 from caching import cache 25 26 import project 26 27 from math import pi, sin 27 28 from smf import slump_tsunami, slide_tsunami, Double_gaussian 28 29 #Data preparation 30 #Convert ASC 2 DEM 2 PTS using source data and store result in source data 31 demname = project.demname 29 from pyvolution.least_squares import fit_to_mesh_file, DEFAULT_ALPHA 30 31 # Data preparation 32 # Convert ASC 2 DEM 2 PTS using source data and store result in source data 33 # Do for coarse and fine data 34 # Fine pts file to be clipped to area of interest 35 coarsedemname = project.coarsedemname 36 finedemname = project.finedemname 32 37 meshname = project.meshname+'.msh' 33 38 34 cache(convert_dem_from_ascii2netcdf, demname, {'verbose': True}, 35 dependencies = [demname + '.asc'], 39 # coarse data 40 cache(convert_dem_from_ascii2netcdf, coarsedemname, {'verbose': True}, 41 dependencies = [coarsedemname + '.asc'], 36 42 verbose = True) 37 43 #evaluate = True) 38 44 39 cache(dem2pts, demname, {'verbose': True}, 40 dependencies = [demname + '.dem'], 41 verbose = True) 42 43 #this allows the user to switch between different clipping polygons 44 #print 'Which total zone are you interested in?' 45 #mytest = int(raw_input('0 = all, 1 = harbour and 2 = botany bay ')) 45 cache(dem2pts, coarsedemname, {'verbose': True}, 46 dependencies = [coarsedemname + '.dem'], 47 verbose = True) 48 49 # fine data 50 cache(convert_dem_from_ascii2netcdf, finedemname, {'verbose': True}, 51 dependencies = [finedemname + '.asc'], 52 verbose = True) 53 #evaluate = True) 54 55 # clipping the fine data 56 cache(dem2pts, finedemname, {'verbose': True, 57 'easting_min': project.eastingmin, 58 'easting_max': project.eastingmax, 59 'northing_min': project.northingmin, 60 'northing_max': project.northingmax}, 61 dependencies = [finedemname + '.dem'], 62 #evaluate = True, 63 verbose = True) 64 65 # combining the coarse and fine data 66 combine_rectangular_points_files(project.finedemname + '.pts', 67 project.coarsedemname + '.pts', 68 project.combineddemname + '.pts') 69 70 # this allows the user to switch between different clipping polygons 71 # print 'Which total zone are you interested in?' 72 # mytest = int(raw_input('0 = all, 1 = harbour and 2 = botany bay ')) 46 73 47 74 mytest = 0 48 75 49 #Create Triangular Mesh 76 # Create Triangular Mesh 77 # Overall clipping polygon and interior regions defined in project.py 50 78 from pmesh.create_mesh import create_mesh_from_regions 51 79 52 80 if mytest == 0: 53 81 # for whole region 54 #south = project.south 55 #north = project.north 56 #west = project.west 57 #east = project.east 58 59 interior_regions = [[project.harbour_polygon_2, 25000], 60 [project.botanybay_polygon_2, 25000]] # maximal area of per triangle 61 62 # meshname = project.meshname + 'all.msh' 82 interior_res = 2000 # run at 2000 for final one 83 interior_regions = [[project.harbour_polygon_2, interior_res], 84 [project.botanybay_polygon_2, interior_res]] # maximal area of per triangle 63 85 64 86 m = cache(create_mesh_from_regions, 65 #project.polygonall,66 87 project.diffpolygonall, 67 {'boundary_tags': {'bottom': [0], 'top': [4], 68 'right': [1], 'left1': [5], 69 'left2': [6], 'left3': [7], 88 {'boundary_tags': {'bottom': [0], 70 89 'right1': [1], 'right0': [2], 71 'right2': [3]}, 90 'right2': [3], 'top': [4], 'left1': [5], 91 'left2': [6], 'left3': [7]}, 72 92 'resolution': 100000, 73 93 'filename': meshname, … … 76 96 verbose = True) 77 97 #import sys; sys.exit() 78 79 #Setup domain 80 98 99 #Add elevation data to the mesh - this is in place of set_quantity 100 mesh_elevname = 'elevation.msh' 101 cache(fit_to_mesh_file,(meshname, 102 #project.finedemname + '.pts', 103 #project.coarsedemname + '.pts', 104 project.combineddemname + '.pts', 105 mesh_elevname, 106 DEFAULT_ALPHA), 107 {'verbose': True, 'expand_search': True, 'precrop': True}, 108 dependencies = [meshname], 109 #evaluate = True, 110 verbose = False) 111 meshname = mesh_elevname 112 113 # Setup domain 81 114 domain = cache(pmesh_to_domain_instance, (meshname, Domain), 82 115 dependencies = [meshname], … … 86 119 print 'The extent is ', domain.get_extent() 87 120 88 #outputfilename = basename + '_slump'89 90 121 domain.set_name(project.basename) 91 #domain.set_name(project.outfilename)92 122 domain.set_datadir(project.outputdir) 93 123 domain.store = True 94 95 #domain.quantities_to_be_stored = ['stage', 'xmomentum', 'ymomentum'] 96 domain.quantities_to_be_stored = ['stage'] 124 #domain.quantities_to_be_stored = ['stage'] 125 domain.quantities_to_be_stored = ['stage', 'xmomentum', 'ymomentum'] 97 126 98 127 #print 'Do you want to run the slump scenario?' … … 102 131 103 132 if q2 == 0: 104 # slump parameters105 # as advised by Adrian, this can be as much as 15000-30000 metres133 # slump parameters 134 # as advised by Adrian, this can be as much as 15000-30000 metres 106 135 # len = 4500.0 107 136 len = 15000.0 108 137 thk = 670 #thk = 760.0 109 #wid = 4500.0110 138 wid = 15000.0 # for slump scenario, wid=len 111 dep = 1000.0 #d = 1200 139 #dep = 400 #1000.0 #d = 400 doesn't make sense with thk = 670! 140 dep = 1000.0 112 141 rad = 3330 113 142 dp = 0.23 114 143 th = 6 115 144 alpha = 0.0 145 x0 = project.x0 146 y0 = project.y0 116 147 # slide parameters 117 148 # len = 10000.0 … … 119 150 # thk = 200.0 120 151 # th = 12 121 x0 = project.x0 122 y0 = project.y0 123 alpha = 0.0 124 ###################### 125 # Slump Initial conditions 152 # Slump or Slide Initial conditions 126 153 t = slump_tsunami(length=len, depth=dep, slope=th, thickness=thk, \ 127 154 radius=rad, dphi=dp, x0=x0, y0=y0, alpha=alpha) 128 155 #t = slide_tsunami(length=len, depth=dep, slope=th, thickness=thk, \ 129 156 # x0=x0, y0=y0, alpha=alpha) 130 domain.set_quantity('stage', t )157 domain.set_quantity('stage', t, verbose = True) 131 158 132 159 if q2 == 1: … … 136 163 # These quantities are the same regardless of the initial condition 137 164 domain.set_quantity('friction', 0) 138 domain.set_quantity('elevation', 139 filename = demname + '.pts', 140 use_cache = True, 141 verbose = True) 165 142 166 143 167 # Setup Boundary Conditions … … 151 175 f=lambda t: [(6<t<606)*6, 0, 0]) 152 176 177 # for slump scenario 178 if q2 == 0: 179 domain.set_boundary( {'bottom': Br, 'right1': Br, 'right0': Br, 180 'right2': Br, 'top': Br, 'left1': Br, 181 'left2': Br, 'left3': Br} ) 182 153 183 # for square wave scenario 154 184 if q2 == 1: 155 185 domain.set_boundary( {'top': Br, 'bottom': Br, 'right': Bw, 'left': Br} ) 156 186 157 # for slump scenario158 if q2 == 0:159 domain.set_boundary( {'top': Br, 'bottom': Br, 'right0': Br,160 'left1': Br, 'left2': Br, 'left3': Br,161 'right1': Br, 'right2': Br} )162 163 187 # Evolve 164 188 import time 165 189 t0 = time.time() 166 190 167 for t in domain.evolve(yieldstep = 1 00, finaltime = 10400):191 for t in domain.evolve(yieldstep = 120, finaltime = 10800): #120 10800 = 3hrs 168 192 domain.write_time() 169 193 domain.write_boundary_statistics(tags = 'bottom') #quantities = 'stage') 170 # domain.write_boundary_statistics(tags = 'bottom') #quantities = 'stage')171 194 172 195 print 'That took %.2f seconds' %(time.time()-t0) 196 197 ############################################################# 198 # testing system on a smaller mesh 199 #m = create_mesh_from_regions(project.harbour_polygon, 200 # boundary_tags={'bottom': [0], 'top': [2], 201 # 'right': [1], 'left': [3]}, 202 # resolution=100000, filename=meshname) 203 204 # This section replaced with fit_to_mesh_file above 205 #domain.set_quantity('elevation', 206 # #filename = project.combineddemname + '.pts', 207 # filename = project.finedemname + '.pts', 208 #filename = project.datadir + 'bathy_land25_orig.pts', 209 # use_cache = True, 210 # verbose = True) 211 173 212 174 213 # for switching between overall clipping regions - NOT USED
Note: See TracChangeset
for help on using the changeset viewer.