# Changeset 7587

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

 r7583 """ANUGA simulation of simple rip current. Source: Reference to paper in here Source: Geometry and wave properties loosely based on those presented in OBSERVATIONS OF LABORATORY RIP CURRENTS by Brian K. Sapp, School of Civil and Environmental Engineering Georgia Institute of Technology May 2006 I will need to make a version which has the exact same geometry as the Georgia Tech wavetank if we wish to use a comparison to the results of this study as ANUGA validation as i played with the geometry somewhat as i completed this model. """ """Complex topography defined by a function of vectors x and y.""" # General slope and buildings # General slope, sets the shore at the location defined previously z=0.05*(y-location_of_shore) #Creates a steeper slope close to the seaward boundary giving a region of deepwater N = len(x) for i in range(N): if y[i] < 25: z[i] = 0.2*(y[i]-25) + 0.05*(y[i]-location_of_shore) #Creates a steeper slope close to the landward boundary, simulating a beach etc #(helps to prevent too much reflection of wave energy off the landward boundary) for i in range(N): if y[i]>150: N = len(x) # It would be great with a comment about what this does # Sets up the left hand side of the sandbank #amount which it deviates from parallel with the beach is controlled by 'bank_slope' #width of the channel (the gap between the two segments of the sandbank) is controlled by 'halfchannelwidth' #the height of the sandbar is controlled by 'sandbar' #'steepness' provides control over the slope of the soundbar (smaller values give a more rounded shape, if too small will produce peaks and troughs) for i in range(N): ymin = -bank_slope*x[i] + 112 z[i] += sandbar*cos((y[i]-118)/steepness) # It would be great with a comment about what this does # Sets up the right hand side of the sandbank #changing the sign in y min and y max allows the two halves of the sandbank to form a v shape for i in range(N): ymin = -bank_slope*(x[i]-length/2) - bank_slope*length/2 + 112 print 'Computation took %.2f seconds' % (time.time()-t0) key_auto_length = (max(V))/5     #makes the key vector a sensible length not sure how to label it with the correct value though from matplotlib import * from pylab import * figure() quiver(X,Y,U,V) Q = quiver(X,Y,U,V) 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 coordinates='figure', fontproperties={'weight': 'bold'}) axis([-10,length + 10, -10, width +10]) title('Simulation of a Rip-Current, Average Velocity Vector Field') axhline(y=25,color='b') axhline(y=(location_of_shore),color='r') x1 = arange(0,55,1) y1 = -(bank_slope)*x1 + 112 y12 = -(bank_slope)*x1 + 124 x2 = arange(65,length,1) y2 = -(bank_slope)*x2 + 112 y22 = -(bank_slope)*x2 + 124 plot(x1,y1,x1,y12,x2,y2,x2,y22,color='g') show()