Changeset 4007
- Timestamp:
- Nov 17, 2006, 5:04:50 PM (18 years ago)
- 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 tsunami1 """Create mesh for University of Queensland dam break flume 2 2 """ 3 3 … … 8 8 9 9 def 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 """ 10 16 #Basic geometry 11 17 -
anuga_work/development/dam_2006/project.py
r3533 r4007 7 7 from time import localtime, strftime 8 8 from os import mkdir, access, F_OK 9 10 #Making assumptions about the location of scenario data 11 scenario_dir_name = 'dam_2006' 9 from anuga.abstract_2d_finite_volumes.util import add_directories, \ 10 copy_code_files 11 12 12 13 13 #swollen/ all data output … … 16 16 if sys.platform == 'win32': 17 17 try: 18 home = environ['INUNDATIONHOME'] #Sandpit's parent dir 18 home = environ['INUNDATIONHOME'] 19 user = getenv('USERPROFILE') 19 20 except: 20 home = '.' 21 home = '.' 22 user = getenv('LOGNAME') 21 23 else: 22 24 home = getenv('INUNDATIONHOME', sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'risk_assessment_methods_project'+sep+'inundation') … … 26 28 home = '.' 27 29 30 # Create the structure of where the output will go 31 create_scenario_dir = ['data','flumes','dam_2006'] 32 33 scenariodir=add_directories(home, create_scenario_dir) 34 35 28 36 #Derive subdirectories and filenames 29 37 time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir 30 scenariodir = home+sep+scenario_dir_name31 38 outputdir = scenariodir+sep+'output'+sep 32 39 outputtimedir = outputdir+time+sep 33 40 meshdir = scenariodir+sep+'meshes'+sep 41 42 34 43 35 44 depth_filename = outputtimedir + "depth.csv" … … 39 48 40 49 # creates copy of output dir structure, if it doesn't exist 41 if not access(scenariodir,F_OK):42 mkdir (scenariodir)43 44 50 if not access(meshdir,F_OK): 45 51 mkdir (meshdir) … … 51 57 mkdir (outputtimedir) 52 58 53 codedir = getcwd()+sep 54 59 codedir = getcwd()+sep 55 60 codedirname = codedir + 'project.py' 56 61 -
anuga_work/development/dam_2006/run_dam.py
r3642 r4007 14 14 import sys 15 15 from shutil import copy 16 from os import path 16 from os import path, sep 17 from os.path import dirname #, basename 17 18 18 19 # Related major packages 19 20 from anuga.shallow_water import Domain, Reflective_boundary, \ 20 21 Dirichlet_boundary, Time_boundary, File_boundary 21 from anuga.abstract_2d_finite_volumes.util import Screen_Catcher22 22 from anuga.abstract_2d_finite_volumes.region import Set_region 23 23 from anuga.fit_interpolate.interpolate import interpolate_sww2csv 24 from anuga.abstract_2d_finite_volumes.util import start_screen_catcher, \ 25 copy_code_files 26 27 28 # Scenario specific imports 29 import project # Definition of file names and polygons 24 30 import create_mesh 25 26 # Application specific imports27 import project # Definition of file names and polygons28 31 29 32 30 33 def main(): 31 #-------------------------------------------------------------------------32 # Setup archiving of simulations33 #-------------------------------------------------------------------------34 34 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' ) 37 45 copy (project.codedir + 'create_mesh.py', 38 46 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) 40 50 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 46 52 #------------------------------------------------------------------------- 47 53 # Create the triangular mesh 48 54 #------------------------------------------------------------------------- 49 55 50 gate_position = 0.8556 gate_position = 2.0 51 57 create_mesh.generate(project.mesh_filename, 52 58 gate_position, 53 #is_course=True) # this creates the mesh54 is_course=False) # this creates the mesh59 is_course=True) # this creates the mesh 60 #is_course=False) # this creates the mesh 55 61 56 62 head,tail = path.split(project.mesh_filename) … … 88 94 89 95 print 'Available boundary tags', domain.get_boundary_tags() 90 domain.set_region('dam','stage',0. 2,96 domain.set_region('dam','stage',0.15, 91 97 location = 'unique vertices') 92 98 #domain.set_region(Set_region('dam','stage',0.2, … … 102 108 t0 = time.time() 103 109 104 for t in domain.evolve(yieldstep = 0. 1, finaltime = 25):110 for t in domain.evolve(yieldstep = 0.05, finaltime = 10): 105 111 domain.write_time() 106 112
Note: See TracChangeset
for help on using the changeset viewer.