Changeset 7581
 Timestamp:
 Dec 7, 2009, 9:27:44 PM (13 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

anuga_work/development/classroom/ripcurrent.py
r7580 r7581 1 """Simple water flow example using ANUGA 1 """ANUGA simulation of simple rip current. 2 3 Source: Reference to paper in here 2 4 """ 3 5 … … 18 20 # Parameters 19 21 # 22 20 23 filename = "WORKINGRIPLAB_ExptGeometry_Triangular_Mesh" 24 21 25 location_of_shore = 140 # The position along the y axis of the shorefront 22 26 sandbar = 1.2 # Height of sandbar … … 60 64 verbose = True) 61 65 62 domain.set_name(filename) 66 domain.set_name(filename) # Output name 63 67 print domain.statistics() 64 68 … … 71 75 72 76 # General slope and buildings 73 z=0.05*(y (location_of_shore))77 z=0.05*(ylocation_of_shore) 74 78 75 79 N = len(x) 76 80 for i in range(N): 77 81 if y[i] < 25: 78 z[i] = (0.2*(y[i]25)) + 0.05*(y[i](location_of_shore))82 z[i] = 0.2*(y[i]25) + 0.05*(y[i]location_of_shore) 79 83 for i in range(N): 80 84 if y[i]>150: 81 z[i] = (0.1*(y[i]150)) + 0.05*(y[i](location_of_shore))85 z[i] = 0.1*(y[i]150) + 0.05*(y[i]location_of_shore) 82 86 83 87 return z … … 91 95 # It would be great with a comment about what this does 92 96 for i in range(N): 93 ymin =  1*(bank_slope)*x[i] + 11294 ymax =  1*(bank_slope)*x[i] + 12497 ymin = bank_slope*x[i] + 112 98 ymax = bank_slope*x[i] + 124 95 99 xmin = 0 96 xmax = (length/2)halfchannelwidth100 xmax = length/2halfchannelwidth 97 101 if ymin < y[i] < ymax and xmin < x[i]< xmax: 98 z[i] += sandbar* ((cos((y[i]118)/steepness)))102 z[i] += sandbar*cos((y[i]118)/steepness) 99 103 100 104 # It would be great with a comment about what this does 101 105 for i in range(N): 102 ymin =  1*(bank_slope)*(x[i](length/2)) + (1*(bank_slope)*(length/2)+112)103 ymax =  1*(bank_slope)*(x[i](length/2)) + (1*(bank_slope)*(length/2)+124)104 xmin = (length/2)+halfchannelwidth106 ymin = bank_slope*(x[i]length/2)  bank_slope*length/2 + 112 107 ymax = bank_slope*(x[i]length/2)  bank_slope*length/2 + 124 108 xmin = length/2+halfchannelwidth 105 109 xmax = 183 106 110 if ymin < y[i] < ymax and xmin < x[i] < xmax: 107 z[i] += sandbar* (cos((y[i]118)/steepness))111 z[i] += sandbar*cos((y[i]118)/steepness) 108 112 109 113 return z … … 151 155 gauges = numpy.array(G) 152 156 number_of_gauges = len(gauges) 153 print gauges154 157 155 158 # Allocate space for velocity values … … 168 171 u += uh/depth 169 172 v += vh/depth 170 print 'Evolution took %.2f seconds' % (time.time()t0)171 173 172 174 … … 215 217 v_average = v/n_time_intervals 216 218 217 #print "there were", n_time_intervals, "time steps" 219 print 'There were %i time steps' % n_time_intervals 218 220 219 221 #print "sum y velocity", v 220 #print "average y velocity", v_average222 print "average y velocity", v_average 221 223 #print "sum x velocity", u 222 224 #print "average x velocity", u_average 223 224 x_output = file('x_velocity.txt', 'w')225 y_output = file('y_velocity.txt', 'w')226 227 #print >> x_output, " "228 #print >> y_output, " "229 230 #print >> x_output, u_average231 #print >> y_output, v_average232 225 233 226 … … 235 228 Y = gauges[:,1] 236 229 237 U = u_average .tolist()238 V = v_average .tolist()230 U = u_average #.tolist() 231 V = v_average #.tolist() 239 232 240 233 #print "U = ", U 241 234 #print "U has type", type(U) 235 236 print 'Computation took %.2f seconds' % (time.time()t0) 242 237 243 238
Note: See TracChangeset
for help on using the changeset viewer.