Changeset 3905
- Timestamp:
- Nov 1, 2006, 5:01:22 PM (18 years ago)
- Location:
- anuga_work/production/dampier_2006
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/production/dampier_2006/build_dampier.py
r3877 r3905 69 69 #------------------------------------------------------------------------------- 70 70 71 ''' 71 72 # topography directory filenames 72 73 onshore_dir_name = project.onshore_dir_name … … 138 139 mkdir (project.topographies_time_dir) 139 140 G.export_points_file(project.combined_time_dir_name + '.pts') 140 141 ''' 141 142 #------------------------------------------------------------------------- 142 143 # Convert URS to SWW file for boundary conditions … … 149 150 print 'minlat=project.north_boundary, maxlat=project.south_boundary',project.north_boundary, project.south_boundary 150 151 print 'minlon= project.west_boundary, maxlon=project.east_boundary',project.west_boundary, project.east_boundary 152 print ' maxlon=project.east',project.east 153 154 #import sys; sys.exit() 151 155 152 156 if access(project.boundaries_time_dir,F_OK) == 0: 153 157 mkdir (project.boundaries_time_dir) 158 ''' 154 159 urs2sww(boundaries_in_dir_name,basename_out= project.boundaries_time_dir_name, 155 160 minlat=project.south_boundary, maxlat=project.north_boundary, … … 157 162 mint=0, maxt= 35000, 158 163 verbose='true') 164 165 166 urs2sww(boundaries_in_dir_name, basename_out= project.boundaries_time_dir_name, 167 # minlat=project.south, maxlat=project.north, 168 # minlon= project.west, maxlon=project.east, 169 minlat=project.south_boundary, maxlat=project.north_boundary, 170 minlon= project.east_boundary, maxlon=project.west_boundary, 171 mint=0, maxt= 35000, 172 verbose='true') 159 173 ''' 160 174 from caching import cache … … 163 177 project.boundaries_time_dir_name), 164 178 {'verbose': True, 165 'minlat': project.south_boundary, 166 'maxlat': project.north_boundary, 167 'minlon': project.west_boundary, 168 'maxlon': project.east_boundary, 179 # 'minlat': project.south_boundary, 180 # 'maxlat': project.north_boundary, 181 # 'minlon': project.west_boundary, 182 # 'maxlon': project.east_boundary, 183 # 'minlat': project.south, 184 # 'maxlat': project.north, 185 # 'minlon': project.west, 186 # 'maxlon': project.east, 169 187 'mint': 0, 'maxt': 35000, 170 188 # 'origin': domain.geo_reference.get_origin(), … … 175 193 ) 176 194 # dependencies = source_dir + project.boundary_basename + '.sww') 177 '''178 179 180 181 182 183 184 185 195 196 197 198 199 200 201 202 203 -
anuga_work/production/dampier_2006/project.py
r3885 r3905 10 10 convert_from_latlon_to_utm 11 11 12 from time import localtime, strftime, gmtime 12 from time import localtime, strftime, gmtime, ctime 13 13 from anuga.geospatial_data.geospatial_data import * 14 from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area 14 15 15 16 # file and system info … … 35 36 36 37 #mesh_name = 'elevation50m' 37 boundaries_name = 'dampier '38 boundaries_name = 'dampier1' 38 39 boundaries_source = 'mag_9_corrected' 40 #boundaries_source = 'test' 39 41 40 42 tide = 2.4 43 #tide = 0.0 41 44 42 45 # topography file names … … 76 79 time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir 77 80 gtime = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir 81 #cctime = strftime('%Y%m%d_%H%M%S',ctime()) #gets time for new dir 78 82 build_time = time+'_build' 79 83 run_time = time+'_run' 80 84 81 85 print 'gtime: ', gtime 86 #print 'ctime: ', cctime 82 87 83 88 output_build_time_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'outputs'+sep+build_time+sep … … 86 91 boundaries_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'boundaries'+sep 87 92 boundaries_time_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'boundaries'+sep+build_time+sep 93 meshes_time_dir = meshes_dir+build_time+sep 88 94 89 95 #ideas … … 117 123 118 124 meshes_dir_name = meshes_dir + scenario_name 119 125 meshes_time_dir_name = meshes_time_dir + scenario_name 120 126 #output_build_time_dir_name = output_build_time_dir + scenario_name #Used by post processing 121 127 output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing … … 136 142 137 143 #only used to clip boundary condition 138 north_boundary = north + 0.02 139 south_boundary = south - 0.02 140 west_boundary = west - 0.02 141 east_boundary = east + 0.02 144 #north_boundary = north + 0.02 145 #south_boundary = south - 0.02 146 #west_boundary = west - 0.02 147 #east_boundary = east + 0.02 148 149 south_boundary = degminsec2decimal_degrees(-21,0,0) 150 #north_boundary = degminsec2decimal_degrees(-19,00,0) 151 north_boundary = degminsec2decimal_degrees(-20,10,0) 152 #west_boundary = degminsec2decimal_degrees(116,0,0) 153 #east_boundary = degminsec2decimal_degrees(118,00,0) 154 west_boundary = degminsec2decimal_degrees(116,10,0) 155 east_boundary = degminsec2decimal_degrees(117,15,0) 142 156 143 157 … … 153 167 154 168 bounding_polygon, zone =\ 155 convert_from_latlon_to_utm([p0, p1, p2, p3, p4, 156 p5, p6, p7, p8]) 169 convert_from_latlon_to_utm([p0, p1, p2, p3, p4,p5, p6, p7, p8]) 170 #bounding_polygon, zone =\ 171 # convert_from_latlon_to_utm([p1, p2, p3, p4, p5, p6, p7]) 157 172 refzone = zone 158 159 173 160 174 #Interior regions … … 177 191 n_min_area = 7719000 178 192 n_max_area = 7725000 193 194 poly_facility = read_polygon(polygons_dir+'facility.csv') 195 196 poly_pipeline = read_polygon(polygons_dir+'pipeline.csv') 179 197 180 198 #Interior regions -
anuga_work/production/dampier_2006/run_dampier.py
r3885 r3905 34 34 from anuga.geospatial_data.geospatial_data import * 35 35 from anuga.abstract_2d_finite_volumes.util import Screen_Catcher 36 from anuga_parallel.parallel_api import distribute, numprocs, myid 36 from anuga_parallel.parallel_api import distribute, numprocs, myid, barrier 37 37 38 38 # Application specific imports 39 39 import project # Definition of file names and polygons 40 40 41 42 43 41 #------------------------------------------------------------------------------ 44 42 # Copy scripts to time stamped output directory and capture screen … … 48 46 # filenames 49 47 50 build_time = '20061029_231935_build_tide_24' 48 #build_time = '20061029_231935_build_tide_24' 49 build_time = '20061030_165746_build_tide_24' 50 #build_time = '20061025_153643_build_basic' 51 51 52 boundaries_name = project.boundaries_name 52 meshes_ dir_name = project.meshes_dir_name+'.msh'53 meshes_time_dir_name = project.meshes_time_dir_name+'.msh' 53 54 #source_dir = project.boundarydir 54 boundaries_time_dir_name = project.boundaries_dir + build_time + sep + boundaries_name 55 #boundaries_time_dir_name = project.boundaries_dir + build_time + sep + boundaries_name 56 boundaries_time_dir_name = project.boundaries_time_dir_name 57 tide = project.tide 55 58 56 59 # # creates copy of code in output dir if dir doesn't exist … … 63 66 copy (__file__, project.output_run_time_dir + basename(__file__)) 64 67 print 'project.output_run_time_dir',project.output_run_time_dir 65 68 barrier() 66 69 #normal screen output is stored in 67 70 screen_output_name = project.output_run_time_dir + "screen_output_%d_%d.txt" %(myid,numprocs) … … 73 76 74 77 print 'USER: ', project.user 75 76 78 77 79 #-------------------------------------------------------------------------- … … 82 84 #-------------------------------------------------------------------------- 83 85 84 interior_regions = [#[project.karratha_polygon, 25000], 85 [project.cipma_polygon, 50000]] 86 87 print 'start create mesh from regions' 88 meshes_dir_name = project.meshes_dir_name + '.msh' 89 create_mesh_from_regions(project.bounding_polygon, 86 if myid == 0: 87 if access(project.meshes_time_dir,F_OK) == 0: 88 mkdir(project.meshes_time_dir) 89 print 'start create mesh from regions' 90 interior_regions = [#[project.karratha_polygon, 25000], 91 # [project.cipma_polygon, 1000], 92 [project.poly_pipeline, 1000], 93 [project.poly_facility, 10000]] 94 # meshes_dir_name = project.meshes_dir_name + '.msh' 95 96 create_mesh_from_regions(project.bounding_polygon, 90 97 boundary_tags={'back': [7, 8], 'side': [0, 6], 91 98 'ocean': [1, 2, 3, 4, 5]}, 92 maximum_triangle_area= 300000,99 maximum_triangle_area=100000, 93 100 interior_regions=interior_regions, 94 filename=meshes_ dir_name,101 filename=meshes_time_dir_name, 95 102 use_cache=True, 96 103 verbose=True) 97 104 105 # to sync all processors are ready 106 barrier() 107 98 108 #------------------------------------------------------------------------- 99 109 # Setup computational domain 100 110 #------------------------------------------------------------------------- 101 111 print 'Setup computational domain' 102 domain = Domain(meshes_ dir_name, use_cache=True, verbose=True)112 domain = Domain(meshes_time_dir_name, use_cache=True, verbose=True) 103 113 print domain.statistics() 104 114 115 116 117 print 'starting to create boundary conditions' 118 boundaries_in_dir_name = project.boundaries_in_dir_name 119 120 from anuga.shallow_water.data_manager import urs2sww, ferret2sww 121 122 print 'maxlat=project.south_boundary, minlat=project.north_boundary', project.south_boundary,project.north_boundary 123 print 'minlon= project.west_boundary, maxlon=project.east_boundary',project.west_boundary, project.east_boundary 124 print ' maxlon=project.east',project.east 125 126 print 'origin: domain.geo_reference.get_origin()',domain.geo_reference.get_origin() 127 128 #import sys; sys.exit() 129 130 if access(project.boundaries_time_dir,F_OK) == 0: 131 mkdir (project.boundaries_time_dir) 132 # put above distribute 133 from caching import cache 134 cache(ferret2sww, 135 (boundaries_in_dir_name, 136 boundaries_time_dir_name), 137 {'verbose': True, 138 'minlat': project.south_boundary, 139 'maxlat': project.north_boundary, 140 'minlon': project.west_boundary, 141 'maxlon': project.east_boundary, 142 # 'minlat': project.south, 143 # 'maxlat': project.north, 144 # 'minlon': project.west, 145 # 'maxlon': project.east, 146 'mint': 0, 'maxt': 35000, 147 'origin': domain.geo_reference.get_origin(), 148 'mean_stage': project.tide, 149 # 'zscale': 1, #Enhance tsunami 150 'fail_on_NaN': False}, 151 verbose = True, 152 ) 153 154 155 105 156 #------------------------------------------------------------------------- 106 157 # Setup initial conditions 107 158 #------------------------------------------------------------------------- 108 tide = project.tide 159 print 'Setup initial conditions' 160 109 161 domain.set_quantity('stage', tide) 110 162 domain.set_quantity('friction', 0.0) 111 163 #combined_time_dir_name = project.topographies_dir+build_time+project.combined_name 164 print 'Start Set quantity' 165 112 166 domain.set_quantity('elevation', 113 167 filename = project.topographies_dir + build_time + sep + project.combined_name + '.pts', … … 115 169 verbose = True, 116 170 alpha = 0.1) 171 #domain.set_quantity('elevation', -50) 172 print 'Finished Set quantity' 173 174 117 175 118 176 #------------------------------------------------------ … … 135 193 # Setup boundary conditions 136 194 #------------------------------------------------------------------------- 137 138 139 195 print 'Available boundary tags', domain.get_boundary_tags() 140 196 141 197 print 'Reading Boundary file' 198 #boundariesname = project.boundaries_dir + '20061101_003322_build'+sep+boundaries_name 199 #print'boundariesname',boundariesname 142 200 Bf = File_boundary(boundaries_time_dir_name + '.sww', 143 domain, verbose = True) 201 202 #Bf = File_boundary(boundariesname + '.sww', 203 domain, time_thinning=20, use_cache=True, verbose=True) 204 205 print 'finished reading boundary file' 206 144 207 Br = Reflective_boundary(domain) 145 208 Bd = Dirichlet_boundary([tide,0,0]) 209 210 print'set_boundary' 146 211 domain.set_boundary({'back': Br, 147 212 'side': Bd, 148 213 'ocean': Bf}) 214 print'finish set boundary' 215 149 216 150 217 #---------------------------------------------------------------------------- 151 218 # Evolve system through time 152 219 #---------------------------------------------------------------------------- 153 import time 220 154 221 t0 = time.time() 155 222 156 for t in domain.evolve(yieldstep = 120, finaltime = 28800): 223 for t in domain.evolve(yieldstep = 60, finaltime = 28800): 224 #for t in domain.evolve(yieldstep = 120, finaltime = 28800): 157 225 domain.write_time() 158 domain.write_boundary_statistics(tags = 'ocean')226 # domain.write_boundary_statistics(tags = 'ocean') 159 227 160 228 print 'That took %.2f seconds' %(time.time()-t0)
Note: See TracChangeset
for help on using the changeset viewer.