Changeset 8073 for trunk/anuga_work
- Timestamp:
- Nov 19, 2010, 2:53:46 PM (14 years ago)
- Location:
- trunk/anuga_work/development/2010-projects
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_work/development/2010-projects/anuga_1d/sww/run_dry_dam.py
r7884 r8073 75 75 76 76 77 finaltime = 4.078 yieldstep = 0.177 finaltime = 20.0 78 yieldstep = 1.0 79 79 L = 2000.0 # Length of channel (m) 80 80 81 81 k = 0 82 82 83 N = 320083 N = 10000 84 84 print "Evaluating domain with %d cells" %N 85 85 domain = Domain(*uniform_mesh(N,x_1=L)) -
trunk/anuga_work/development/2010-projects/anuga_1d/sww/run_parabolic_canal.py
r7884 r8073 28 28 29 29 L_x = 2500.0 # Length of channel (m) 30 N = 400 # Number of compuational cells30 N = 1000 # Number of compuational cells 31 31 cell_len = 4*L_x/N # Origin = 0.0 32 32 -
trunk/anuga_work/development/2010-projects/kv/profiling.py
r8051 r8073 1 from anuga.abstract_2d_finite_volumes. domain importDomain1 from anuga.abstract_2d_finite_volumes.generic_domain import Generic_Domain 2 2 import anuga.abstract_2d_finite_volumes.mesh_factory as mesh_factory 3 3 import anuga.abstract_2d_finite_volumes.neighbour_mesh as neighbour_mesh … … 7 7 import anuga.utilities.log as log 8 8 9 def evolve(): 10 print "Setting up" 11 grid_rows = 40 12 grid_cols = 40 13 #Set up a rectangular grid 14 points,elements,boundary = mesh_factory.rectangular_cross(grid_rows,grid_cols) 15 mesh = neighbour_mesh.Mesh(points,elements) 16 n = len(mesh) 17 print "n =",n 18 boundary_map = {} 19 for (vol_id,edge) in boundary.keys(): 20 x = mesh.get_edge_midpoint_coordinate(vol_id,edge)[0] 21 y = mesh.get_edge_midpoint_coordinate(vol_id,edge)[1] 22 #Define boundary conditions: u=x^2-y^2, v=x-y+2 23 boundary_map[(vol_id,edge)] = Dirichlet_boundary([1,x*x-y*y,x-y+2]) 24 #Now define an operator 25 domain = Domain(source=points,triangles=elements,boundary=boundary_map) 26 KV_Operator = Kinematic_Viscosity_Operator(domain) 27 print "Applying stage heights" 28 #Set up the operator and RHS 29 h = num.ones((n,),num.float) 9 10 print "Setting up" 11 grid_rows = 40 12 grid_cols = 40 13 #Set up a rectangular grid 14 points,elements,boundary = mesh_factory.rectangular_cross(grid_rows,grid_cols) 15 mesh = neighbour_mesh.Mesh(points,elements) 16 n = len(mesh) 17 print "n =",n 18 boundary_map = {} 19 for (vol_id,edge) in boundary.keys(): 20 x = mesh.get_edge_midpoint_coordinate(vol_id,edge)[0] 21 y = mesh.get_edge_midpoint_coordinate(vol_id,edge)[1] 22 #Define boundary conditions: u=x^2-y^2, v=x-y+2 23 boundary_map[(vol_id,edge)] = Dirichlet_boundary([1,x*x-y*y,x-y+2]) 24 #Now define an operator 25 domain = Generic_Domain(source=points,triangles=elements,boundary=boundary_map) 26 KV_Operator = Kinematic_Viscosity_Operator(domain) 27 print "Applying stage heights" 28 #Set up the operator and RHS 29 h = num.ones((n,),num.float) 30 31 def solve(): 30 32 KV_Operator.apply_stage_heights(h) 31 33 rhs = num.zeros((n,2),num.float) #we will solve for u and v … … 38 40 import profile, pstats 39 41 FN = 'kv_profile.dat' 40 print "Starting ..."41 profile.run(' evolve()', FN)42 print "Starting solve..." 43 profile.run('solve()', FN) 42 44 S = pstats.Stats(FN) 43 45 s = S.sort_stats('cumulative').print_stats(30)
Note: See TracChangeset
for help on using the changeset viewer.