- Timestamp:
- Jun 15, 2010, 5:34:24 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/development/2010-projects/anuga_1d/channel/test_padarn.py
r7839 r7842 2 2 import random 3 3 from math import sqrt, pow, pi ,sin, cos 4 from channel_domain import * 5 from Numeric import allclose, array, zeros, ones, Float, take, sqrt 6 from config import g, epsilon 4 import numpy 5 6 from anuga_1d.channel.channel_domain import * 7 8 from anuga_1d.config import g, epsilon 7 9 8 10 … … 17 19 omega = sqrt(2*g*z_infty)/L_x ## angular frequency of osccilation 18 20 t=0.0 19 y = zeros(len(x),Float)21 y = numpy.zeros(len(x),numpy.float) 20 22 for i in range(len(x)): 21 23 #y[i] = z_infty+2*A0*z_infty/L_x*cos(omega*t)*(x[i]/L_x-0.5*A0/(L_x)*cos(omega*t)) … … 26 28 N = len(x) 27 29 z_infty = 10.0 28 z = zeros(N,Float)30 z = numpy.zeros(N,numpy.float) 29 31 L_x = 2500.0 30 32 A0 = 0.5*L_x … … 35 37 36 38 def initial_area(x): 37 y = zeros(len(x),Float)39 y = numpy.zeros(len(x),numpy.float) 38 40 for i in range(len(x)): 39 41 y[i]=initial_stage([x[i]])-bed([x[i]]) … … 61 63 print "Evaluating domain with %d cells" %N 62 64 cell_len = 4*L/N # Origin = 0.0 63 points = zeros(N+1,Float)65 points = numpy.zeros(N+1,numpy.float) 64 66 for i in range(N+1): 65 67 points[i] = -2*L +i*cell_len … … 95 97 96 98 N = float(N) 97 HeightC = domain.quantities['height'].centroid_values99 HeightC = domain.quantities['height'].centroid_values 98 100 DischargeC = domain.quantities['discharge'].centroid_values 99 C = domain.centroids101 C = domain.centroids 100 102 print 'That took %.2f seconds' %(time.time()-t0) 101 X = domain.vertices 102 HeightQ = domain.quantities['area'].vertex_values 103 VelocityQ = domain.quantities['velocity'].vertex_values 104 x = X.flat 105 z = domain.quantities['elevation'].vertex_values.flat 106 stage=HeightQ.flat+z 103 X = domain.vertices 104 HeightQ = domain.quantities['area'].vertex_values 105 VelocityQ = domain.quantities['velocity'].vertex_values 106 Z = domain.quantities['elevation'].vertex_values 107 Stage = HeightQ + Z 107 108 108 109 … … 113 114 114 115 plot1 = subplot(211) 115 116 plot(x,z,x,stage) 116 plot(X.flat,Z.flat, X.flat,Stage.flat) 117 117 118 118 plot1.set_ylim([-1,35]) … … 122 122 'upper right', shadow=True) 123 123 plot2 = subplot(212) 124 plot( x,VelocityQ.flat)124 plot(X.flat,VelocityQ.flat) 125 125 plot2.set_ylim([-10,10]) 126 126
Note: See TracChangeset
for help on using the changeset viewer.