-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplotscript1.py
More file actions
360 lines (294 loc) · 16.7 KB
/
plotscript1.py
File metadata and controls
360 lines (294 loc) · 16.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
from __future__ import division
import math as m
import csv
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
from matplotlib.path import Path
import matplotlib.cm as cm
import averaging as av
import time
import pickle
import copy
# 1) axial power profile
# 2) axial temperature and density
# 3) plotonium
# 4) flux plot
# 5) axial temp case 1 all burnup
# 6) cladtempplot
# 7) temperature plots with actual data
# 8) averaing
# 9) case 0 stuff
# 10) crud plots
### how to use this script:
# run loading.py
# run plotscript.py once (auxillary functions....)
# assign a number (or list) to plotcase: plotcase=[8]
# same for subcase
# 'run -i plotscript'
# sometimes additional scripts need to be run before, see comments
if 1 in plotcase: #linwoper
if 1 in subcase:
figure()
axis=plt.subplot(111)
ph=[[0,0],[0,0]]
c=['b', 'g', 'r']
ii=[0,9]
for i in range(len(ii)):
ph[i][0],=step(z_mesh,Stepper(LinPow(tp,0,ii[i]),0)/1000,color='b',where='post')
ph[i][1],=step(z_mesh,Stepper(LinPow(tp,1,ii[i]),0)/1000,lw=2,color='g',where='post')
a=max(abs((LinPow(tp,1,ii[i])-LinPow(tp,0,ii[i]))/LinPow(tp,0,ii[i])))
print 'maximum deviation for bu='+str((ii[i]+1)*50)+': '+str(a)
axis.yaxis.grid(True,'major',linewidth=1,color=[0.7,0.7,0.7])
axis.xaxis.grid(True,'major',linewidth=1,color=[0.7,0.7,0.7])
axis.set_ylabel('linear Power, [kW/m]' ,size=14)
axis.set_xlabel('axial position, [m]',size=14)
axis.annotate('50 EFPD', xy=(0.6, 36),size=16,color=[0.5,0.5,0.5])
axis.annotate('500 EFPD', xy=(1.6, 26),size=16,color=[0.5,0.5,0.5])
l=legend([ph[0][0],ph[0][1]],["case 0","case 1"],loc=1)
axis.set_xlim([0,3.6576])
savefig('V:\\master report\\figures\\powercycle1.eps')
axis.set_title('Linear Power development with burnup \n case 0 and 1',size=18)
tight_layout()
savefig('D:\\dropbox\\Dropbox\\plots\\case1\\powercycle.png')
#axis.set_ylim([500,1200])
show()
if 1.5 in subcase: #relative linpow diff
figure()
axis=plt.subplot(111)
plt.axhline(y=0,color=[0.5,0.5,0.5])
ph=[0,0,0]
c=['b', 'g', 'r','c']
ii=[8]
ls1=['-','-']
for i in range(len(ii)):
ph[0],=step(z_mesh,Stepper((LinPow(tp,1,ii[i]) *(dot(LinPow(tp,0,ii[i]),z_mesh2)/dot(LinPow(tp,1,ii[i]),z_mesh2)) -LinPow(tp,0,ii[i]))/LinPow(tp,0,ii[i]),0),ls=ls1[i],color='b',where='post')
ph[1],=step(z_mesh,Stepper((LinPow(tp,2,ii[i]) *(dot(LinPow(tp,0,ii[i]),z_mesh2)/dot(LinPow(tp,2,ii[i]),z_mesh2)) -LinPow(tp,0,ii[i]))/LinPow(tp,0,ii[i]),0),ls=ls1[i],color='g',where='post')
ph[2],=step(z_mesh,Stepper((LinPow(tp,3,ii[i])*3*4 *(dot(LinPow(tp,0,ii[i]),z_mesh2)/dot(LinPow(tp,3,ii[i])*3*4,z_mesh2)) -LinPow(tp,0,ii[i]))/LinPow(tp,0,ii[i]),0),ls=ls1[i],color='r',where='post')
#step(z_mesh,Stepper((PuDens(tpu[1,case[i],:,:,:,0],3)-PuDens(tpu[0,case[i],:,:,:,0],30))/PuDens(tpu[0,case[i],:,:,:,0],30),0),where='post')
axis.yaxis.grid(True,'major',linewidth=1,color=[0.7,0.7,0.7])
axis.xaxis.grid(True,'major',linewidth=1,color=[0.7,0.7,0.7])
#axis.set_ylim([-0.04,0.04])
axis.set_ylabel('relative difference, [-]' ,size=14)
axis.set_xlabel('axial position, [m]',size=14)
axis.annotate('450 EFPD', xy=(1.5, 0.025),size=16,color=[0.5,0.5,0.5])
#axis.annotate('50 EFPD', xy=(1.5, -0.006),size=16,color=[0.5,0.5,0.5])
l=legend([ph[0],ph[1],ph[2]],["case 1","case 2","case 3"],loc=3)
axis.set_xlim([0,3.6576])
tight_layout()
savefig('V:\\master report\\figures\\linpowrel1.pdf')
axis.set_title('Relative difference in linear power of cases 1-3 to case 0',size=18)
tight_layout()
savefig('D:\dropbox\Dropbox\plots\case0\linpowrel1.png')
show()
if 3 in plotcase:
if 1 in subcase: # plutonium buildup over cycle
plt.figure()
axis=plt.subplot(111)
lh=[0]*10
for i in range(10):
c = cm.jet((i)/10,1)
lh[i],=step(z_mesh,Stepper(PuDens(tpu[1,i,:,:,:,0],3),0),color=c,where='post')
step(z_mesh,Stepper(PuDens(tpu[1,i,:,:,:,1],3),0),color=c,where='post')
axis.set_xlim([0,3.6576])
#axis.set_ylim([500,1100])
axis.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
axis.xaxis.grid(True,'major',linewidth=1,color=[0.7,0.7,0.7])
axis.yaxis.grid(True,'major',linewidth=1,color=[0.7,0.7,0.7])
axis.set_ylabel('Pu concentration, [1/(barn cm)]' ,size=14)
axis.set_xlabel('axial position, [m]',size=14)
l=legend([lh[0],lh[-1]],["50 EFPD","500 EFPD"],loc=2)
axis.annotate('Pu239', xy=(2.5, 0.00012),size=16,color=[0.5,0.5,0.5])
axis.annotate('PU241', xy=(2.5, 0.00002),size=16,color=[0.5,0.5,0.5])
show()
savefig('V:\\master report\\figures\\Pu_buildup1.pdf')
axis.set_title('Pu 239 and 241 buildup over cycle\n case 1',size=18)
savefig('D:\dropbox\Dropbox\plots\case1\Pu_buildup.png')
plt.figure() # u235 depletion case 0
axis=plt.subplot(111)
lh=[0]*10
for i in range(10):
c = cm.jet((i)/10,1)
lh[i],=step(z_mesh,Stepper(PuDens(tpu[1,i,:,:,:,2],3),0),color=c,where='post')
# plot(z_mesh[1:],tpu[1,i,2,0,:,3]/100,color=c)
axis.set_xlim([0,3.6576])
#axis.set_ylim([500,1100])
axis.xaxis.grid(True,'major',linewidth=1,color=[0.7,0.7,0.7])
axis.yaxis.grid(True,'major',linewidth=1,color=[0.7,0.7,0.7])
axis.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
axis.set_ylabel('U concentration, [1/(barn cm)]' ,size=14)
axis.set_xlabel('axial position, [m]',size=14)
axis.set_title('U235 depletion over cycle\n case 1',size=18)
l=legend([lh[0],lh[-1]],["50 EFPD","500 EFPD"],loc=2)
#axis.annotate('U235', xy=(2.5, 0.00015),size=16,alpha=0.5)
#axis.annotate('U238', xy=(2.5, 0.00003),size=16,alpha=0.5)
show()
savefig('D:\dropbox\Dropbox\plots\case1\U235_depletion.png')
if 1.5 in subcase:
plt.figure()
axis=plt.subplot(111)
lh=[[0,0],[0,0]]
case=[0,9]
c=['b', 'g', 'r']
for i in range(len(case)):
c = cm.jet((case[i])/10,1)
lh[i][0],=step(z_mesh,Stepper(PuDens(tpu[1,case[i],:,:,:,0],3),0),color=c,where='post')
lh[i][1],=step(z_mesh,Stepper(PuDens(tpu[0,case[i],:,:,:,0],30),0),ls=':',color=c,where='post')
dif=(PuDens(tpu[1,case[i],:,:,:,0],3)-PuDens(tpu[0,case[i],:,:,:,0],30))/PuDens(tpu[0,case[i],:,:,:,0],30)
print 'maximum deviation for bu='+str((case[i]+1)*50)+': '+str(max(abs(dif)))
axis.set_xlim([0,3.6576])
#axis.set_ylim([500,1100])
axis.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
axis.xaxis.grid(True,'major',linewidth=1,color=[0.7,0.7,0.7])
axis.yaxis.grid(True,'major',linewidth=1,color=[0.7,0.7,0.7])
axis.set_xlim([0,3.6576])
axis.set_ylim([0,0.00015])
axis.set_ylabel('Pu concentration, [1/(barn cm)]' ,size=14)
axis.set_xlabel('axial position, [m]',size=14)
#legend()
l=legend([lh[1][0],lh[0][0],lh[1][1],lh[0][1]],["case 1","case 1","case 0","case 0"],loc=5)
axis.annotate( '50 EFPD', xy=(1, 0.00003),size=16,color=[0.5,0.5,0.5])
axis.annotate( '500 EFPD', xy=(1, 0.00012),size=16,color=[0.5,0.5,0.5])
savefig('V:\\master report\\figures\\Pu_buildup1_1_5.pdf')
axis.set_title('Pu 239 buildup at 50 & 500 EFPD\n case 1 and 0',size=18)
tight_layout()
savefig('D:\dropbox\Dropbox\plots\case1\Pu_buildup1.5.png')
show()
if 1.6 in subcase:
figure()
axis=plt.subplot(111)
ph=[0,0,0]
c=['b', 'g', 'r','c']
ii=[8]
ls1=['--','-']
for i in range(len(ii)):
ph[0],=step(z_mesh,Stepper((PuDens(tpu[1,ii[i],:,:,:,0],3)-PuDens(tpu[0,ii[i],:,:,:,0],30))/PuDens(tpu[0,ii[i],:,:,:,0],30),0),color='b',where='post',zorder=10)
ph[1],=step(z_mesh,Stepper((PuDens(tpu[2,ii[i],:,:,:,0],3)-PuDens(tpu[0,ii[i],:,:,:,0],30))/PuDens(tpu[0,ii[i],:,:,:,0],30),0),color='g',where='post',zorder=9)
ph[2],=step(z_mesh,Stepper((PuDens(tpu[3,ii[i],:,:,:,0],3)-PuDens(tpu[0,ii[i],:,:,:,0],30))/PuDens(tpu[0,ii[i],:,:,:,0],30),0),color='r',where='post',zorder=8)
#step(z_mesh,Stepper((PuDens(tpu[1,case[i],:,:,:,0],3)-PuDens(tpu[0,case[i],:,:,:,0],30))/PuDens(tpu[0,case[i],:,:,:,0],30),0),where='post')
axis.yaxis.grid(True,'major',linewidth=1,color=[0.7,0.7,0.7])
axis.xaxis.grid(True,'major',linewidth=1,color=[0.7,0.7,0.7])
axis.set_ylabel('relative difference, [-]' ,size=14)
axis.set_xlabel('axial position, [m]',size=14)
axis.annotate('450 EFPD', xy=(0.5, -0.003),size=16,color=[0.5,0.5,0.5])
#axis.annotate('50 EFPD', xy=(1.5, -0.006),size=16,color=[0.5,0.5,0.5])
l=legend(["case 1","case 2","case 3"],loc=4)
plt.axhline(y=0,color=[0.5,0.5,0.5])
axis.set_xlim([0,3.6576])
tight_layout()
savefig('V:\\master report\\figures\\purel123.pdf')
axis.set_title('Difference in Pu-239 buildup\n of cases 1-3 to case 0/450',size=18)
set_fontsize([manager.canvas.figure for manager in matplotlib._pylab_helpers.Gcf.get_all_fig_managers()][0],beamerfontsize)
tight_layout()
show()
if 1.61 in subcase:
figure()
axis=plt.subplot(111)
ph=[0,0,0]
c=['b', 'g', 'r','c']
ii=[8]
ls1=['--','-']
for i in range(len(ii)):
ph[0],=step(z_mesh,Stepper((PuDens(tpu[0,ii[i],:,:,:,0],30)-PuDens(tpu[1,ii[i],:,:,:,0],3))/PuDens(tpu[1,ii[i],:,:,:,0],3)*100,0),color='b',where='post',zorder=10)
ph[1],=step(z_mesh,Stepper((PuDens(tpu[2,ii[i],:,:,:,0],3)-PuDens(tpu[1,ii[i],:,:,:,0],3))/PuDens(tpu[1,ii[i],:,:,:,0],3)*100,0),color='g',where='post',zorder=9)
ph[2],=step(z_mesh,Stepper((PuDens(tpu[3,ii[i],:,:,:,0],3)-PuDens(tpu[1,ii[i],:,:,:,0],3))/PuDens(tpu[1,ii[i],:,:,:,0],3)*100,0),color='r',where='post',zorder=8)
#step(z_mesh,Stepper((PuDens(tpu[1,case[i],:,:,:,0],3)-PuDens(tpu[0,case[i],:,:,:,0],30))/PuDens(tpu[0,case[i],:,:,:,0],30),0),where='post')
axis.yaxis.grid(True,'major',linewidth=1,color=[0.7,0.7,0.7])
axis.xaxis.grid(True,'major',linewidth=1,color=[0.7,0.7,0.7])
axis.set_ylabel('relative difference, [$\%$]' ,size=14)
axis.set_xlabel('axial position, [m]',size=14)
#axis.annotate('450 EFPD', xy=(0.5, -0.003),size=16,color=[0.5,0.5,0.5])
#axis.annotate('50 EFPD', xy=(1.5, -0.006),size=16,color=[0.5,0.5,0.5])
l=legend(["case A0","case A2","case A3"],loc=3)
plt.axhline(y=0,color=[0.5,0.5,0.5])
axis.set_xlim([0,3.6576])
tight_layout()
axis.set_title('Difference in Pu239 Concentration\n relative to to case A1, 450 EFPD',size=18)
set_fontsize([manager.canvas.figure for manager in matplotlib._pylab_helpers.Gcf.get_all_fig_managers()][0],beamerfontsize)
tight_layout()
savefig('V:\\master report\\figures\\purel123beamer.pdf')
show()
if 1.62 in subcase:
figure()
axis=plt.subplot(111)
ph=[0,0,0]
c=['b', 'g', 'r','c']
ii=[8]
ls1=['--','-']
for i in range(len(ii)):
#ph[0],=step(z_mesh,Stepper((PuDens(tpu[1,ii[i],:,:,:,0],3)-PuDens(tpu[0,ii[i],:,:,:,0],30))/PuDens(tpu[0,ii[i],:,:,:,0],30),0),color='b',where='post',zorder=10)
ph[1],=step(z_mesh,Stepper((PuDens(tpu[2,ii[i],:,:,:,0],3)-PuDens(tpu[1,ii[i],:,:,:,0],3))/PuDens(tpu[1,ii[i],:,:,:,0],3),0),color='g',where='post',zorder=9)
ph[2],=step(z_mesh,Stepper((PuDens(tpu[3,ii[i],:,:,:,0],3)-PuDens(tpu[1,ii[i],:,:,:,0],3))/PuDens(tpu[2,ii[i],:,:,:,0],3),0),color='r',where='post',zorder=8)
#step(z_mesh,Stepper((PuDens(tpu[1,case[i],:,:,:,0],3)-PuDens(tpu[0,case[i],:,:,:,0],30))/PuDens(tpu[0,case[i],:,:,:,0],30),0),where='post')
axis.yaxis.grid(True,'major',linewidth=1,color=[0.7,0.7,0.7])
axis.xaxis.grid(True,'major',linewidth=1,color=[0.7,0.7,0.7])
axis.set_ylabel('relative difference, [-]' ,size=14)
axis.set_xlabel('axial position, [m]',size=14)
axis.annotate('450 EFPD', xy=(0.5, -0.003),size=16,color=[0.5,0.5,0.5])
#axis.annotate('50 EFPD', xy=(1.5, -0.006),size=16,color=[0.5,0.5,0.5])
l=legend(["case A2","case A3"],loc=4)
plt.axhline(y=0,color=[0.5,0.5,0.5])
axis.set_xlim([0,3.6576])
tight_layout()
savefig('V:\\master report\\figures\\purel123paper.png')
#axis.set_title('Difference in Pu-239 buildup\n of cases 1-3 to case 0/450',size=18)
set_fontsize([manager.canvas.figure for manager in matplotlib._pylab_helpers.Gcf.get_all_fig_managers()][0],beamerfontsize)
tight_layout()
show()
if 4.5 in subcase:
j=8 #burn up set
k=24# z-plane
figure()
axis=plt.subplot(111)
r3=np.sqrt(np.linspace(0,3,4)/3)*0.004025
r30=np.sqrt(np.linspace(0,30,31)/30)*0.004025
for i in range(3):
a,=plt.bar(r3[i]*1000,tpu[1,j,i,0,k,0],(r3[i+1]-r3[i])*1000,0,color='red',edgecolor='black',alpha=0.3)
for i in range(30):
b,=plt.bar(r30[i]*1000,tpu[0,j,i,0,k,0],(r30[i+1]-r30[i])*1000,0,color='blue',edgecolor='black',alpha=0.3)
axis.xaxis.grid(True,'major',linewidth=1,color=[0.7,0.7,0.7])
axis.yaxis.grid(True,'major',linewidth=1,color=[0.7,0.7,0.7])
axis.set_ylabel('Pu239 concentration, [1/(barn cm)]' ,size=14)
axis.set_xlabel('radial position, [mm]',size=14)
axis.set_xlim([0,4.025])
l=legend([a,b],["case 1","case 0",],loc=2)
axis.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
c=sum(tpu[1,j,:,0,k,0])*0.004025**2/3
d=sum(tpu[0,j,:,0,k,0])*0.004025**2/30
#e=(c-d)/d*100
#axis.annotate( '{0} % difference\n in Pu 239 mass'.format("%.2f" % e) , xy=(0.0005, 0.00025),size=14)
savefig('V:\\master report\\figures\\radial_Pu01.pdf')
axis.set_title('The Rim Effect at 450 EFPD',size=18)
set_fontsize([manager.canvas.figure for manager in matplotlib._pylab_helpers.Gcf.get_all_fig_managers()][0],beamerfontsize)
tight_layout()
savefig('V:\\master report\\figures\\radial_Pu01beamer.pdf')
show()
if 4.6 in subcase:
j=8 #burn up set
k=24# z-plane
figure()
axis=plt.subplot(111)
r3=np.sqrt(np.linspace(0,3,4)/3)*0.004025
r30=np.sqrt(np.linspace(0,30,31)/30)*0.004025
for i in range(30):
b,=plt.bar(r30[i]*1000,(tpu[0,j,i,0,k,0]),(r30[i+1]-r30[i])*1000,0,color='blue',edgecolor='black',alpha=0.3)
ax2 = twinx()
for i in range(30):
a,=plt.bar(r30[i]*1000,(tpu[0,j,i,0,k,0]-tpu[8,j,i,0,k,0])/tpu[0,j,i,0,k,0]*100,(r30[i+1]-r30[i])*1000,0,color='red',edgecolor='black',alpha=0.3)
#for i in range(30):
# b,=plt.bar(r30[i]*1000,tpu[8,j,i,0,k,0],(r30[i+1]-r30[i])*1000,0,color='blue',edgecolor='black',alpha=0.3)
axis.xaxis.grid(True,'major',linewidth=1,color=[0.7,0.7,0.7])
axis.yaxis.grid(True,'major',linewidth=1,color=[0.7,0.7,0.7])
axis.set_ylabel('Pu239 concentration, [1/(barn cm)]' ,size=14)
ax2.set_ylabel('relative difference, [$\%$]' ,size=14)
axis.set_xlabel('radial position, [mm]',size=14)
axis.set_xlim([0,4.025])
l=legend([b,a],["case 0","deviation of case 8",],loc=2)
axis.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
ax2.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
c=sum(tpu[1,j,:,0,k,0])*0.004025**2/3
d=sum(tpu[0,j,:,0,k,0])*0.004025**2/30
axis.set_title('The relativve difference in radial Pu 239 prediction for\n case 0 (cfd) and case 8 (subchannel)')
show()
savefig('D:\\dropbox\\Dropbox\\plots\\case8\\radial relative difference.png')
savefig('D:\\dropbox\\Dropbox\\plots\\case8\\radial relative difference.pdf')