#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 create_buildings import create_mesh #from building_generator import create_mesh from pmesh.mesh import importMeshFromFile depth = 3.5 # depth of building side to oncoming wave breadth = 3.5 # breadth of building, width of building to oncoming wave #from loop_buildings import depth meshname = project.meshname outputname = project.outputname t0 = time.time() meshname, triagle_count = cache(create_mesh,(1000,depth), {'mesh_file':meshname, 'triangles_in_name':True} ,dependencies = ['create_buildings.py'] #,evaluate = True ) #meshname = 'test.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 ,evaluate = True ) domain.set_name(project.basename + '_Very_small_BR=%d_%d_%d' %(5, 15, triagle_count)) domain.set_datadir(project.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) #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([20,0,0]) Bdb = Dirichlet_boundary([0,0,0]) Bw = Time_boundary(domain=domain, f=lambda t: [(60