source: trunk/anuga_work/development/carrier_greenspan/plot_results.py @ 8990

Last change on this file since 8990 was 8594, checked in by mungkasi, 12 years ago

Uploading the 1D Carrier-Greenspan test for 2D model.

File size: 3.5 KB
Line 
1"""
2    Quick plot of the Carrier-Greenspan outputs
3
4"""
5import anuga.utilities.plot_utils as util
6from matplotlib import pyplot as pyplot
7from carrier_greenspan_analytic import *
8
9p_st = util.get_output('carrier_greenspan.sww')
10p2_st=util.get_centroids(p_st)
11
12v = p2_st.y[10]
13v2=(p2_st.y==v)
14
15W1, P1, Z1, H1, U1 = analytic_cg(p2_st.x[v2], p2_st.time[55], h0=5e2, L=5e4, a=1.0, Tp=900.0)
16W2, P2, Z2, H2, U2 = analytic_cg(p2_st.x[v2], p2_st.time[56], h0=5e2, L=5e4, a=1.0, Tp=900.0)
17W3, P3, Z3, H3, U3 = analytic_cg(p2_st.x[v2], p2_st.time[57], h0=5e2, L=5e4, a=1.0, Tp=900.0)
18W4, P4, Z4, H4, U4 = analytic_cg(p2_st.x[v2], p2_st.time[58], h0=5e2, L=5e4, a=1.0, Tp=900.0)
19W5, P5, Z5, H5, U5 = analytic_cg(p2_st.x[v2], p2_st.time[59], h0=5e2, L=5e4, a=1.0, Tp=900.0)
20W6, P6, Z6, H6, U6 = analytic_cg(p2_st.x[v2], p2_st.time[60], h0=5e2, L=5e4, a=1.0, Tp=900.0)
21
22#Plot the stages##############################################################
23pyplot.clf()
24pyplot.ion()
25pyplot.plot(p2_st.x[v2], p2_st.stage[55,v2], 'b.', label='numerical') # 1*T/6
26pyplot.plot(p2_st.x[v2], p2_st.stage[56,v2], 'b.')                    # 2*T/6
27pyplot.plot(p2_st.x[v2], p2_st.stage[57,v2], 'b.')                     # 3*T/6
28pyplot.plot(p2_st.x[v2], p2_st.stage[58,v2], 'b.')                     # 4*T/6
29pyplot.plot(p2_st.x[v2], p2_st.stage[59,v2], 'b.')                     # 5*T/6
30pyplot.plot(p2_st.x[v2], p2_st.stage[60,v2], 'b.')  # 6*T/6
31
32pyplot.plot(p2_st.x[v2], W1,'r-', label='analytical')
33pyplot.plot(p2_st.x[v2], W2,'r-')
34pyplot.plot(p2_st.x[v2], W3,'r-')
35pyplot.plot(p2_st.x[v2], W4,'r-')
36pyplot.plot(p2_st.x[v2], W5,'r-')
37pyplot.plot(p2_st.x[v2], W6,'r-')
38
39
40pyplot.title('Stage at several instants in time')
41pyplot.ylim(-5.0,5.0)
42pyplot.legend(loc=2)
43pyplot.savefig('stage_plot.png')
44
45
46#Plot the momentums##########################################################
47pyplot.clf()
48pyplot.ion()
49pyplot.plot(p2_st.x[v2], p2_st.xmom[55,v2], 'b.', label='numerical') # 1*T/6
50pyplot.plot(p2_st.x[v2], p2_st.xmom[56,v2], 'b.')                    # 2*T/6
51pyplot.plot(p2_st.x[v2], p2_st.xmom[57,v2], 'b.')                     # 3*T/6
52pyplot.plot(p2_st.x[v2], p2_st.xmom[58,v2], 'b.')                     # 4*T/6
53pyplot.plot(p2_st.x[v2], p2_st.xmom[59,v2], 'b.')                     # 5*T/6
54pyplot.plot(p2_st.x[v2], p2_st.xmom[60,v2], 'b.')  # 6*T/6
55
56pyplot.plot(p2_st.x[v2], P1,'r-', label='analytical')
57pyplot.plot(p2_st.x[v2], P2,'r-')
58pyplot.plot(p2_st.x[v2], P3,'r-')
59pyplot.plot(p2_st.x[v2], P4,'r-')
60pyplot.plot(p2_st.x[v2], P5,'r-')
61pyplot.plot(p2_st.x[v2], P6,'r-')
62
63pyplot.title('Xmomentum at several instants in time')
64pyplot.legend(loc=4)
65pyplot.savefig('xmom_plot.png')
66
67
68
69#Plot the velocities#########################################################
70pyplot.clf()
71pyplot.ion()
72pyplot.plot(p2_st.x[v2], p2_st.xvel[55,v2], 'b.', label='numerical') # 1*T/6
73pyplot.plot(p2_st.x[v2], p2_st.xvel[56,v2], 'b.')                    # 2*T/6
74pyplot.plot(p2_st.x[v2], p2_st.xvel[57,v2], 'b.')                     # 3*T/6
75pyplot.plot(p2_st.x[v2], p2_st.xvel[58,v2], 'b.')                     # 4*T/6
76pyplot.plot(p2_st.x[v2], p2_st.xvel[59,v2], 'b.')                     # 5*T/6
77pyplot.plot(p2_st.x[v2], p2_st.xvel[60,v2], 'b.')  # 6*T/6
78
79pyplot.plot(p2_st.x[v2], U1,'r-', label='analytical')
80pyplot.plot(p2_st.x[v2], U2,'r-')
81pyplot.plot(p2_st.x[v2], U3,'r-')
82pyplot.plot(p2_st.x[v2], U4,'r-')
83pyplot.plot(p2_st.x[v2], U5,'r-')
84pyplot.plot(p2_st.x[v2], U6,'r-')
85
86pyplot.title('Velocity at several instants in time')
87pyplot.legend(loc=3)
88pyplot.savefig('xvel_plot.png')
89
Note: See TracBrowser for help on using the repository browser.