Changeset 7587


Ignore:
Timestamp:
Dec 9, 2009, 4:51:58 PM (15 years ago)
Author:
ole
Message:

Rohan's comments and additions

File:
1 edited

Legend:

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

    r7583 r7587  
    11"""ANUGA simulation of simple rip current.
    22
    3 Source: Reference to paper in here
     3Source: Geometry and wave properties loosely based on those presented in
     4OBSERVATIONS OF LABORATORY RIP CURRENTS by Brian K. Sapp,
     5School of Civil and Environmental Engineering
     6Georgia Institute of Technology
     7May 2006
     8
     9I will need to make a version which has the exact same geometry as the Georgia Tech wavetank
     10if we wish to use a comparison to the results of this study as ANUGA validation as i played
     11with the geometry somewhat as i completed this model.
    412"""
    513
     
    7583    """Complex topography defined by a function of vectors x and y."""
    7684
    77     # General slope and buildings
     85    # General slope, sets the shore at the location defined previously
    7886    z=0.05*(y-location_of_shore)
    79    
     87
     88    #Creates a steeper slope close to the seaward boundary giving a region of deepwater
    8089    N = len(x)
    8190    for i in range(N):
    8291        if y[i] < 25:
    8392            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)         
    8495    for i in range(N):
    8596        if y[i]>150:
     
    94105    N = len(x)
    95106   
    96     # It would be great with a comment about what this does
     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   
    97113    for i in range(N):
    98114        ymin = -bank_slope*x[i] + 112
     
    103119            z[i] += sandbar*cos((y[i]-118)/steepness)
    104120   
    105     # It would be great with a comment about what this does       
     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   
    106124    for i in range(N):
    107125        ymin = -bank_slope*(x[i]-length/2) - bank_slope*length/2 + 112
     
    189207print 'Computation took %.2f seconds' % (time.time()-t0)
    190208
     209key_auto_length = (max(V))/5     #makes the key vector a sensible length not sure how to label it with the correct value though
     210
     211from matplotlib import *
     212from pylab import *
     213
    191214figure()
    192 quiver(X,Y,U,V)
     215Q = quiver(X,Y,U,V)
     216qk = 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'})
     218axis([-10,length + 10, -10, width +10])
     219title('Simulation of a Rip-Current, Average Velocity Vector Field')
     220
     221axhline(y=25,color='b')
     222axhline(y=(location_of_shore),color='r')
     223
     224x1 = arange(0,55,1)
     225y1 = -(bank_slope)*x1 + 112
     226y12 = -(bank_slope)*x1 + 124
     227
     228x2 = arange(65,length,1)
     229y2 = -(bank_slope)*x2 + 112
     230y22 = -(bank_slope)*x2 + 124
     231
     232plot(x1,y1,x1,y12,x2,y2,x2,y22,color='g')
    193233show()
    194234
Note: See TracChangeset for help on using the changeset viewer.