source: trunk/anuga_work/development/gareth/tests/runup/runuplot.py @ 9624

Last change on this file since 9624 was 9022, checked in by davies, 11 years ago

Removing most significant velocity artefacts from dev_audusse

File size: 4.3 KB
Line 
1"""View results of runup.py
2"""
3#---------------
4# Import Modules
5#---------------
6import anuga
7import numpy
8import scipy
9from matplotlib import pyplot as pyplot
10#import util # Routines to read in and work with ANUGA output
11from bal_and import plot_utils as util
12
13p2=util.get_output('runup_v2.sww', minimum_allowed_height=1.0e-03)
14p=util.get_centroids(p2, velocity_extrapolation=True)
15
16#p=util.get_output('runup_v2.sww', minimum_allowed_height=1.0e-03)
17
18#------------------
19# Select line
20#------------------
21py_central=p.y[scipy.argmin(abs(p.y-0.5))]
22v=(p.y==p.y[py_central])
23
24#--------------------
25# Make plot animation
26#--------------------
27pyplot.close() #If the plot is open, there will be problems
28pyplot.ion()
29
30if True:
31    line, = pyplot.plot( (p.x[v].min(),p.x[v].max()) ,(p.xvel[:,v].min(),p.xvel[:,v].max() ) )
32    for i in range(p.xmom.shape[0]):
33        line.set_xdata(p.x[v])
34        line.set_ydata(p.xvel[i,v])
35        pyplot.draw()
36        pyplot.plot( (0,1),(0,0), 'r' )
37        pyplot.title(str(i)+'/200') # : velocity does not converge to zero' )
38        pyplot.xlabel('x')
39        pyplot.ylabel('Velocity (m/s)')
40
41    pyplot.savefig('runup_x_velocities.png')
42
43#pyplot.clf()
44#pyplot.close()
45
46#------------------------------------------------
47# Maximum y velocities -- occurs in output step 3
48#------------------------------------------------
49#print yvel[3,:].max(), yvel[3,:].min()
50#highx=yvel[3,:].argmax()
51#v=(x==x[highx])
52#pyplot.plot(yvel[3,v])
53#pyplot.title('y-velocity is not always zero at the boundaries, e.g. x='+str(x[highx])+' , t=0.3s')
54#pyplot.xlabel('y')
55#pyplot.ylabel('Velocity (m/s)')
56#pyplot.savefig('runup_y_velocities.png')
57
58pyplot.clf()
59pyplot.plot(p.x[v],p.stage[5,v])
60pyplot.plot(p.x[v],p.stage[5,v],'o')
61pyplot.plot(p.x[v],p.elev[v])
62pyplot.xlabel('x (m)')
63pyplot.ylabel('z (m)')
64pyplot.title('Free surface and bed at y==0.5, time = 1.0 second')
65pyplot.savefig('elev_1s_v2.png')
66
67pyplot.clf()
68pyplot.plot(p.x[v],p.xvel[5,v])
69pyplot.plot(p.x[v],p.xvel[5,v],'o')
70pyplot.title('Velocity at y==0.500, time = 1.0 second')
71pyplot.xlabel('x (m)')
72pyplot.ylabel('Velocity (m/s)')
73pyplot.savefig('vel1d_1s_v2.png')
74
75#pyplot.clf()
76#pyplot.plot(x_cent[y_cent==y_cent[80]],xvel_cent[15,y_cent==y_cent[80]])
77#pyplot.plot(x_cent[y_cent==y_cent[80]],xvel_cent[15,y_cent==y_cent[80]],'o')
78#pyplot.title('Velocity at y==0.500, time = 3.0 second')
79#pyplot.xlabel('x (m)')
80#pyplot.ylabel('Velocity (m/s)')
81#pyplot.savefig('vel1d_3s_v2.png')
82#-------------------------------------
83# Final velocities plot
84#-------------------------------------
85#pyplot.clf()
86#pyplot.quiver(x,y,xvel[200,:],yvel[200,:])
87#pyplot.xlabel('x')
88#pyplot.ylabel('y')
89#pyplot.title('The maximum speed is '+ str(vel[200,:].max()) + ' m/s')
90#pyplot.savefig('final_vel_field.png')
91#print vel[200,:].max()
92
93pyplot.clf()
94pyplot.scatter(p.x,p.y,c=p.elev,edgecolors='none', s=25)
95pyplot.colorbar()
96#pyplot.quiver(x_cent,y_cent,xvel_cent[15,:],yvel_cent[15,:])
97#pyplot.title('The maximum speed is '+ str(vel_cent[15,:].max()) + ' m/s at time 3.0s')
98pyplot.quiver(p.x,p.y,p.xvel[5,:],p.yvel[5,:])
99pyplot.title('The maximum speed is '+ str(p.vel[5,:].max()) + ' m/s at time 1.0s')
100pyplot.savefig('vel_1s_v2.png')
101
102pyplot.clf()
103pyplot.scatter(p.x,p.y,c=p.elev,edgecolors='none', s=25)
104pyplot.colorbar()
105#pyplot.quiver(x_cent,y_cent,xvel_cent[150,:],yvel_cent[150,:])
106#pyplot.title('The maximum speed is '+ str(vel_cent[150,:].max()) + ' m/s at time 30.0s')
107pyplot.quiver(p.x,p.y,p.xvel[150,:],p.yvel[150,:])
108pyplot.title('The maximum speed is '+ str(p.vel[150,:].max()) + ' m/s at time 30.0s')
109pyplot.savefig('vel_30s_v2.png')
110
111pyplot.clf()
112pyplot.plot(p.x[v],p.stage[150,v])
113pyplot.plot(p.x[v],p.stage[150,v],'o')
114pyplot.plot(p.x[v],p.elev[v])
115pyplot.xlabel('x (m)')
116pyplot.ylabel('z (m)')
117pyplot.title('Free surface and bed at y==0.5, time = 30.0 second')
118pyplot.savefig('elev_30s_v2.png')
119pyplot.clf()
120pyplot.plot(p.x[v],p.xvel[150,v])
121pyplot.plot(p.x[v],p.xvel[150,v],'o')
122pyplot.title('Velocity at y==0.500, time = 30.0 second')
123pyplot.xlabel('x (m)')
124pyplot.ylabel('Velocity (m/s)')
125pyplot.savefig('vel1d_30s_v2.png')
126#pyplot.clf()
127#pyplot.plot(x_cent[y_cent==y_cent[80]],xvel_cent[150,y_cent==y_cent[80]])
128#pyplot.plot(x_cent[y_cent==y_cent[80]],xvel_cent[150,y_cent==y_cent[80]],'o')
129#pyplot.title('Velocity at y==0.500, time = 30.0 second')
130#pyplot.xlabel('x (m)')
131#pyplot.ylabel('Velocity (m/s)')
132#pyplot.savefig('vel1d_30s_v2.png')
Note: See TracBrowser for help on using the repository browser.