source: development/momentum_sink/run_rotate.py @ 2878

Last change on this file since 2878 was 2395, checked in by nicholas, 19 years ago

Updated compare_sww.py. Increased distance of rear boundary and changed to dirichlet

File size: 2.3 KB
RevLine 
[2379]1
2#Convention for strings representing files
3# #_file has the extention
4#           #name does not have the extension
5
6import time
7
8import project
9
10from pyvolution.pmesh2domain import pmesh_to_domain_instance
11from caching import cache
12from pyvolution.shallow_water import Domain, Reflective_boundary,\
13     File_boundary, Dirichlet_boundary, Time_boundary, Transmissive_boundary
14from pyvolution.least_squares import fit_to_mesh_file, DEFAULT_ALPHA
15
16
17from rotate_buildings import create_mesh
18#from building_generator import create_mesh
19
20from pmesh.mesh import importMeshFromFile
21
22meshname = project.meshname
23outputname = project.outputname
24
25t0 = time.time()
26
27meshname, triagle_count = cache(create_mesh,(100),
28                                {'mesh_file':meshname,
29                                 'triangles_in_name':True}
30                                ,dependencies = ['rotate_buildings.py']
31                                #,evaluate = True     
32                                )
33#meshname = 'build.tsh'
34#outputname = outputname[:-4] + '_' + str(triagle_count) + outputname[-4:]
35
36print 'Initialising the mesh took %.2f seconds' %(time.time()-t0) 
37
38
39#meshname = importMeshFromFile('build.tsh')
40
41#Setup domain
42domain = cache(pmesh_to_domain_instance, (meshname, Domain),
43               dependencies = [meshname]                   
44               ,verbose = False
45               )               
46
47
48domain.set_name(project.basename + '_%d' %triagle_count)
49domain.set_datadir(project.outputdir)
50domain.store = True
51domain.quantities_to_be_stored = ['stage']
52
53print 'Number of triangles = ', len(domain)
54print 'The extent is ', domain.get_extent()
55
56#Setup Initial Conditions
57domain.set_quantity('friction', 0.01)
58domain.set_quantity('stage', 0)
59
60#Setup Boundary Conditions
61print domain.get_boundary_tags()
62
63domain.starttime = 0  #Obtained from MOST
64
65Br = Reflective_boundary(domain)
66Bt = Transmissive_boundary(domain)
67Bd = Dirichlet_boundary([10,0,0])
68Bw = Time_boundary(domain=domain,
69                   f=lambda t: [(60<t<660)*4, 0, 0])
70
71domain.set_boundary( {'wall': Br,'wave': Bd, 'back': Bt, 'exterior':Bd} ) 
72
73#Evolve
74t0 = time.time()
75
[2395]76for t in domain.evolve(yieldstep = 1, finaltime = 60):
[2379]77    domain.write_time()     
78
79print 'That took %.2f seconds' %(time.time()-t0)
Note: See TracBrowser for help on using the repository browser.