Changeset 4750
- Timestamp:
- Oct 23, 2007, 4:00:41 PM (17 years ago)
- Location:
- anuga_validation/UQ_runup_2006
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_validation/UQ_runup_2006/create_mesh.py
r4748 r4750 7 7 8 8 9 def generate(mesh_filename, gate_position, flume_length,is_course = False):9 def generate(mesh_filename, gate_position, is_course = False): 10 10 #Basic geometry 11 11 -
anuga_validation/UQ_runup_2006/project.py
r4748 r4750 2 2 Also includes origin for slump scenario. 3 3 """ 4 5 from os import sep, environ, getenv, getcwd 6 import sys 7 from time import localtime, strftime 8 from os import mkdir, access, F_OK 9 10 #Making assumptions about the location of scenario data 11 scenario_dir_name = 'data'+sep+'flumes'+sep+'dam_2007' 12 13 #swollen/ all data output 14 basename = 'source' 15 16 if sys.platform == 'win32': 17 try: 18 home = environ['INUNDATIONHOME'] #Sandpit's parent dir 19 except: 20 home = '.' 21 else: 22 home = getenv('INUNDATIONHOME', sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'risk_assessment_methods_project'+sep+'inundation') 4 basename = "uq" 5 depth_filename = "depth.csv" 6 velocity_x_filename = "velocity_x.csv" 7 velocity_y_filename = "velocity_y.csv" 23 8 24 9 25 if not access(home, F_OK): 26 home = '.' 27 28 #Derive subdirectories and filenames 29 time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir 30 # time = "boom" 31 scenariodir = home+sep+scenario_dir_name 32 outputdir = scenariodir+sep+'output'+sep 33 outputtimedir = outputdir+time+sep 34 meshdir = scenariodir+sep+'meshes'+sep 10 mesh_filename = 'uq-mesh.tsh' 35 11 36 depth_filename = outputtimedir + "depth.csv"37 velocity_x_filename = outputtimedir + "velocity_x.csv"38 velocity_y_filename = outputtimedir + "velocity_y.csv"39 40 41 # creates copy of output dir structure, if it doesn't exist42 if not access(scenariodir,F_OK):43 mkdir (scenariodir)44 45 if not access(meshdir,F_OK):46 mkdir (meshdir)47 48 if not access(outputdir,F_OK):49 mkdir (outputdir)50 51 if not access(outputtimedir,F_OK):52 mkdir (outputtimedir)53 54 codedir = getcwd()+sep55 56 codedirname = codedir + 'project.py'57 58 meshname = meshdir + basename59 60 outputname = outputtimedir + basename #Used by post processing61 62 mesh_filename = meshname+'.tsh'63 -
anuga_validation/UQ_runup_2006/run_dam.py
r4748 r4750 25 25 import create_mesh 26 26 27 import project 28 29 27 30 # Application specific imports 28 31 … … 34 37 inital_depths = [0.2] #can enter multiple initial depths eg [0.1, 0.2] 35 38 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) 45 41 46 42 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 43 def scenario(slope, friction, inital_depth, gate_position): 64 44 65 45 #------------------------------------------------------------------------- … … 68 48 69 49 create_mesh.generate(project.mesh_filename, 70 gate_position, flume_length,71 #is_course=True) # this creates the mesh72 is_course=False) # this creates the mesh50 gate_position, 51 is_course=True) # this creates the mesh 52 #is_course=False) # this creates the mesh 73 53 74 54 head,tail = path.split(project.mesh_filename) 75 copy (project.mesh_filename,76 project.outputtimedir + tail )77 55 #------------------------------------------------------------------------- 78 56 # Setup computational domain … … 86 64 87 65 88 domain.set_name(project.basename + id)89 domain.set_datadir( project.outputtimedir)66 domain.set_name(project.basename) 67 domain.set_datadir('.') 90 68 domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum']) 91 69 domain.set_minimum_storable_height(0.001) … … 123 101 print 'finished' 124 102 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]] 132 104 #------------------------------------------------------------------------- 133 105 # Calculate gauge info 134 106 #------------------------------------------------------------------------- 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", 139 109 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') 143 113 144 114
Note: See TracChangeset
for help on using the changeset viewer.