Changeset 2640
- Timestamp:
- Mar 31, 2006, 1:29:48 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
production/sydney_2006/run_sydney_smf.py
r2537 r2640 20 20 21 21 # Related major packages 22 from pyvolution.shallow_water import Domain, Reflective_boundary 22 from pyvolution.shallow_water import Domain, Reflective_boundary, Dirichlet_boundary 23 23 from pyvolution.data_manager import convert_dem_from_ascii2netcdf, dem2pts 24 #from pyvolution.data_manager_old import convert_dem_from_ascii2netcdf, dem2pts 24 25 from pyvolution.combine_pts import combine_rectangular_points_files 25 26 from pyvolution.pmesh2domain import pmesh_to_domain_instance 27 from pyvolution.quantity import Quantity 28 from Numeric import allclose 26 29 27 30 # Application specific imports … … 57 60 verbose=True) 58 61 59 60 62 # combining the coarse and fine data 61 63 combine_rectangular_points_files(project.finedemname + '.pts', … … 64 66 65 67 #from pmesh.create_mesh import create_mesh_from_regions 66 # 68 #new interface 67 69 from pmesh.mesh_interface import create_mesh_from_regions 68 70 69 # original 70 interior_res = 5000 71 interior_regions = [[project.harbour_polygon_2, interior_res], 72 [project.botanybay_polygon_2, interior_res]] 71 # original issue to Benfield 72 #interior_res = 5000 73 #interior_regions = [[project.harbour_polygon_2, interior_res], 74 # [project.botanybay_polygon_2, interior_res]] 75 76 # used for finer mesh 77 interior_res1 = 5000 78 interior_res2 = 315 79 interior_regions = [[project.newpoly1, interior_res1], 80 [project.south1, interior_res1], 81 [project.finepolymanly, interior_res2], 82 [project.finepolyquay, interior_res2]] 83 84 print 'number of interior regions', len(interior_regions) 73 85 74 86 #FIXME: Fix caching of this one once the mesh_interface is ready 75 87 from caching import cache 76 88 89 # original + refined region 77 90 _ = cache(create_mesh_from_regions, 78 91 project.diffpolygonall, … … 86 99 verbose = True) 87 100 88 89 #----------------------------------------------------------------------------- 101 #------------------------------------------------------------------------------- 90 102 # Setup computational domain 91 #----------------------------------------------------------------------------- 103 #------------------------------------------------------------------------------- 92 104 93 105 domain = pmesh_to_domain_instance(meshname, Domain, … … 97 109 print 'Number of triangles = ', len(domain) 98 110 print 'The extent is ', domain.get_extent() 111 print domain.statistics() 99 112 100 113 domain.set_name(project.basename) … … 119 132 120 133 121 #------------------------------------------------------------------------------ 134 #------------------------------------------------------------------------------- 122 135 # Setup initial conditions 123 136 #------------------------------------------------------------------------------- 124 137 125 domain.set_quantity('stage', tsunami_source) 126 domain.set_quantity('friction', 0.0) 138 # apply slump after 30 mins, initialise to water level of tide = 0 139 domain.set_quantity('stage', 0.0) 140 domain.set_quantity('friction', 0.03) 127 141 domain.set_quantity('elevation', 128 142 filename = project.combineddemname + '.pts', … … 138 152 139 153 Br = Reflective_boundary(domain) 140 domain.set_boundary( {'bottom': Br, 'right1': Br, 'right0': Br, 141 'right2': Br, 'top': Br, 'left1': Br, 142 'left2': Br, 'left3': Br} ) 154 Bd = Dirichlet_boundary([0, 0, 0]) 155 156 # original + refined regions 157 #domain.set_boundary( {'bottom': Br, 'right1': Br, 'right0': Br, 158 # 'right2': Br, 'top': Br, 'left1': Br, 159 # 'left2': Br, 'left3': Br} ) 160 161 # enforce Dirichlet BC - from 30/03/06 Benfield visit 162 domain.set_boundary( {'bottom': Bd, 'right1': Bd, 'right0': Bd, 163 'right2': Bd, 'top': Bd, 'left1': Bd, 164 'left2': Bd, 'left3': Bd} ) 165 166 # increasingly finer interior regions 167 #domain.set_boundary( {'bottom': Br, 'right': Br, 'left': Br, 'top': Br} ) 143 168 144 169 … … 149 174 import time 150 175 t0 = time.time() 176 thisfile = project.integraltimeseries+'.csv' 177 fid = open(thisfile, 'w') 151 178 152 for t in domain.evolve(yieldstep = 120, finaltime = 18000): 179 for t in domain.evolve(yieldstep = 120, finaltime = 18000): 153 180 domain.write_time() 154 domain.write_boundary_statistics(tags = 'bottom') 181 domain.write_boundary_statistics(tags = 'bottom') 182 183 # calculate integral 184 thisstagestep = domain.get_quantity('stage') 185 s = '%.2f, %.2f\n' %(t, thisstagestep.get_integral()) 186 fid.write(s) 187 188 # add slump after 30 mins 189 if allclose(t, 30*60): 190 slump = Quantity(domain) 191 slump.set_values(tsunami_source) 192 domain.set_quantity('stage', slump + thisstagestep) 193 155 194 156 195 print 'That took %.2f seconds' %(time.time()-t0)
Note: See TracChangeset
for help on using the changeset viewer.