Changeset 3420


Ignore:
Timestamp:
Jul 25, 2006, 2:41:31 PM (18 years ago)
Author:
duncan
Message:

checking in scenario changes

Location:
development/dam_2006
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • development/dam_2006/create_mesh.py

    r3408 r3420  
    1010
    1111import project
    12 def generate():
     12def generate(gate_position, is_course = False):
    1313    #Basic geometry
    1414   
    15     xleft   = -2.25
    16     xright  = .75
     15    xleft   = - gate_position
     16    xright  = 3.0 - gate_position
    1717    ybottom = 0
    1818    ytop    = 0.4
     
    5757    m.addVertsSegs(dict)
    5858   
    59     dam = m.add_region(0.2,0.2) # this is the location of the region.
     59    dam = m.add_region(0.0000001,(ytop - ybottom)/2)
     60    # this is the location of the region.
     61
    6062    dam.setTag("dam")
    61     m.generate_mesh(maximum_triangle_area=0.01)
    62     #m.generate_mesh(maximum_triangle_area=0.0001)
     63    if is_course:
     64        m.generate_mesh(maximum_triangle_area=0.01)
     65    else:
     66        m.generate_mesh(maximum_triangle_area=0.0001)
    6367
    6468    m.export_mesh_file(project.mesh_filename)
  • development/dam_2006/run_dam.py

    r3408 r3420  
    3232import create_mesh
    3333
     34def main():
     35    #-------------------------------------------------------------------------
     36    # Setup archiving of simulations
     37    #-------------------------------------------------------------------------
    3438
    35 #-----------------------------------------------------------------------------
    36 # Setup archiving of simulations
    37 #-----------------------------------------------------------------------------
     39    copy (project.codedirname, project.outputtimedir + 'project.py')
     40    copy (project.codedir + 'run_dam.py', project.outputtimedir + 'run_dam.py')
     41    copy (project.codedir + 'create_mesh.py',
     42          project.outputtimedir + 'create_mesh.py')
     43    print'output dir', project.outputtimedir
    3844
    39 copy (project.codedirname, project.outputtimedir + 'project.py')
    40 copy (project.codedir + 'run_dam.py', project.outputtimedir + 'run_dam.py')
    41 copy (project.codedir + 'create_mesh.py',
    42       project.outputtimedir + 'create_mesh.py')
    43 print'output dir', project.outputtimedir
     45    #normal screen output is stored in
     46    screen_output_name = project.outputtimedir + "screen_output.txt"
     47    screen_error_name = project.outputtimedir + "screen_error.txt"
    4448
    45 #normal screen output is stored in
    46 screen_output_name = project.outputtimedir + "screen_output.txt"
    47 screen_error_name = project.outputtimedir + "screen_error.txt"
     49    #-------------------------------------------------------------------------
     50    # Create the triangular mesh
     51    #-------------------------------------------------------------------------
    4852
    49 #-----------------------------------------------------------------------------
    50 # Create the triangular mesh
    51 #-----------------------------------------------------------------------------
     53    create_mesh.generate(0.75, is_course=False) # this creates the mesh
    5254
    53 create_mesh.generate() # this creates the mesh
    54 
    55 head,tail = path.split(project.mesh_filename)
    56 copy (project.mesh_filename,
    57       project.outputtimedir + tail )
    58 #-----------------------------------------------------------------------------
    59 # Setup computational domain
    60 #-----------------------------------------------------------------------------
    61 domain = Domain(project.mesh_filename, use_cache = False, verbose = True)
     55    head,tail = path.split(project.mesh_filename)
     56    copy (project.mesh_filename,
     57          project.outputtimedir + tail )
     58    #-------------------------------------------------------------------------
     59    # Setup computational domain
     60    #-------------------------------------------------------------------------
     61    domain = Domain(project.mesh_filename, use_cache = False, verbose = True)
    6262   
    6363
    64 print 'Number of triangles = ', len(domain)
    65 print 'The extent is ', domain.get_extent()
    66 print domain.statistics()
     64    print 'Number of triangles = ', len(domain)
     65    print 'The extent is ', domain.get_extent()
     66    print domain.statistics()
    6767
    68 domain.set_name(project.basename)
    69 domain.set_datadir(project.outputtimedir)
    70 domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
     68    domain.set_name(project.basename)
     69    domain.set_datadir(project.outputtimedir)
     70    domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
    7171
    72 #-----------------------------------------------------------------------------
    73 # Setup initial conditions
    74 #-----------------------------------------------------------------------------
     72    #-------------------------------------------------------------------------
     73    # Setup initial conditions
     74    #-------------------------------------------------------------------------
    7575
    76 tide = 0.0
    77 slope = -0.05
     76    tide = 0.0
     77    slope = -0.05
    7878
    79 def elevation_tilt(x, y):
    80     return x*slope
     79    def elevation_tilt(x, y):
     80        return x*slope
    8181       
    82 domain.set_quantity('stage', elevation_tilt)
    83 domain.set_quantity('friction', 0.03)
    84 domain.set_quantity('elevation',elevation_tilt)
     82    domain.set_quantity('stage', elevation_tilt)
     83    domain.set_quantity('friction', 0.03)
     84    domain.set_quantity('elevation',elevation_tilt)
    8585
    86 print 'Available boundary tags', domain.get_boundary_tags()
     86    print 'Available boundary tags', domain.get_boundary_tags()
    8787
    88 domain.set_region(Set_region('dam','stage',0.2,location = 'unique vertices'))
     88    domain.set_region(Set_region('dam','stage',0.2,
     89                                 location = 'unique vertices'))
    8990
    90 Br = Reflective_boundary(domain)
    91 Bd = Dirichlet_boundary([tide,0,0])
     91    Br = Reflective_boundary(domain)
     92    Bd = Dirichlet_boundary([tide,0,0])
    9293
    93 #domain.set_boundary( {'wall': Br, 'wave': Bw} )
    94 domain.set_boundary( {'wall': Br, 'wave': Br} )
     94    domain.set_boundary( {'wall': Br, 'wave': Br} )
    9595
    96 #-----------------------------------------------------------------------------
    97 # Evolve system through time
    98 #-----------------------------------------------------------------------------
    99 import time
    100 t0 = time.time()
     96    #-------------------------------------------------------------------------
     97    # Evolve system through time
     98    #-------------------------------------------------------------------------
     99    t0 = time.time()
    101100
    102 for t in domain.evolve(yieldstep = 0.1, finaltime = 15):
    103     domain.write_time()
     101    for t in domain.evolve(yieldstep = 0.1, finaltime = 15):
     102        domain.write_time()
    104103   
    105 print 'That took %.2f seconds' %(time.time()-t0)
     104        print 'That took %.2f seconds' %(time.time()-t0)
     105        print 'finished'
    106106
    107 print 'finished'
     107#-------------------------------------------------------------
     108if __name__ == "__main__":
     109    main()
     110   
Note: See TracChangeset for help on using the changeset viewer.