""" File used for looping 'friction block.py' script to create many friction scenarios with variations in Manning's n """ #Convention for strings representing files # #_file has the extention # #name does not have the extension import time import string import project_friction import Numeric from pyvolution.pmesh2domain import pmesh_to_domain_instance from caching import cache from pyvolution.shallow_water import Domain, Reflective_boundary,\ File_boundary, Dirichlet_boundary, Time_boundary, Transmissive_boundary from region import Set_region from pyvolution.least_squares import fit_to_mesh_file, DEFAULT_ALPHA from friction_block import create_mesh from pmesh.mesh import importMeshFromFile # generation of friction value list Friction_large = list(Numeric.arange(1,120,1)) Friction = list(Numeric.arange(0.025,1,0.025)) Friction_log = list([200, 500, 1000, 2000, 5000, 10000]) Friction.extend(Friction_large) Friction.extend(Friction_log) print Friction raw_input('check friction array >>') for fric in Friction: meshname = project_friction.meshname outputname = project_friction.outputname print " " print "_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_" print fric, "Manning friction value" print "-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-" t0 = time.time() #meshname, triagle_count =create_mesh(100,mesh_file=meshname,triangles_in_name=True) meshname, triagle_count = cache(create_mesh,(100), {'mesh_file':meshname, 'triangles_in_name':True} ,dependencies = ['friction_block.py'] #,evaluate = True ) #meshname = 'build.tsh' #outputname = outputname[:-4] + '_' + str(triagle_count) + outputname[-4:] print 'Initialising the mesh took %.2f seconds' %(time.time()-t0) #meshname = importMeshFromFile('build.tsh') #Setup domain domain = cache(pmesh_to_domain_instance, (meshname, Domain), dependencies = [meshname] ,verbose = False ) #fr=str(fric).strip('.') domain.set_name(project_friction.basename + '%s_%d' %(str(fric).strip('.'), triagle_count)) domain.set_datadir(project_friction.outputdir) domain.store = True domain.quantities_to_be_stored = ['stage','xmomentum','ymomentum'] print 'Number of triangles = ', len(domain) print 'The extent is ', domain.get_extent() #Setup Initial Conditions domain.set_quantity('friction', 0.01) domain.set_quantity('stage', 0) domain.set_region(Set_region('mound', 'friction', fric)) #, location='unique vertices')) #Setup Boundary Conditions print domain.get_boundary_tags() domain.starttime = 0 #Obtained from MOST Br = Reflective_boundary(domain) Bt = Transmissive_boundary(domain) Bdw = Dirichlet_boundary([10,0,0]) Bdb = Dirichlet_boundary([0,0,0]) Bw = Time_boundary(domain=domain, f=lambda t: [(60