Changeset 7582


Ignore:
Timestamp:
Dec 7, 2009, 9:46:15 PM (9 years ago)
Author:
ole
Message:

Work in progress

File:
1 edited

Legend:

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

    r7581 r7582  
    1111from anuga.shallow_water.shallow_water_domain import Reflective_boundary
    1212from anuga.shallow_water.shallow_water_domain import Time_boundary
     13from anuga.shallow_water.data_manager import get_mesh_and_quantities_from_file
     14from anuga.fit_interpolate.interpolate import Interpolation_function
    1315from pylab import figure, quiver, show, cos, sin, pi
    1416import numpy
     
    175177#------------------------------------------------------------------------------
    176178# Post processing
    177 #------------------------------------------------------------------------------   
    178 
    179 # Use this
    180 
    181 #     from anuga.fit_interpolate.interpolate import Interpolation_function
    182 
    183 #     # Get mesh and quantities from sww file
    184 #     X = get_mesh_and_quantities_from_file(filename,
    185 #                                           quantities=quantity_names,
    186 #                                           verbose=verbose)
    187 #     mesh, quantities, time = X
    188 
    189 #     # Find all intersections and associated triangles.
    190 #     segments = mesh.get_intersecting_segments(polyline, verbose=verbose)
    191 
    192 #     # Get midpoints
    193 #     interpolation_points = segment_midpoints(segments)
    194 
    195 #     # Interpolate
    196 #     if verbose:
    197 #         log.critical('Interpolating - total number of interpolation points = %d'
    198 #                      % len(interpolation_points))
    199 
    200 #     I = Interpolation_function(time,
    201 #                                quantities,
    202 #                                quantity_names=quantity_names,
    203 #                                vertex_coordinates=mesh.nodes,
    204 #                                triangles=mesh.triangles,
    205 #                                interpolation_points=interpolation_points,
    206 #                                verbose=verbose)
    207 
    208 #     return segments, I
    209 
    210 
    211 
    212 
     179#------------------------------------------------------------------------------
     180
     181# Get mesh and quantities from sww file
     182quantity_names = ['elevation'] + domain.conserved_quantities
     183
     184X = get_mesh_and_quantities_from_file(domain.get_name() + '.sww',
     185                                      quantities=quantity_names,
     186                                      verbose=True)
     187
     188mesh, quantities, timesteps = X
     189
     190
     191# Interpolate quantities to gauges
     192I = 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
    213212
    214213
Note: See TracChangeset for help on using the changeset viewer.