Changeset 6750
- Timestamp:
- Apr 7, 2009, 3:50:57 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/production/patong/new_version/run_model.py
r6701 r6750 21 21 22 22 # Standard modules 23 import sys24 23 import os 25 24 import os.path … … 49 48 from setup_model import project 50 49 import build_urs_boundary as bub 51 52 53 #-------------------------------------------------------------------------------54 # Examine args - look for switches to control execution55 #56 # We expect:57 # -n --no-evolve Stop after writing cached data - don't enter evolve loop58 #-------------------------------------------------------------------------------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 help68 --no-evolve quit after creating cache data69 '''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.msg79 print >>sys.stderr, "for help use --help"80 sys.exit(2)81 82 # process options83 DoEvolve = True84 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 = False90 50 91 51 #------------------------------------------------------------------------------- … … 233 193 #------------------------------------------------------------------------------- 234 194 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 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 253 210 print 'Simulation took %.2f seconds' %(time.time()-t0) 211
Note: See TracChangeset
for help on using the changeset viewer.