Ignore:
Timestamp:
Oct 23, 2007, 4:00:41 PM (17 years ago)
Author:
duncan
Message:

simplify

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_validation/UQ_runup_2006/run_dam.py

    r4748 r4750  
    2525import create_mesh
    2626
     27import project
     28
     29
    2730# Application specific imports
    2831
     
    3437    inital_depths = [0.2] #can enter multiple initial depths eg [0.1, 0.2]
    3538    gate_positions = [0.75]
    36     flume_lengths = [3] #can enter multiple flume lengths eg [3.0, 5.0]
    37     # NOTE flume_lengths is not used.  It's hardcoded into create_mesh
    38    
    39     for slope in slopes:
    40         for friction in frictions:
    41             for inital_depth in inital_depths:
    42                 for flume_length in flume_lengths:
    43                     for gate_position in gate_positions:
    44                         scenario(slope, friction, inital_depth, gate_position, flume_length)
     39   
     40    scenario(0, 0.01, 0.02, 0.75)
    4541           
    4642
    47 def scenario(slope, friction, inital_depth, gate_position, flume_length):
    48    
    49     import project                 # Definition of file names and polygons
    50 
    51     #-------------------------------------------------------------------------
    52     # Setup archiving of simulations
    53     #-------------------------------------------------------------------------
    54 
    55     id = 'd'+ str(inital_depth) + '_s'+str(slope)+'_g'+ str(gate_position)+ '_n'+ str(friction)
    56     copy (project.codedirname, project.outputtimedir + 'project.py')
    57     run_name = 'run_dam.py'
    58     run_name_out = 'run_dam'+id+'.py'
    59 
    60     copy (project.codedir + run_name, project.outputtimedir + run_name_out)
    61     copy (project.codedir + 'create_mesh.py',
    62           project.outputtimedir + 'create_mesh.py')
    63     print'output dir', project.outputtimedir
     43def scenario(slope, friction, inital_depth, gate_position):
    6444
    6545    #-------------------------------------------------------------------------
     
    6848
    6949    create_mesh.generate(project.mesh_filename,
    70                          gate_position, flume_length,
    71                          #is_course=True) # this creates the mesh
    72                          is_course=False) # this creates the mesh
     50                         gate_position,
     51                         is_course=True) # this creates the mesh
     52                         #is_course=False) # this creates the mesh
    7353
    7454    head,tail = path.split(project.mesh_filename)
    75     copy (project.mesh_filename,
    76           project.outputtimedir + tail )
    7755    #-------------------------------------------------------------------------
    7856    # Setup computational domain
     
    8664
    8765   
    88     domain.set_name(project.basename + id)
    89     domain.set_datadir(project.outputtimedir)
     66    domain.set_name(project.basename)
     67    domain.set_datadir('.')
    9068    domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
    9169    domain.set_minimum_storable_height(0.001)
     
    123101        print 'finished'
    124102       
    125     points = [[gate_position - 0.65,0.2],
    126               [gate_position - 0.55,0.2],
    127               [gate_position - 0.45,0.2],
    128               [gate_position - 0.35,0.2],
    129               [0.45,0.2],
    130               [gate_position - 0.25,0.2]
    131               ]
     103    points = [[0.4,0.2]]
    132104    #-------------------------------------------------------------------------
    133105    # Calculate gauge info
    134106    #-------------------------------------------------------------------------
    135     print "name", project.outputtimedir + project.basename \
    136                    + id+".sww"
    137     interpolate_sww2csv(project.outputtimedir + project.basename \
    138                    + id+".sww",
     107    print "name",project.basename +".sww"
     108    interpolate_sww2csv( project.basename +".sww",
    139109                        points,
    140                         project.depth_filename + id + '.csv',
    141                         project.velocity_x_filename + id + '.csv',
    142                         project.velocity_y_filename + id + '.csv')
     110                        project.depth_filename + '.csv',
     111                        project.velocity_x_filename + '.csv',
     112                        project.velocity_y_filename + '.csv')
    143113
    144114
Note: See TracChangeset for help on using the changeset viewer.