Changeset 7588


Ignore:
Timestamp:
Dec 10, 2009, 11:47:22 AM (14 years ago)
Author:
ole
Message:

Clean up

File:
1 edited

Legend:

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

    r7587 r7588  
    77May 2006
    88
    9 I will need to make a version which has the exact same geometry as the Georgia Tech wavetank
    10 if we wish to use a comparison to the results of this study as ANUGA validation as i played
    11 with the geometry somewhat as i completed this model.
     9I will need to make a version which has the exact same geometry as the
     10Georgia Tech wavetank if we wish to use a comparison to the results of
     11this study as ANUGA validation as i played with the geometry somewhat
     12as i completed this model.
    1213"""
    1314
     
    2021from anuga.shallow_water.shallow_water_domain import Time_boundary
    2122from anuga.shallow_water.data_manager import get_mesh_and_quantities_from_file
    22 from pylab import figure, quiver, show, cos, sin, pi
     23from pylab import figure, plot, axis, quiver, quiverkey, show, title, axhline
     24from pylab import cos, sin, pi
    2325import numpy
    2426import csv
     
    3032#------------------------------------------------------------------------------
    3133
    32 filename = "WORKING-RIP-LAB_Expt-Geometry_Triangular_Mesh"
     34filename = 'WORKING-RIP-LAB_Expt-Geometry_Triangular_Mesh'
    3335
    3436location_of_shore = 140 # The position along the y axis of the shorefront
     
    8688    z=0.05*(y-location_of_shore)
    8789
    88     #Creates a steeper slope close to the seaward boundary giving a region of deepwater
     90    # Steeper slope close to the seaward boundary giving a region of deep water
    8991    N = len(x)
    9092    for i in range(N):
    9193        if y[i] < 25:
    9294            z[i] = 0.2*(y[i]-25) + 0.05*(y[i]-location_of_shore)
    93     #Creates a steeper slope close to the landward boundary, simulating a beach etc
    94     #(helps to prevent too much reflection of wave energy off the landward boundary)         
     95           
     96    # Steeper slope close to the landward boundary, simulating a beach etc
     97    # This helps to prevent too much reflection of wave energy off the
     98    # landward boundary         
    9599    for i in range(N):
    96100        if y[i]>150:
     
    105109    N = len(x)
    106110   
    107     # Sets up the left hand side of the sandbank
    108     #amount which it deviates from parallel with the beach is controlled by 'bank_slope'
    109     #width of the channel (the gap between the two segments of the sandbank) is controlled by 'halfchannelwidth'
    110     #the height of the sandbar is controlled by 'sandbar'
    111     #'steepness' provides control over the slope of the soundbar (smaller values give a more rounded shape, if too small will produce peaks and troughs)
    112    
     111    # Set up the left hand side of the sandbank
     112    # amount which it deviates from parallel with the beach is controlled
     113    # by 'bank_slope'
     114    # width of the channel (the gap between the two segments of the sandbank)
     115    # is controlled by 'halfchannelwidth'
     116    # The height of the sandbar is controlled by 'sandbar'
     117    # 'steepness' provides control over the slope of the soundbar
     118    # (smaller values give a more rounded shape, if too small will produce
     119    # peaks and troughs)
    113120    for i in range(N):
    114121        ymin = -bank_slope*x[i] + 112
     
    119126            z[i] += sandbar*cos((y[i]-118)/steepness)
    120127   
    121     # Sets up the right hand side of the sandbank
    122     #changing the sign in y min and y max allows the two halves of the sandbank to form a v shape
    123    
     128    # Set up the right hand side of the sandbank
     129    # changing the sign in y min and y max allows the two halves of the
     130    # sandbank to form a v shape
    124131    for i in range(N):
    125132        ymin = -bank_slope*(x[i]-length/2) - bank_slope*length/2 + 112
     
    135142domain.add_quantity('elevation', topography3) # Add elevation modification
    136143domain.set_quantity('friction', 0.01)         # Constant friction
    137 domain.set_quantity('stage', 0)               # Constant initial condition at mean sea level
     144domain.set_quantity('stage', 0)               # Constant initial condition at
     145                                              # mean sea level
    138146
    139147
     
    207215print 'Computation took %.2f seconds' % (time.time()-t0)
    208216
    209 key_auto_length = (max(V))/5     #makes the key vector a sensible length not sure how to label it with the correct value though
    210 
    211 from matplotlib import *
    212 from pylab import *
     217key_auto_length = (max(V))/5 # Make the key vector a sensible length not
     218                             # sure how to label it with the correct value
     219                             # though
     220
    213221
    214222figure()
    215223Q = quiver(X,Y,U,V)
    216 qk = quiverkey(Q,0.8,0.05,key_auto_length,r'$unknown \frac{m}{s}$',labelpos='E',        #need to get the label to show the value of key_auto_length
    217                coordinates='figure', fontproperties={'weight': 'bold'})
     224qk = quiverkey(Q, 0.8, 0.05, key_auto_length, r'$unknown \frac{m}{s}$',
     225               labelpos='E', # Need to get the label to show the value of key_auto_length
     226               coordinates='figure',
     227               fontproperties={'weight': 'bold'})
     228               
    218229axis([-10,length + 10, -10, width +10])
    219230title('Simulation of a Rip-Current, Average Velocity Vector Field')
     
    222233axhline(y=(location_of_shore),color='r')
    223234
    224 x1 = arange(0,55,1)
     235x1 = numpy.arange(0,55,1)
    225236y1 = -(bank_slope)*x1 + 112
    226237y12 = -(bank_slope)*x1 + 124
    227238
    228 x2 = arange(65,length,1)
     239x2 = numpy.arange(65,length,1)
    229240y2 = -(bank_slope)*x2 + 112
    230241y22 = -(bank_slope)*x2 + 124
Note: See TracChangeset for help on using the changeset viewer.