Changeset 7587
- Timestamp:
- Dec 9, 2009, 4:51:58 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/development/classroom/ripcurrent.py
r7583 r7587 1 1 """ANUGA simulation of simple rip current. 2 2 3 Source: Reference to paper in here 3 Source: Geometry and wave properties loosely based on those presented in 4 OBSERVATIONS OF LABORATORY RIP CURRENTS by Brian K. Sapp, 5 School of Civil and Environmental Engineering 6 Georgia Institute of Technology 7 May 2006 8 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. 4 12 """ 5 13 … … 75 83 """Complex topography defined by a function of vectors x and y.""" 76 84 77 # General slope and buildings85 # General slope, sets the shore at the location defined previously 78 86 z=0.05*(y-location_of_shore) 79 87 88 #Creates a steeper slope close to the seaward boundary giving a region of deepwater 80 89 N = len(x) 81 90 for i in range(N): 82 91 if y[i] < 25: 83 92 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) 84 95 for i in range(N): 85 96 if y[i]>150: … … 94 105 N = len(x) 95 106 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 97 113 for i in range(N): 98 114 ymin = -bank_slope*x[i] + 112 … … 103 119 z[i] += sandbar*cos((y[i]-118)/steepness) 104 120 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 106 124 for i in range(N): 107 125 ymin = -bank_slope*(x[i]-length/2) - bank_slope*length/2 + 112 … … 189 207 print 'Computation took %.2f seconds' % (time.time()-t0) 190 208 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 * 213 191 214 figure() 192 quiver(X,Y,U,V) 215 Q = 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'}) 218 axis([-10,length + 10, -10, width +10]) 219 title('Simulation of a Rip-Current, Average Velocity Vector Field') 220 221 axhline(y=25,color='b') 222 axhline(y=(location_of_shore),color='r') 223 224 x1 = arange(0,55,1) 225 y1 = -(bank_slope)*x1 + 112 226 y12 = -(bank_slope)*x1 + 124 227 228 x2 = arange(65,length,1) 229 y2 = -(bank_slope)*x2 + 112 230 y22 = -(bank_slope)*x2 + 124 231 232 plot(x1,y1,x1,y12,x2,y2,x2,y22,color='g') 193 233 show() 194 234
Note: See TracChangeset
for help on using the changeset viewer.