Changeset 6701
- Timestamp:
- Apr 2, 2009, 4:02:38 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/production/patong/new_version/run_model.py
r6592 r6701 21 21 22 22 # Standard modules 23 import sys 23 24 import os 24 25 import os.path … … 48 49 from setup_model import project 49 50 import build_urs_boundary as bub 51 52 53 #------------------------------------------------------------------------------- 54 # Examine args - look for switches to control execution 55 # 56 # We expect: 57 # -n --no-evolve Stop after writing cached data - don't enter evolve loop 58 #------------------------------------------------------------------------------- 59 60 ## 61 # @brief Return a usage string. 62 def usage(): 63 '''Return a 'usage' string.''' 64 65 return '''Usage: run_model.py [<options>] 66 where <options> is one or more of: 67 --help print this help 68 --no-evolve quit after creating cache data 69 ''' 70 71 72 try: 73 try: 74 opts, args = getopt.getopt(sys.argv[1:], 'hn', ['help', 'no-evolve']) 75 except getopt.error, msg: 76 raise RuntimeError, Usage(msg) 77 except Usage, err: 78 print >>sys.stderr, err.msg 79 print >>sys.stderr, "for help use --help" 80 sys.exit(2) 81 82 # process options 83 DoEvolve = True 84 for opt, arg in opts: 85 if opt in ('-h', '--help'): 86 print usage() 87 sys.exit(0) 88 elif opt in ('-n', '--no-evolve'): 89 DoEvolve = False 50 90 51 91 #------------------------------------------------------------------------------- … … 193 233 #------------------------------------------------------------------------------- 194 234 195 t0 = time.time() 196 197 # Skip over the first 6000 seconds 198 for t in domain.evolve(yieldstep=2000, 199 finaltime=6000): 200 print domain.timestepping_statistics() 201 print domain.boundary_statistics(tags='ocean') 202 203 # Start detailed model 204 for t in domain.evolve(yieldstep=project.yieldstep, 205 finaltime=project.finaltime, 206 skip_initial_step=True): 207 print domain.timestepping_statistics() 208 print domain.boundary_statistics(tags='ocean') 209 235 if DoEvolve: 236 t0 = time.time() 237 238 # Skip over the first 6000 seconds 239 for t in domain.evolve(yieldstep=2000, 240 finaltime=6000): 241 print domain.timestepping_statistics() 242 print domain.boundary_statistics(tags='ocean') 243 244 # Start detailed model 245 for t in domain.evolve(yieldstep=project.yieldstep, 246 finaltime=project.finaltime, 247 skip_initial_step=True): 248 print domain.timestepping_statistics() 249 print domain.boundary_statistics(tags='ocean') 250 else: 251 print 'Model not evolved, as requested' 252 210 253 print 'Simulation took %.2f seconds' %(time.time()-t0) 211
Note: See TracChangeset
for help on using the changeset viewer.