Changeset 7583


Ignore:
Timestamp:
Dec 8, 2009, 8:28:50 AM (9 years ago)
Author:
ole
Message:

Simplified version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/development/classroom/ripcurrent.py

    r7582 r7583  
    1212from anuga.shallow_water.shallow_water_domain import Time_boundary
    1313from anuga.shallow_water.data_manager import get_mesh_and_quantities_from_file
    14 from anuga.fit_interpolate.interpolate import Interpolation_function
    1514from pylab import figure, quiver, show, cos, sin, pi
    1615import numpy
     
    6059                                                   'top' :   [2],
    6160                                                   'left':   [3]},
    62                                     maximum_triangle_area = seafloor_resolution,
    63                                     mesh_filename = meshname,
    64                                     interior_regions = feature_regions,
    65                                     use_cache = True,
    66                                     verbose = True)
     61                                    maximum_triangle_area=seafloor_resolution,
     62                                    mesh_filename=meshname,
     63                                    interior_regions=feature_regions,
     64                                    use_cache=True,
     65                                    verbose=True)
    6766                                   
    6867domain.set_name(filename) # Output name
     
    179178#------------------------------------------------------------------------------
    180179
    181 # Get mesh and quantities from sww file
    182 quantity_names = ['elevation'] + domain.conserved_quantities
     180n_time_intervals = simulation_length/timestep
     181print 'There were %i time steps' % n_time_intervals
    183182
    184 X = get_mesh_and_quantities_from_file(domain.get_name() + '.sww',
    185                                       quantities=quantity_names,
    186                                       verbose=True)
    187 
    188 mesh, quantities, timesteps = X
     183U = u/n_time_intervals
     184V = v/n_time_intervals
     185X = gauges[:,0]
     186Y = gauges[:,1]
    189187
    190188
    191 # Interpolate quantities to gauges
    192 I = Interpolation_function(timesteps,
    193                            quantities,
    194                            quantity_names=quantity_names,
    195                            vertex_coordinates=mesh.nodes,
    196                            triangles=mesh.triangles,
    197                            interpolation_points=gauges,
    198                            verbose=True)
    199 
    200 
    201 
    202 # Compute velocity field
    203 #uu = numpy.array(number_of_gauges)
    204 #vv = numpy.array(number_of_gauges)
    205 #for t in timesteps:
    206 #    for i in range(number_of_gauges):
    207 #        elevation, stage, uh, vh = I(t, point_id=i)#
    208 #
    209 #        depth = stage-elevation
    210 #        uu[i] += uh/depth
    211 #        vv[i] += vh/depth
    212 
    213 
    214 n_time_intervals = simulation_length/timestep
    215 u_average = u/n_time_intervals
    216 v_average = v/n_time_intervals
    217 
    218 print 'There were %i time steps' % n_time_intervals
    219 
    220 #print "sum y velocity", v
    221 print "average y velocity", v_average
    222 #print "sum x velocity", u
    223 #print "average x velocity", u_average
    224 
    225 
    226 X = gauges[:,0]
    227 Y = gauges[:,1]
    228                              
    229 U = u_average #.tolist()
    230 V = v_average #.tolist()
    231 
    232 #print "U = ", U
    233 #print "U has type", type(U)
    234 
    235189print 'Computation took %.2f seconds' % (time.time()-t0)
    236 
    237190
    238191figure()
Note: See TracChangeset for help on using the changeset viewer.