#Convention for strings representing files # #_file has the extention # #name does not have the extension import time import project 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 pyvolution.least_squares import fit_to_mesh_file, DEFAULT_ALPHA from rotate_buildings import create_mesh #from building_generator import create_mesh from pmesh.mesh import importMeshFromFile meshname = project.meshname outputname = project.outputname t0 = time.time() meshname, triagle_count = cache(create_mesh,(100), {'mesh_file':meshname, 'triangles_in_name':True} ,dependencies = ['rotate_buildings.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 ) domain.set_name(project.basename + '_%d' %triagle_count) domain.set_datadir(project.outputdir) domain.store = True domain.quantities_to_be_stored = ['stage'] 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) #Setup Boundary Conditions print domain.get_boundary_tags() domain.starttime = 0 #Obtained from MOST Br = Reflective_boundary(domain) Bt = Transmissive_boundary(domain) Bd = Dirichlet_boundary([10,0,0]) Bw = Time_boundary(domain=domain, f=lambda t: [(60