Changeset 4525 for anuga_work
- Timestamp:
- Jun 1, 2007, 4:06:46 PM (17 years ago)
- Location:
- anuga_work/production
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/production/exmouth_2006/build_exmouth.py
r4509 r4525 81 81 dem2pts(onshore_dir_name, use_cache=True, verbose=True) 82 82 dem2pts(onshore1_dir_name, use_cache=True, verbose=True) 83 ''' 83 84 84 print'create Geospatial data1 objects from topographies',onshore_dir_name + '.pts' 85 85 G1 = Geospatial_data(file_name = onshore_dir_name + '.pts',verbose=True) … … 112 112 G_small.export_points_file(project.combined_small_dir_name + '.txt') 113 113 #G_clipped.export_points_file(project.combined_dir_name + '.xya') 114 ''' 114 115 115 116 116 … … 123 123 print'export 2' 124 124 G_all_2.export_points_file(project.combined_dir_name+'_other1' + '.xya') 125 125 ''' 126 126 127 127 #------------------------------------------------------------------------- … … 136 136 print 'project.boundaries_dir_name',project.boundaries_dir_name 137 137 138 urs_ungridded2sww(boundaries_in_dir_name, project.boundaries_in_dir_name,138 urs_ungridded2sww(boundaries_in_dir_name, boundaries_in_dir_name, 139 139 verbose=True, mint=4000, maxt=35000, zscale=1) 140 141 '''142 140 143 141 144 142 145 143 144 145 -
anuga_work/production/exmouth_2006/project.py
r4509 r4525 30 30 31 31 #tide = -1.4 32 #tide = 033 tide = 1.432 tide = 0 33 #tide = 1.4 34 34 35 35 #Maybe will try to make project a class to allow these parameters to be passed in. … … 38 38 starttime=3600 39 39 finaltime=25000 40 setup='store' 40 setup='final' 41 extra='exmouth' 41 42 42 43 if setup =='trial': … … 62 63 63 64 64 dir_comment='_'+setup+'_'+str(tide)+'_'+str( user)65 dir_comment='_'+setup+'_'+str(tide)+'_'+str(extra)+'_'+str(user) 65 66 66 67 onshore_name = 'DLI' … … 111 112 112 113 #boundaries locations 113 boundaries_name = 'exmouth_3854_17042007' 114 115 boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'dampier'+sep+'1_10000'+sep 114 #boundaries_name = 'exmouth_3854_17042007' #dampier 115 #boundaries_name = 'exmouth_3103_18052007' #exmouth 116 boundaries_name = 'exmouth_3859_16052007' #onslow 117 118 #boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'dampier'+sep+'1_10000'+sep 119 #boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'exmouth'+sep+'1_10000'+sep 120 boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'onslow_hedland_broome'+sep+'1_10000'+sep 116 121 boundaries_in_dir_name = boundaries_in_dir + boundaries_name 117 122 boundaries_dir = anuga_dir+'boundaries'+sep … … 121 126 output_dir = anuga_dir+'outputs'+sep 122 127 output_build_time_dir = output_dir+build_time+sep 123 output_run_time_dir = output_dir +run_time+dir_comment+sep 128 #output_run_time_dir = output_dir +run_time+dir_comment+sep 129 output_run_time_dir = output_dir +'20070528_061822_run_final_1.4_nbartzis'+sep 124 130 output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing 125 131 … … 132 138 community_exmouth = gauges_dir + 'community_exmouth.csv' 133 139 134 buildings_filename = 'Exmouth_res_Project.csv'135 buildings_filename_out = 'Exmouth_res_Project_modified.csv'140 buildings_filename = gauges_dir +'Exmouth_res_Project.csv' 141 buildings_filename_out = output_run_time_dir +'Exmouth_res_Project_modified.csv' 136 142 137 143 ############################### -
anuga_work/production/exmouth_2006/run_exmouth.py
r4509 r4525 37 37 from anuga_parallel.parallel_abstraction import get_processor_name 38 38 from anuga.caching import myhash 39 from anuga.damage_modelling.inundation_damage import add_depth_and_momentum2csv, inundation_damage 40 39 41 # Application specific imports 40 42 import project # Definition of file names and polygons … … 42 44 def run_model(**kwargs): 43 45 44 # tide = kwargs['tide']45 # alpha = kwargs['alpha']46 # friction = kwargs['friction']47 # time_thinning = kwargs['time_thinning']48 46 scenario_name = kwargs['aa_scenario_name'] 49 47 … … 67 65 # kwargs['bathy_file']=project.combined_small_dir_name + '.txt' 68 66 kwargs['boundary_file']=project.boundaries_in_dir_name + '.sww' 69 67 68 69 ''' 70 70 print 'output_dir',kwargs['output_dir'] 71 71 if myid == 0: … … 166 166 domain.set_store_vertices_uniquely(False) 167 167 domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum']) 168 domain.set_maximum_allowed_speed(0.1) # Allow a little runoff (0.1 is OK) 169 print 'domain id', id(domain) 170 domain.beta_h = 0 171 #domain.limit2007 = 1 168 #domain.set_maximum_allowed_speed(0.1) # Allow a little runoff (0.1 is OK) 169 #print 'domain id', id(domain) 170 domain.beta_h = 0 #sets the surface of the triangle to follow the bathy 171 #domain.H0=0.01 #controls the flux limiter (limiter2007) 172 #domain.limit2007 = 1 #minimises creep 172 173 173 174 #------------------------------------------------------------------------- … … 229 230 barrier() 230 231 231 export_grid(kwargs['aa_scenario_name'], extra_name_out = 'town', 232 quantities = ['elevation','stage'], # '(xmomentum**2 + ymomentum**2)**0.5' defaults to elevation 232 233 ''' 234 print'hello' 235 swwfile = kwargs['output_dir']+kwargs['aa_scenario_name'] 236 export_grid(swwfile, extra_name_out = 'town', 237 quantities = ['elevation','stage','speed'], # '(xmomentum**2 + ymomentum**2)**0.5' defaults to elevation 233 238 timestep = None, 234 239 reduction = max, … … 244 249 format = 'asc') 245 250 246 swwfile = kwargs['output_dir']+kwargs['aa_scenario_name']+'.sww'247 251 buildings_filename = project.buildings_filename 248 252 buildings_filename_out = project.buildings_filename_out 249 253 250 inundation_damage(swwfile, buildings_filename, buildings_filename_out) 251 print '\n Augmented building file written to %s \n' \ 252 %buildings_filename_out 254 inundation_damage(swwfile+'.sww', buildings_filename, buildings_filename_out) 255 print '\n Augmented building file written to %s \n' %buildings_filename_out 253 256 254 257 -
anuga_work/production/onslow_2006/build_onslow.py
r4432 r4525 151 151 152 152 print 'boundaries_in_dir_name',project_urs.boundaries_in_dir_name 153 print 'project.boundaries_dir_name',project_urs.boundaries_dir_name153 #print 'project.boundaries_dir_name',project_urs.boundaries_dir_name 154 154 155 urs_ungridded2sww(project_urs.boundaries_in_dir_name, project_urs.boundaries_ dir_name,155 urs_ungridded2sww(project_urs.boundaries_in_dir_name, project_urs.boundaries_in_dir_name, 156 156 verbose=True, mint=5000, maxt=34000, zscale=1) 157 157 -
anuga_work/production/onslow_2006/project_urs.py
r4477 r4525 18 18 host = get_host_name() 19 19 #needed when running using mpirun, mpirun doesn't inherit umask from .bashrc 20 umask(002)20 #umask(002) 21 21 22 22 … … 30 30 31 31 #tide = -1.5 32 #tide = 0.033 tide = 1.532 tide = 0.0 33 #tide = 1.5 34 34 35 35 #Maybe will try to make project a class to allow these parameters to be passed in. 36 res_factor=137 36 alpha = 0.1 38 37 friction=0.01 39 time_thinning=440 dir_comment='_final_'+str(tide)+'_'+str(user)41 38 starttime=3600 42 yieldstep=6043 39 finaltime=25000 44 40 setup='final' 41 extra='onslow' 42 43 if setup =='trial': 44 print'trial' 45 res_factor=10 46 time_thinning=48 47 yieldstep=240 48 if setup =='basic': 49 print'basic' 50 res_factor=4 51 time_thinning=12 52 yieldstep=120 53 if setup =='final': 54 print'final' 55 res_factor=1 56 time_thinning=1 57 yieldstep=60 58 if setup =='store': 59 print'store' 60 res_factor=10 61 time_thinning=48 62 yieldstep=240 63 64 dir_comment='_'+setup+'_'+str(tide)+'_'+str(extra)+'_'+str(user) 65 45 66 #Making assumptions about the location of scenario data 46 67 state = 'western_australia' … … 99 120 100 121 boundaries_source = '' 101 boundaries_name = 'onslow_3854_17042007' 122 #boundaries_name = 'onslow_3854_17042007' #Dampier gun 123 boundaries_name = 'onslow_3859_16052007' #onslow_hedland_broome gun 124 #boundaries_name = 'onslow_3103_18052007' #exmouth gun 102 125 103 126 #boundaries locations 104 127 #boundaries_in_dir = anuga_dir+'boundaries'+sep 105 boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'1_10000'+sep 128 #boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'1_10000'+sep 129 boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'onslow_hedland_broome'+sep+'1_10000'+sep 130 #boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'exmouth'+sep+'1_10000'+sep 106 131 boundaries_in_dir_name = boundaries_in_dir + boundaries_name 132 107 133 boundaries_dir = anuga_dir+'boundaries'+sep 108 134 boundaries_dir_name = boundaries_dir + boundaries_name … … 111 137 output_dir = anuga_dir+'outputs'+sep 112 138 output_build_time_dir = output_dir+build_time+sep 113 output_run_time_dir = output_dir +run_time+dir_comment+sep 139 #output_run_time_dir = output_dir +run_time+dir_comment+sep 140 output_run_time_dir = output_dir +'20070530_082920_run_final_1.5_nbartzis'+sep 114 141 output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing 115 142 … … 126 153 community_scenario = gauges_dir + 'community_onslow.csv' 127 154 buildings_filename = gauges_dir + 'Onslow_res_Project.csv' 128 buildings_filename_out = 'Onslow_res_Project_modified.csv'155 buildings_filename_out =output_run_time_dir + 'Onslow_res_Project_modified.csv' 129 156 ############################### 130 157 # Domain definitions … … 215 242 216 243 # region to export 217 e _min_area= 300000218 e _max_area= 310000219 n _min_area= 7600000220 n _max_area= 7610000221 244 eastingmin = 300000 245 eastingmax = 310000 246 northingmin = 7600000 247 northingmax = 7610000 248 -
anuga_work/production/onslow_2006/run_onslow_urs.py
r4466 r4525 30 30 from anuga.shallow_water import Field_boundary 31 31 from Numeric import allclose 32 from anuga.shallow_water.data_manager import export_grid 33 32 34 33 35 from anuga.pmesh.mesh_interface import create_mesh_from_regions 34 from anuga. abstract_2d_finite_volumes.utilimport start_screen_catcher, copy_code_files,store_parameters36 from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files,store_parameters 35 37 from anuga_parallel.parallel_api import distribute, numprocs, myid, barrier 36 38 from anuga_parallel.parallel_abstraction import get_processor_name 37 39 from anuga.caching import myhash 40 from anuga.damage_modelling.inundation_damage import add_depth_and_momentum2csv, inundation_damage 41 38 42 # Application specific imports 39 43 import project_urs # Definition of file names and polygons … … 41 45 def run_model(**kwargs): 42 46 43 tide = kwargs['tide']44 alpha = kwargs['alpha']45 friction = kwargs['friction']46 time_thinning = kwargs['time_thinning']47 47 scenario_name = kwargs['aa_scenario_name'] 48 49 50 48 51 49 #------------------------------------------------------------------------------ … … 55 53 56 54 #copy script must be before screen_catcher 57 print 'tide', tide55 print 'tide',kwargs['tide'] 58 56 kwargs['est_num_trigs']=project_urs.trigs_min 59 57 kwargs['num_cpu']=numprocs 60 58 kwargs['host']=project_urs.host 61 59 kwargs['res_factor']=project_urs.res_factor 62 kwargs['starttime']=project_urs.starttime 60 kwargs['starttime']=project_urs.starttime 63 61 kwargs['yieldstep']=project_urs.yieldstep 64 62 kwargs['finaltime']=project_urs.finaltime … … 66 64 kwargs['output_dir']=project_urs.output_run_time_dir 67 65 kwargs['bathy_file']=project_urs.combined_dir_name + '.pts' 68 kwargs['boundary_file']=project_urs.boundaries_dir_name + '.sww'69 # kwargs['Completed']=''70 66 # kwargs['bathy_file']=project_urs.combined_small_dir_name + '.txt' 67 kwargs['boundary_file']=project_urs.boundaries_in_dir_name + '.sww' 68 ''' 71 69 print 'output_dir',kwargs['output_dir'] 72 73 print 'myid',myid74 70 if myid == 0: 75 71 copy_code_files(kwargs['output_dir'],__file__, … … 83 79 84 80 print "Processor Name:",get_processor_name() 85 # barrier()86 87 # filenames88 #boundaries_name = project_urs.boundaries_name89 meshes_dir_name = project_urs.meshes_dir_name+'.msh'90 #boundaries_dir_name = project_urs.boundaries_dir_name91 92 # tide = project_urs.tide93 81 94 82 # creates copy of code in output dir 95 83 print 'min triangles', project_urs.trigs_min, 96 84 print 'Note: This is generally about 20% less than the final amount' 85 97 86 98 87 #-------------------------------------------------------------------------- … … 102 91 # resolutions (maximal area of per triangle) for each polygon 103 92 #-------------------------------------------------------------------------- 93 #IMPORTANT don't cache create_mesh_from_region and Domain(mesh....) as it 94 # causes problems with the ability to cache set quantity which takes alot of times 104 95 105 96 if myid == 0: … … 112 103 maximum_triangle_area=project_urs.res_poly_all, 113 104 interior_regions=project_urs.interior_regions, 114 filename= meshes_dir_name,105 filename=project_urs.meshes_dir_name+'.msh', 115 106 use_cache=False, 116 107 verbose=True) … … 126 117 #domain = cache(Domain, (meshes_dir_name), {'use_cache':True, 'verbose':True}, verbose=True) 127 118 #above don't work 128 domain = Domain(meshes_dir_name, use_cache=False, verbose=True) 129 # print 'domain id', id(domain) 130 # print 'myhash', myhash(domain) 119 domain = Domain(project_urs.meshes_dir_name+'.msh', use_cache=False, verbose=True) 131 120 132 121 print domain.statistics() 133 # domain.134 122 print 'triangles',len(domain) 135 123 136 124 kwargs['act_num_trigs']=len(domain) 137 # print len(domain.mesh)138 139 125 140 126 #------------------------------------------------------------------------- … … 147 133 from polygon import Polygon_function 148 134 #following sets the stage/water to be offcoast only 149 IC = Polygon_function( [(project_urs.poly_mainland, -1.0)], default = tide,135 IC = Polygon_function( [(project_urs.poly_mainland, -1.0)], default = kwargs['tide'], 150 136 geo_reference = domain.geo_reference) 151 137 domain.set_quantity('stage', IC) 152 domain.set_quantity('friction', friction)138 domain.set_quantity('friction', kwargs['friction']) 153 139 154 140 print 'Start Set quantity' … … 158 144 use_cache = True, 159 145 verbose = True, 160 alpha = alpha)146 alpha = kwargs['alpha']) 161 147 print 'Finished Set quantity' 162 148 barrier() … … 174 160 #------------------------------------------------------ 175 161 print 'domain id', id(domain) 176 domain.set_name( scenario_name)162 domain.set_name(kwargs['aa_scenario_name']) 177 163 domain.set_datadir(kwargs['output_dir']) 178 164 domain.set_default_order(2) # Apply second order scheme … … 180 166 domain.set_store_vertices_uniquely(False) 181 167 domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum']) 182 domain.set_maximum_allowed_speed(0.1) # Allow a little runoff (0.1 is OK)183 domain.beta_h = 0 184 domain.limit2007 = 1185 domain.H0=0.01168 # domain.set_maximum_allowed_speed(0.1) # Allow a little runoff (0.1 is OK) 169 domain.beta_h = 0 #sets the surface of the triangle to follow the bathy 170 #domain.H0=0.01 #controls the flux limiter (limiter2007) 171 #domain.limit2007 = 1 #minimises creep 186 172 187 173 #------------------------------------------------------------------------- … … 193 179 194 180 Bf = Field_boundary(kwargs['boundary_file'], 195 domain, time_thinning= time_thinning, mean_stage=tide,181 domain, time_thinning=kwargs['time_thinning'], mean_stage=kwargs['tide'], 196 182 use_cache=True, verbose=True) 197 183 … … 201 187 202 188 Br = Reflective_boundary(domain) 203 Bd = Dirichlet_boundary([ tide,0,0])189 Bd = Dirichlet_boundary([kwargs['tide'],0,0]) 204 190 205 191 print'set_boundary' … … 218 204 for t in domain.evolve(yieldstep = 240, finaltime = kwargs['starttime']): 219 205 domain.write_time() 220 domain.write_boundary_statistics(tags = 'ocean') 221 222 for t in domain.evolve(yieldstep = kwargs['yieldstep'], finaltime = kwargs['finaltime']206 domain.write_boundary_statistics(tags = 'ocean') 207 208 for t in domain.evolve(yieldstep = kwargs['yieldstep'], finaltime = 21600 223 209 ,skip_initial_step = True): 224 210 domain.write_time() 225 domain.write_boundary_statistics(tags = 'ocean') 211 domain.write_boundary_statistics(tags = 'ocean') 212 213 for t in domain.evolve(yieldstep = 240, finaltime = kwargs['finaltime'] 214 ,skip_initial_step = True): 215 domain.write_time() 216 domain.write_boundary_statistics(tags = 'ocean') 226 217 227 218 x, y = domain.get_maximum_inundation_location() … … 237 228 store_parameters(**kwargs) 238 229 barrier() 230 ''' 231 swwfile = kwargs['output_dir']+kwargs['aa_scenario_name'] 232 print 'swwfile',swwfile 233 export_grid(swwfile, extra_name_out = 'town', 234 quantities = ['elevation','stage','speed'], # '(xmomentum**2 + ymomentum**2)**0.5' defaults to elevation 235 timestep = None, 236 reduction = max, 237 cellsize = 25, 238 NODATA_value = -9999, 239 easting_min = project_urs.eastingmin, 240 easting_max = project_urs.eastingmax, 241 northing_min = project_urs.northingmin, 242 northing_max = project_urs.northingmax, 243 verbose = True, 244 origin = None, 245 datum = 'WGS84', 246 format = 'asc') 247 248 swwfile = kwargs['output_dir']+kwargs['aa_scenario_name']+'.sww' 249 buildings_filename = project_urs.buildings_filename 250 buildings_filename_out = project_urs.buildings_filename_out 251 252 inundation_damage(swwfile+'.sww', buildings_filename, buildings_filename_out) 253 print '\n Augmented building file written to %s \n' \ 254 %buildings_filename_out 239 255 240 256 -
anuga_work/production/test_dampier_2006/test.py
r4288 r4525 3 3 import os 4 4 5 import project 5 #import project 6 #from Numeric import allclose 6 7 from anuga.pmesh.mesh_interface import create_mesh_from_regions 7 8 from anuga.shallow_water import Domain 8 9 from anuga.shallow_water import File_boundary 10 from time import localtime, strftime, gmtime 9 11 10 12 home = getenv('INUNDATIONHOME') #Sandpit's parent dir … … 13 15 state = 'western_australia' 14 16 scenario_name = 'dampier' 15 scenario = ' dampier_tsunami_scenario_2006'17 scenario = 'test_dampier' 16 18 an = 'anuga' 17 19 bo = 'boundaries' 20 topo = 'topographies' 21 out = 'outputs' 18 22 urs = 'urs' 19 23 gridded = '1_10000' 20 best_boundary_sww_file = 'o_test_8500_12000.sww' 24 #best_boundary_sww_file = 'o_test_8500_12000.sww' 25 best_boundary_sww_file = 'o_8500_12000_no_zone.sww' 26 27 time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir 28 gtime = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir 29 run_time = time+'_run' 30 print 'gtime: ', gtime 31 print 'time: ', time 32 21 33 22 34 mesh_filename = 'small.tsh' # this will be local 23 best_boundary_sww = os.path.join(data,state,scenario_name, 24 scenario,an,bo,best_boundary_sww_file) 35 best_boundary_sww = os.path.join(home,data,state,scenario,an,bo,best_boundary_sww_file) 36 #J:\inundation\data\western_australia\dampier_tsunami_scenario_2006\anuga\topographies 37 38 elevation_file = 'dampier_combined_elevation_smallest.txt' 39 smallest_elevation= os.path.join(home,data,state,scenario,an,topo,elevation_file) 40 41 output= os.path.join(home,data,state,scenario,an,out,run_time) 25 42 26 43 #pro_instance = project.Project([data,state,scenario_name], 27 44 # outputdir_name=outputdir_name) 28 45 29 poly_all = [[250000,7660000],[280000,7660000], 30 [280000,7630000]] 46 #poly_all = [[250000,7660000],[280000,7660000], [280000,7630000]] 47 poly_all = [[469000,7760000],[470000,7758000],[468000,7758000]] 48 49 print 'create mesh' 31 50 create_mesh_from_regions(poly_all, 32 51 boundary_tags={'back': [0,1,2]}, … … 38 57 print domain.statistics() 39 58 40 domain.set_quantity('stage', 0.0)59 domain.set_quantity('stage', 2.4) 41 60 domain.set_quantity('friction', 0.01) 61 domain.set_name(scenario_name) 62 domain.set_datadir(output) 63 64 print 'set elevation',smallest_elevation 65 42 66 domain.set_quantity('elevation', 43 # filename = project.combined_dir_name + '.pts', 44 # MUST USE TXT FILES FOR CACHING TO WORK! 45 filename = project.combined_smaller_dir_name + '.txt', 67 filename = smallest_elevation, 46 68 use_cache = True, 47 69 verbose = True, 48 70 alpha = 0.1) 49 71 72 73 print 'best_boundary_sww',best_boundary_sww 74 75 print 'get file boundary' 50 76 Bf = File_boundary(best_boundary_sww, 51 domain, use_cache=False, verbose=True) 77 domain, time_thinning=24, use_cache=False, verbose=True) 78 79 domain.set_boundary({'back': Bf}) 80 81 82 #t0 = time.time() 83 84 print 'evolve' 85 for t in domain.evolve(yieldstep = 120, finaltime = 3400): 86 domain.write_time() 87 domain.write_boundary_statistics(tags = 'back') 88 89 90 91
Note: See TracChangeset
for help on using the changeset viewer.