Changeset 4007


Ignore:
Timestamp:
Nov 17, 2006, 5:04:50 PM (16 years ago)
Author:
duncan
Message:

updating run_dam

Location:
anuga_work/development/dam_2006
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/development/dam_2006/create_mesh.py

    r3541 r4007  
    1 """Create mesh for lwru2 validation of the Oshiri island tsunami
     1"""Create mesh for University of Queensland dam break flume
    22"""
    33
     
    88
    99def generate(mesh_filename, gate_position, is_course = False):
     10    """
     11    Generate mesh for University of Queensland dam break flume.
     12    The gate position is the distance from the right wall of the wave tank
     13    to the gate.
     14   
     15    """
    1016    #Basic geometry
    1117   
  • anuga_work/development/dam_2006/project.py

    r3533 r4007  
    77from time import localtime, strftime
    88from os import mkdir, access, F_OK
    9                
    10 #Making assumptions about the location of scenario data
    11 scenario_dir_name = 'dam_2006'
     9from anuga.abstract_2d_finite_volumes.util import add_directories, \
     10     copy_code_files
     11
    1212
    1313#swollen/ all data output
     
    1616if sys.platform == 'win32':
    1717    try:
    18         home = environ['INUNDATIONHOME']     #Sandpit's parent dir
     18        home = environ['INUNDATIONHOME']   
     19        user = getenv('USERPROFILE')
    1920    except:
    20         home = '.'
     21        home = '.'   
     22        user = getenv('LOGNAME')
    2123else:   
    2224    home = getenv('INUNDATIONHOME', sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'risk_assessment_methods_project'+sep+'inundation')     
     
    2628    home = '.'
    2729   
     30# Create the structure of where the output will go
     31create_scenario_dir = ['data','flumes','dam_2006']
     32
     33scenariodir=add_directories(home, create_scenario_dir)
     34
     35
    2836#Derive subdirectories and filenames
    2937time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir
    30 scenariodir =  home+sep+scenario_dir_name
    3138outputdir = scenariodir+sep+'output'+sep
    3239outputtimedir = outputdir+time+sep
    3340meshdir = scenariodir+sep+'meshes'+sep
     41
     42
    3443
    3544depth_filename = outputtimedir + "depth.csv"
     
    3948
    4049# creates copy of output dir structure, if it doesn't exist
    41 if not access(scenariodir,F_OK):
    42     mkdir (scenariodir)
    43 
    4450if not access(meshdir,F_OK):
    4551    mkdir (meshdir)
     
    5157    mkdir (outputtimedir)
    5258
    53 codedir = getcwd()+sep
    54                                
     59codedir = getcwd()+sep                               
    5560codedirname = codedir + 'project.py'
    5661
  • anuga_work/development/dam_2006/run_dam.py

    r3642 r4007  
    1414import sys
    1515from shutil import copy
    16 from os import path
     16from os import path, sep
     17from os.path import dirname  #, basename
    1718
    1819# Related major packages
    1920from anuga.shallow_water import Domain, Reflective_boundary, \
    2021                            Dirichlet_boundary, Time_boundary, File_boundary
    21 from anuga.abstract_2d_finite_volumes.util import Screen_Catcher
    2222from anuga.abstract_2d_finite_volumes.region import Set_region
    2323from anuga.fit_interpolate.interpolate import interpolate_sww2csv
     24from anuga.abstract_2d_finite_volumes.util import start_screen_catcher, \
     25     copy_code_files
     26
     27
     28# Scenario specific imports
     29import project                 # Definition of file names and polygons
    2430import create_mesh
    25 
    26 # Application specific imports
    27 import project                 # Definition of file names and polygons
    2831
    2932
    3033def main():
    31     #-------------------------------------------------------------------------
    32     # Setup archiving of simulations
    33     #-------------------------------------------------------------------------
    3434
    35     copy (project.codedirname, project.outputtimedir + 'project.py')
    36     copy (project.codedir + 'run_dam.py', project.outputtimedir + 'run_dam.py')
     35    #--------------------------------------------------------------------------
     36    # Copy scripts to time stamped output directory and capture screen
     37    # output to file
     38    #--------------------------------------------------------------------------
     39
     40    # creates copy of code in output dir
     41
     42    print "The output dir is", project.outputtimedir
     43    copy_code_files(project.outputtimedir,__file__,
     44                    dirname(project.__file__)+sep+ project.__name__+'.py' )
    3745    copy (project.codedir + 'create_mesh.py',
    3846          project.outputtimedir + 'create_mesh.py')
    39     print'output dir', project.outputtimedir
     47    myid = 0
     48    numprocs = 1
     49    start_screen_catcher(project.outputtimedir, myid, numprocs)
    4050
    41     #FIXME this isn't working
    42     #normal screen output is stored in
    43     screen_output_name = project.outputtimedir + "screen_output.txt"
    44     screen_error_name = project.outputtimedir + "screen_error.txt"
    45 
     51    print 'USER:    ', project.user
    4652    #-------------------------------------------------------------------------
    4753    # Create the triangular mesh
    4854    #-------------------------------------------------------------------------
    4955
    50     gate_position = 0.85
     56    gate_position = 2.0
    5157    create_mesh.generate(project.mesh_filename,
    5258                         gate_position,
    53                          #is_course=True) # this creates the mesh
    54                          is_course=False) # this creates the mesh
     59                         is_course=True) # this creates the mesh
     60                         #is_course=False) # this creates the mesh
    5561
    5662    head,tail = path.split(project.mesh_filename)
     
    8894
    8995    print 'Available boundary tags', domain.get_boundary_tags()
    90     domain.set_region('dam','stage',0.2,
     96    domain.set_region('dam','stage',0.15,
    9197                                 location = 'unique vertices')
    9298    #domain.set_region(Set_region('dam','stage',0.2,
     
    102108    t0 = time.time()
    103109
    104     for t in domain.evolve(yieldstep = 0.1, finaltime = 25):
     110    for t in domain.evolve(yieldstep = 0.05, finaltime = 10):
    105111        domain.write_time()
    106112   
Note: See TracChangeset for help on using the changeset viewer.