Changeset 6312


Ignore:
Timestamp:
Feb 11, 2009, 3:53:48 PM (16 years ago)
Author:
rwilson
Message:

Checked in to get a copy on nautilus for final testing.

Location:
anuga_work/production/busselton/standardised_version
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/production/busselton/standardised_version/project.py

    r6308 r6312  
    1414#-----
    1515# 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.
    1618#-----
    1719
     
    5254# Important to distinguish each run - ensure str(user) is included!
    5355# 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)]
    5458output_comment = '_'.join([setup, str(tide), str(event_number), str(user)])
    5559
     
    7983# Format for points easting,northing (no header)
    8084bounding_polygon_filename = 'bounding_polygon.csv'
     85bounding_polygon_maxarea = 100000
    8186
    8287# INTERIOR REGIONS -  for designing the mesh
     
    121126# MUX input filename
    122127# 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".
     130mux_input_filename = r'C:\temp\event_026633.list'
    125131
    126132#-------------------------------------------------------------------------------
     
    162168ENV_MUXHOME = 'MUXHOME'
    163169
    164 # Check we have required environment variables set
    165 sanity_error = False               # checked at bottom of this file
    166 
    167 if os.getenv(ENV_INUNDATIONHOME) is None:
    168     print "Environment variable '%s' is not set" % ENV_INUNDATIONHOME
    169     sanity_error = True
    170 
    171 if os.getenv(ENV_MUXHOME) is None:
    172     print "Environment variable '%s' is not set" % ENV_MUXHOME
    173     sanity_error = True
    174 
    175 # check for errors detected so far
    176 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)
    179185
    180186#-------------------------------------------------------------------------------
     
    198204# create paths generated from environment variables.
    199205home = 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" % home
    202     sanity_error = True
     206##if not exists(home):
     207##    print "Sorry, data directory '%s' doesn't exist" % home
     208##    sanity_error = True
    203209   
    204210muxhome = os.getenv(ENV_MUXHOME)
    205 if not exists(muxhome):
    206     print "Sorry, MUX directory '%s' doesn't exist" % muxhome
    207     sanity_error = True
     211##if not exists(muxhome):
     212##    print "Sorry, MUX directory '%s' doesn't exist" % muxhome
     213##    sanity_error = True
    208214   
    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
    217216anuga_folder = join(home, state, scenario_folder, 'anuga')
    218 if not exists(anuga_folder):
    219     print "Sorry, ANUGA directory '%s' doesn't exist" % anuga_folder
    220     sanity_error = True
     217##if not exists(anuga_folder):
     218##    print "Sorry, ANUGA directory '%s' doesn't exist" % anuga_folder
     219##    sanity_error = True
    221220
    222221topographies_folder = join(anuga_folder, 'topographies')
    223 if not exists(topographies_folder):
    224     print "Sorry, topo directory '%s' doesn't exist" % topographies_folder
    225     sanity_error = True
     222##if not exists(topographies_folder):
     223##    print "Sorry, topo directory '%s' doesn't exist" % topographies_folder
     224##    sanity_error = True
    226225
    227226polygons_folder = join(anuga_folder, 'polygons')
    228 if not exists(polygons_folder):
    229     print "Sorry, polygon directory '%s' doesn't exist" % polygons_folder
    230     sanity_error = True
     227##if not exists(polygons_folder):
     228##    print "Sorry, polygon directory '%s' doesn't exist" % polygons_folder
     229##    sanity_error = True
    231230
    232231boundaries_folder = join(anuga_folder, 'boundaries')
    233 if not exists(boundaries_folder):
    234     print "Sorry, boundaries directory '%s' doesn't exist" % boundaries_folder
    235     sanity_error = True
     232##if not exists(boundaries_folder):
     233##    print "Sorry, boundaries directory '%s' doesn't exist" % boundaries_folder
     234##    sanity_error = True
    236235
    237236output_folder = join(anuga_folder, 'outputs')
    238 if not exists(output_folder):
    239     print "Sorry, outputs directory '%s' doesn't exist" % output_folder
    240     sanity_error = True
     237##if not exists(output_folder):
     238##    print "Sorry, outputs directory '%s' doesn't exist" % output_folder
     239##    sanity_error = True
    241240
    242241gauges_folder = join(anuga_folder, 'gauges')
    243 if not exists(gauges_folder):
    244     print "Sorry, gauges directory '%s' doesn't exist" % gauges_folder
    245     sanity_error = True
     242##if not exists(gauges_folder):
     243##    print "Sorry, gauges directory '%s' doesn't exist" % gauges_folder
     244##    sanity_error = True
    246245
    247246meshes_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
     262event_folder = join(boundaries_folder, str(event_number))
     263if not exists(event_folder):
     264    print "Creating directory 'event_folder'=%s" % event_folder
     265    os.mkdir(event_folder)
    252266
    253267#-------------------------------------------------------------------------------
     
    306320    time_thinning = 4
    307321    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 = True
     322##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
    312326
    313327#-------------------------------------------------------------------------------
     
    330344bounding_polygon = read_polygon(join(polygons_folder,
    331345                                     bounding_polygon_filename))
    332 bounding_maxarea = 100000*scale_factor
     346bounding_maxarea = bounding_polygon_maxarea*scale_factor
    333347
    334348# Estimate the number of triangles                     
     
    336350                                  bounding_polygon, bounding_maxarea)
    337351
    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)
    345359
    346360
  • anuga_work/production/busselton/standardised_version/run_model.py

    r6292 r6312  
    3939# Application specific imports
    4040import project  # Definition of file names and polygons
     41import build_urs_boundary as bub
    4142
    4243
    43 #------------------------------------------------------------------------------
     44#-------------------------------------------------------------------------------
     45# Perform (as much as possible) a sanity check on values from import of project.
     46#-------------------------------------------------------------------------------
     47
     48#-------------------------------------------------------------------------------
    4449# Copy scripts to time stamped output directory and capture screen
    4550# output to file. Copy script must be before screen_catcher
    46 #------------------------------------------------------------------------------
     51#-------------------------------------------------------------------------------
     52
    4753copy_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'))
    5056start_screen_catcher(project.output_run, 0, 1)
    5157
    52 
    53 #------------------------------------------------------------------------------
     58#-------------------------------------------------------------------------------
    5459# Create the computational domain based on overall clipping polygon with
    5560# a tagged boundary and interior regions defined in project.py along with
    5661# resolutions (maximal area of per triangle) for each polygon
    57 #------------------------------------------------------------------------------
     62#-------------------------------------------------------------------------------
     63
    5864print 'Create computational domain'
     65
     66# Create the STS file
     67bub.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))
    5971
    6072# Read in boundary from ordered sts file
     
    6981
    7082# Number of boundary segments
    71 N = len(event_sts)-1
     83N = len(event_sts) - 1
    7284
    7385# Boundary tags refer to project.landward_boundary
     
    91103domain.set_minimum_storable_height(0.01)    # Don't store depth less than 1cm
    92104
     105#-------------------------------------------------------------------------------
     106# Setup initial conditions
     107#-------------------------------------------------------------------------------
    93108
    94 #------------------------------------------------------------------------------
    95 # Setup initial conditions
    96 #------------------------------------------------------------------------------
    97109print 'Setup initial conditions'
    98110
     
    109121                    alpha=project.alpha)
    110122
     123#-------------------------------------------------------------------------------
     124# Setup boundary conditions
     125#-------------------------------------------------------------------------------
    111126
    112 #------------------------------------------------------------------------------
    113 # Setup boundary conditions
    114 #------------------------------------------------------------------------------
    115127print 'Set boundary - available tags:', domain.get_boundary_tags()
    116128
    117129Br = Reflective_boundary(domain)
    118130Bt = Transmissive_stage_zero_momentum_boundary(domain)
    119 Bd = Dirichlet_boundary([kwargs['tide'],0,0])
     131Bd = Dirichlet_boundary([kwargs['tide'], 0, 0])
    120132Bf = Field_boundary(project.event_sts+'.sts',
    121133                    domain, mean_stage=project.tide,
     
    130142                     'ocean': Bf})
    131143
     144#-------------------------------------------------------------------------------
     145# Evolve system through time
     146#-------------------------------------------------------------------------------
    132147
    133 #------------------------------------------------------------------------------
    134 # Evolve system through time
    135 #------------------------------------------------------------------------------
    136148t0 = time.time()
    137149for t in domain.evolve(yieldstep=project.yieldstep,
     
    141153    print domain.boundary_statistics(tags='ocean')
    142154
    143 print 'Simulation took %.2f seconds' %(time.time()-t0)
     155print 'Simulation took %.2f seconds' % (time.time()-t0)
Note: See TracChangeset for help on using the changeset viewer.