Changeset 7588
- Timestamp:
- Dec 10, 2009, 11:47:22 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/development/classroom/ripcurrent.py
r7587 r7588 7 7 May 2006 8 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. 9 I will need to make a version which has the exact same geometry as the 10 Georgia Tech wavetank if we wish to use a comparison to the results of 11 this study as ANUGA validation as i played with the geometry somewhat 12 as i completed this model. 12 13 """ 13 14 … … 20 21 from anuga.shallow_water.shallow_water_domain import Time_boundary 21 22 from anuga.shallow_water.data_manager import get_mesh_and_quantities_from_file 22 from pylab import figure, quiver, show, cos, sin, pi 23 from pylab import figure, plot, axis, quiver, quiverkey, show, title, axhline 24 from pylab import cos, sin, pi 23 25 import numpy 24 26 import csv … … 30 32 #------------------------------------------------------------------------------ 31 33 32 filename = "WORKING-RIP-LAB_Expt-Geometry_Triangular_Mesh"34 filename = 'WORKING-RIP-LAB_Expt-Geometry_Triangular_Mesh' 33 35 34 36 location_of_shore = 140 # The position along the y axis of the shorefront … … 86 88 z=0.05*(y-location_of_shore) 87 89 88 # Creates a steeper slope close to the seaward boundary giving a region of deepwater90 # Steeper slope close to the seaward boundary giving a region of deep water 89 91 N = len(x) 90 92 for i in range(N): 91 93 if y[i] < 25: 92 94 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 95 99 for i in range(N): 96 100 if y[i]>150: … … 105 109 N = len(x) 106 110 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) 113 120 for i in range(N): 114 121 ymin = -bank_slope*x[i] + 112 … … 119 126 z[i] += sandbar*cos((y[i]-118)/steepness) 120 127 121 # Set sup the right hand side of the sandbank122 # changing the sign in y min and y max allows the two halves of the sandbank to form a v shape123 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 124 131 for i in range(N): 125 132 ymin = -bank_slope*(x[i]-length/2) - bank_slope*length/2 + 112 … … 135 142 domain.add_quantity('elevation', topography3) # Add elevation modification 136 143 domain.set_quantity('friction', 0.01) # Constant friction 137 domain.set_quantity('stage', 0) # Constant initial condition at mean sea level 144 domain.set_quantity('stage', 0) # Constant initial condition at 145 # mean sea level 138 146 139 147 … … 207 215 print 'Computation took %.2f seconds' % (time.time()-t0) 208 216 209 key_auto_length = (max(V))/5 #makes the key vector a sensible length not sure how to label it with the correct value though210 211 from matplotlib import * 212 from pylab import * 217 key_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 213 221 214 222 figure() 215 223 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'}) 224 qk = 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 218 229 axis([-10,length + 10, -10, width +10]) 219 230 title('Simulation of a Rip-Current, Average Velocity Vector Field') … … 222 233 axhline(y=(location_of_shore),color='r') 223 234 224 x1 = arange(0,55,1)235 x1 = numpy.arange(0,55,1) 225 236 y1 = -(bank_slope)*x1 + 112 226 237 y12 = -(bank_slope)*x1 + 124 227 238 228 x2 = arange(65,length,1)239 x2 = numpy.arange(65,length,1) 229 240 y2 = -(bank_slope)*x2 + 112 230 241 y22 = -(bank_slope)*x2 + 124
Note: See TracChangeset
for help on using the changeset viewer.