Changeset 8073 for trunk/anuga_work


Ignore:
Timestamp:
Nov 19, 2010, 2:53:46 PM (14 years ago)
Author:
steve
Message:

Added in a unit test for inlet operator

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  
    7575
    7676
    77 finaltime = 4.0
    78 yieldstep = 0.1
     77finaltime = 20.0
     78yieldstep = 1.0
    7979L = 2000.0     # Length of channel (m)
    8080
    8181k = 0
    8282
    83 N = 3200
     83N = 10000
    8484print "Evaluating domain with %d cells" %N
    8585domain = Domain(*uniform_mesh(N,x_1=L))
  • trunk/anuga_work/development/2010-projects/anuga_1d/sww/run_parabolic_canal.py

    r7884 r8073  
    2828
    2929L_x = 2500.0     # Length of channel (m)
    30 N = 400         # Number of compuational cells
     30N = 1000         # Number of compuational cells
    3131cell_len = 4*L_x/N   # Origin = 0.0
    3232
  • trunk/anuga_work/development/2010-projects/kv/profiling.py

    r8051 r8073  
    1 from anuga.abstract_2d_finite_volumes.domain import Domain
     1from anuga.abstract_2d_finite_volumes.generic_domain import Generic_Domain
    22import anuga.abstract_2d_finite_volumes.mesh_factory as mesh_factory
    33import anuga.abstract_2d_finite_volumes.neighbour_mesh as neighbour_mesh
     
    77import anuga.utilities.log as log
    88
    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
     10print "Setting up"
     11grid_rows = 40
     12grid_cols = 40
     13#Set up a rectangular grid
     14points,elements,boundary = mesh_factory.rectangular_cross(grid_rows,grid_cols)
     15mesh = neighbour_mesh.Mesh(points,elements)
     16n = len(mesh)
     17print "n =",n
     18boundary_map = {}
     19for (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
     25domain = Generic_Domain(source=points,triangles=elements,boundary=boundary_map)
     26KV_Operator = Kinematic_Viscosity_Operator(domain)
     27print "Applying stage heights"
     28#Set up the operator and RHS
     29h = num.ones((n,),num.float)
     30   
     31def solve():   
    3032    KV_Operator.apply_stage_heights(h)
    3133    rhs = num.zeros((n,2),num.float) #we will solve for u and v
     
    3840import profile, pstats
    3941FN = 'kv_profile.dat'
    40 print "Starting..."
    41 profile.run('evolve()', FN)
     42print "Starting solve..."
     43profile.run('solve()', FN)
    4244S = pstats.Stats(FN)
    4345s = S.sort_stats('cumulative').print_stats(30)
Note: See TracChangeset for help on using the changeset viewer.