Changeset 6750


Ignore:
Timestamp:
Apr 7, 2009, 3:50:57 PM (16 years ago)
Author:
ole
Message:

Reverted 'do not evolve' code in patong simulation.
It didn't work and is not desirable for this model.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/production/patong/new_version/run_model.py

    r6701 r6750  
    2121
    2222# Standard modules
    23 import sys
    2423import os
    2524import os.path
     
    4948from setup_model import project
    5049import 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
    9050
    9151#-------------------------------------------------------------------------------
     
    233193#-------------------------------------------------------------------------------
    234194
    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 
     195t0 = time.time()
     196
     197# Skip over the first 6000 seconds
     198for 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
     204for 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   
    253210print 'Simulation took %.2f seconds' %(time.time()-t0)
     211     
Note: See TracChangeset for help on using the changeset viewer.