Changeset 6312 for anuga_work
- Timestamp:
- Feb 11, 2009, 3:53:48 PM (16 years ago)
- Location:
- anuga_work/production/busselton/standardised_version
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/production/busselton/standardised_version/project.py
r6308 r6312 14 14 #----- 15 15 # Get system data - don't fiddle with this. 16 # These values can be used to distinguish between two similar runs by two 17 # different users or runs by the same user on two different machines. 16 18 #----- 17 19 … … 52 54 # Important to distinguish each run - ensure str(user) is included! 53 55 # Note, the user is free to include as many parameters as desired 56 # This should be moved to run_model.py, with the user providing the list to join 57 # for example: output_comment_list = [setup, str(tide), str(event_number), str(user)] 54 58 output_comment = '_'.join([setup, str(tide), str(event_number), str(user)]) 55 59 … … 79 83 # Format for points easting,northing (no header) 80 84 bounding_polygon_filename = 'bounding_polygon.csv' 85 bounding_polygon_maxarea = 100000 81 86 82 87 # INTERIOR REGIONS - for designing the mesh … … 121 126 # MUX input filename 122 127 # Must exist in $MUXHOME/mux directory. 123 # If MUX file not used, do "mux_input_file = None". 124 mux_input_file = 'event_031451.list' # File produced by EventSelection 128 # File is prodiced by EventSelection. 129 # If MUX file not used, do "mux_input_filename = None". 130 mux_input_filename = r'C:\temp\event_026633.list' 125 131 126 132 #------------------------------------------------------------------------------- … … 162 168 ENV_MUXHOME = 'MUXHOME' 163 169 164 # Check we have required environment variables set165 sanity_error = False # checked at bottom of this file166 167 if os.getenv(ENV_INUNDATIONHOME) is None:168 print "Environment variable '%s' is not set" % ENV_INUNDATIONHOME169 sanity_error = True170 171 if os.getenv(ENV_MUXHOME) is None:172 print "Environment variable '%s' is not set" % ENV_MUXHOME173 sanity_error = True174 175 # check for errors detected so far176 if sanity_error:177 print 'You must fix the above errors before continuing.'178 sys.exit(10)170 ### Check we have required environment variables set 171 ##sanity_error = False # checked at bottom of this file 172 ## 173 ##if os.getenv(ENV_INUNDATIONHOME) is None: 174 ## print "Environment variable '%s' is not set" % ENV_INUNDATIONHOME 175 ## sanity_error = True 176 ## 177 ##if os.getenv(ENV_MUXHOME) is None: 178 ## print "Environment variable '%s' is not set" % ENV_MUXHOME 179 ## sanity_error = True 180 ## 181 ### check for errors detected so far 182 ##if sanity_error: 183 ## print 'You must fix the above errors before continuing.' 184 ## sys.exit(10) 179 185 180 186 #------------------------------------------------------------------------------- … … 198 204 # create paths generated from environment variables. 199 205 home = join(os.getenv(ENV_INUNDATIONHOME), 'data') # Absolute path for data folder 200 if not exists(home):201 print "Sorry, data directory '%s' doesn't exist" % home202 sanity_error = True206 ##if not exists(home): 207 ## print "Sorry, data directory '%s' doesn't exist" % home 208 ## sanity_error = True 203 209 204 210 muxhome = os.getenv(ENV_MUXHOME) 205 if not exists(muxhome):206 print "Sorry, MUX directory '%s' doesn't exist" % muxhome207 sanity_error = True211 ##if not exists(muxhome): 212 ## print "Sorry, MUX directory '%s' doesn't exist" % muxhome 213 ## sanity_error = True 208 214 209 # if mux_input_file has been defined, check if file exists 210 if mux_input_file: 211 if not exists(join(muxhome, mux_input_file)): 212 print ("Sorry, MUX input file '%s' doesn't exist" 213 % join(muxhome, mux_input_file)) 214 sanity_error = True 215 216 # check various directories that must exist 215 # check various directories/files that must exist 217 216 anuga_folder = join(home, state, scenario_folder, 'anuga') 218 if not exists(anuga_folder):219 print "Sorry, ANUGA directory '%s' doesn't exist" % anuga_folder220 sanity_error = True217 ##if not exists(anuga_folder): 218 ## print "Sorry, ANUGA directory '%s' doesn't exist" % anuga_folder 219 ## sanity_error = True 221 220 222 221 topographies_folder = join(anuga_folder, 'topographies') 223 if not exists(topographies_folder):224 print "Sorry, topo directory '%s' doesn't exist" % topographies_folder225 sanity_error = True222 ##if not exists(topographies_folder): 223 ## print "Sorry, topo directory '%s' doesn't exist" % topographies_folder 224 ## sanity_error = True 226 225 227 226 polygons_folder = join(anuga_folder, 'polygons') 228 if not exists(polygons_folder):229 print "Sorry, polygon directory '%s' doesn't exist" % polygons_folder230 sanity_error = True227 ##if not exists(polygons_folder): 228 ## print "Sorry, polygon directory '%s' doesn't exist" % polygons_folder 229 ## sanity_error = True 231 230 232 231 boundaries_folder = join(anuga_folder, 'boundaries') 233 if not exists(boundaries_folder):234 print "Sorry, boundaries directory '%s' doesn't exist" % boundaries_folder235 sanity_error = True232 ##if not exists(boundaries_folder): 233 ## print "Sorry, boundaries directory '%s' doesn't exist" % boundaries_folder 234 ## sanity_error = True 236 235 237 236 output_folder = join(anuga_folder, 'outputs') 238 if not exists(output_folder):239 print "Sorry, outputs directory '%s' doesn't exist" % output_folder240 sanity_error = True237 ##if not exists(output_folder): 238 ## print "Sorry, outputs directory '%s' doesn't exist" % output_folder 239 ## sanity_error = True 241 240 242 241 gauges_folder = join(anuga_folder, 'gauges') 243 if not exists(gauges_folder):244 print "Sorry, gauges directory '%s' doesn't exist" % gauges_folder245 sanity_error = True242 ##if not exists(gauges_folder): 243 ## print "Sorry, gauges directory '%s' doesn't exist" % gauges_folder 244 ## sanity_error = True 246 245 247 246 meshes_folder = join(anuga_folder, 'meshes') 248 if not exists(meshes_folder): 249 print "Sorry, meshes directory '%s' doesn't exist" % meshes_folder 250 sanity_error = True 251 247 ##if not exists(meshes_folder): 248 ## print "Sorry, meshes directory '%s' doesn't exist" % meshes_folder 249 ## sanity_error = True 250 251 ### if mux_input_filename has been defined, check if file exists 252 ##if mux_input_filename: 253 ## if not exists(mux_input_filename): 254 ## print ("Sorry, MUX input file '%s' doesn't exist" % mux_input_filename) 255 ## sanity_error = True 256 257 #----- 258 # If these directories don't exist initially, create them. 259 # This should be moved to run_model.py. 260 #----- 261 262 event_folder = join(boundaries_folder, str(event_number)) 263 if not exists(event_folder): 264 print "Creating directory 'event_folder'=%s" % event_folder 265 os.mkdir(event_folder) 252 266 253 267 #------------------------------------------------------------------------------- … … 306 320 time_thinning = 4 307 321 yieldstep = 60 308 else:309 print ("Sorry, you must set the 'setup' variable to one of 'trial', "310 "'basic' or 'final'. I found '%s'" % str(setup))311 sanity_error = True322 ##else: 323 ## print ("Sorry, you must set the 'setup' variable to one of 'trial', " 324 ## "'basic' or 'final'. I found '%s'" % str(setup)) 325 ## sanity_error = True 312 326 313 327 #------------------------------------------------------------------------------- … … 330 344 bounding_polygon = read_polygon(join(polygons_folder, 331 345 bounding_polygon_filename)) 332 bounding_maxarea = 100000*scale_factor346 bounding_maxarea = bounding_polygon_maxarea*scale_factor 333 347 334 348 # Estimate the number of triangles … … 336 350 bounding_polygon, bounding_maxarea) 337 351 338 # -------------------------------------------------------------------------------339 # Check for errors detected above.340 # -------------------------------------------------------------------------------341 342 if sanity_error:343 print 'You must fix the above errors before continuing.'344 sys.exit(10)352 ###------------------------------------------------------------------------------- 353 ### Check for errors detected above. 354 ###------------------------------------------------------------------------------- 355 ## 356 ##if sanity_error: 357 ## print 'You must fix the above errors before continuing.' 358 ## sys.exit(10) 345 359 346 360 -
anuga_work/production/busselton/standardised_version/run_model.py
r6292 r6312 39 39 # Application specific imports 40 40 import project # Definition of file names and polygons 41 import build_urs_boundary as bub 41 42 42 43 43 #------------------------------------------------------------------------------ 44 #------------------------------------------------------------------------------- 45 # Perform (as much as possible) a sanity check on values from import of project. 46 #------------------------------------------------------------------------------- 47 48 #------------------------------------------------------------------------------- 44 49 # Copy scripts to time stamped output directory and capture screen 45 50 # output to file. Copy script must be before screen_catcher 46 #------------------------------------------------------------------------------ 51 #------------------------------------------------------------------------------- 52 47 53 copy_code_files(project.output_run, __file__, 48 os.path. dirname(project.__file__)+os.sep+\49 project.__name__+'.py')54 os.path.join(os.path.dirname(project.__file__), 55 project.__name__+'.py')) 50 56 start_screen_catcher(project.output_run, 0, 1) 51 57 52 53 #------------------------------------------------------------------------------ 58 #------------------------------------------------------------------------------- 54 59 # Create the computational domain based on overall clipping polygon with 55 60 # a tagged boundary and interior regions defined in project.py along with 56 61 # resolutions (maximal area of per triangle) for each polygon 57 #------------------------------------------------------------------------------ 62 #------------------------------------------------------------------------------- 63 58 64 print 'Create computational domain' 65 66 # Create the STS file 67 bub.build_urs_boundary(os.path.join(project.muxhome, 'mux'), 68 project.mux_input_filename, 69 os.path.join(project.event_folder, 70 project.scenario_name)) 59 71 60 72 # Read in boundary from ordered sts file … … 69 81 70 82 # Number of boundary segments 71 N = len(event_sts) -183 N = len(event_sts) - 1 72 84 73 85 # Boundary tags refer to project.landward_boundary … … 91 103 domain.set_minimum_storable_height(0.01) # Don't store depth less than 1cm 92 104 105 #------------------------------------------------------------------------------- 106 # Setup initial conditions 107 #------------------------------------------------------------------------------- 93 108 94 #------------------------------------------------------------------------------95 # Setup initial conditions96 #------------------------------------------------------------------------------97 109 print 'Setup initial conditions' 98 110 … … 109 121 alpha=project.alpha) 110 122 123 #------------------------------------------------------------------------------- 124 # Setup boundary conditions 125 #------------------------------------------------------------------------------- 111 126 112 #------------------------------------------------------------------------------113 # Setup boundary conditions114 #------------------------------------------------------------------------------115 127 print 'Set boundary - available tags:', domain.get_boundary_tags() 116 128 117 129 Br = Reflective_boundary(domain) 118 130 Bt = Transmissive_stage_zero_momentum_boundary(domain) 119 Bd = Dirichlet_boundary([kwargs['tide'], 0,0])131 Bd = Dirichlet_boundary([kwargs['tide'], 0, 0]) 120 132 Bf = Field_boundary(project.event_sts+'.sts', 121 133 domain, mean_stage=project.tide, … … 130 142 'ocean': Bf}) 131 143 144 #------------------------------------------------------------------------------- 145 # Evolve system through time 146 #------------------------------------------------------------------------------- 132 147 133 #------------------------------------------------------------------------------134 # Evolve system through time135 #------------------------------------------------------------------------------136 148 t0 = time.time() 137 149 for t in domain.evolve(yieldstep=project.yieldstep, … … 141 153 print domain.boundary_statistics(tags='ocean') 142 154 143 print 'Simulation took %.2f seconds' % (time.time()-t0)155 print 'Simulation took %.2f seconds' % (time.time()-t0)
Note: See TracChangeset
for help on using the changeset viewer.