此程序为热工水力计算程序,按照热工水力设计说明书进行开发
通过Python计算六段控制体出口温度、膜温差、包壳外温度;六段控制体的qDNB及DNBR,各段总压降及压力损失,程序代码如下:
A_Out_tem.py --->冷却剂出口温度计算模块
import math
'''
Created on Sat Jun 30 18:06:22 2018
@author: LZD
'''
#函数功能:计算冷却剂出口温度
def TemperOut():
tfin,Fa,Nt,W,plxs,GuessTempOut1 = 287,0.974,1820,32100,0.05,325
flag = True #默认在循环中迭代
cp =5.6044
while(flag): #迭代
tav = float(GuessTempOut1 + tfin)/2 #平均温度
TempOut = float(tfin + 3600*Fa*Nt / (W*cp*(1 - plxs)))
if((math.fabs(TempOut - GuessTempOut1)) <= 0.5): #迭代结束条件
flag = False
GuessTempOut1 = TempOut #更新迭代值
print("-----------------------Beginning-------------------------------")
print("冷却剂出口温度:" + str(TempOut))
print("-----------------------控制体出口-------------------------------")
#TemperOut()
B_Control_body.py--->包壳外温度计算模块
import math
#from scipy import integrate
def ControlBody():
tfin = 287.0
GuessTempOut1 = 330
fnr,feh,fehm,dcs,flag,l = 1.35,1.03,0.95,9.5,True,3.66
TempOut=[0,0,0,0,0,0]
qav = 506000
gyh = [0.48,1.02,1.5,1.56,0.96,0.48]
wb = 0.859
for i in range (0,6):#一到六号控制体
flag = True
count = 0
while (flag):
tav = (GuessTempOut1 + tfin) / 2
if(280<tav<300):
cp=(5455-5068)*(tav-280)/20+5068
if(300<tav<320):
cp=(6143-5455)*(tav-300)/20+5455
if(320<tav<340):
cp=(7837-6143)*(tav-320)/20+6143
TempOut[i] = float(tfin + 3.6*(qav*fnr*feh*fehm*3.14*dcs*gyh[i]*l / 6) / (wb*cp*1000))
if((math.fabs(TempOut[i] - GuessTempOut1)) <= 0.5):
flag = False
GuessTempOut1 = TempOut[i]
count += 1
print(str(i+1) + "控制体出口温度:" + str(TempOut[i])+ " 迭代次数:" + str(count))
tfin = TempOut[i]
OutTemp = [TempOut[i] for i in range(0,6)]
print('\033[3;0m膜温差-------------------膜温差----------------包壳外温度---------\033[0m')
return OutTemp
#print(OutTemp)
#ControlBody()
print(ControlBody())
C_Out_cladding.py --->内壁温度计算模块
from B_Control_body import ControlBody
def OutCladding():
gyhcs = [0.48,1.02,1.5,1.56,0.96,0.48]
pr = [i for i in range(0,6)]
Cp = [i for i in range(0,6)]
k = [i for i in range(0,6)]
u = [i for i in range(0,6)]
#ControlBody()
tfout = ControlBody()
f = [i for i in range(0,6)]
f1 = [i for i in range(0,6)]
f2 = [i for i in range(0,6)]
for i in range(0,6):
if(280<=tfout[i] and tfout[i]<300): #差分法求定压比热容
Cp[i]=(tfout[i]-280)*0.387/20+5.068
if(300<=tfout[i] and tfout[i]<320):
Cp[i]=(tfout[i]-300)*0.6886/20+5.455
if(320<=tfout[i] and tfout[i]<=340):
Cp[i]=(tfout[i]-320)*1.694/20+6.1436
if(250<=tfout[i] and tfout[i]<300): #差分法求水的导热系数
k[i]=(tfout[i]-250)/50*(0.63494-0.6408)+0.6408
if(300<=tfout[i] and tfout[i]<346.2176):
k[i]=(tfout[i]-300)/46.2176*(0.45047-0.63494)+0.63494;
if(250<=tfout[i] and tfout[i]<300): #差分法求水的动力粘度
u[i]=(tfout[i]-250)/50*(0.000089032-0.000109324)+0.000109324
if(300<=tfout[i] and tfout[i]<346.2176):
u[i]=(tfout[i]-300)/46.2176*(0.000067306-0.000089032)+0.000089032
pr[i]=u[i]*Cp[i]*1000/k[i]
f1[i]= 2.248*pow(10, 4)*gyhcs[i] * pow(u[i], 0.8)/(k[i]*pow(pr[i],0.4))
f2[i]= 346.38 + 1.79*pow(gyhcs[i], 0.25) - tfout[i]
if (f1[i]>f2[i]):
f[i] = f2[i]
else:
f[i] = f1[i]
f[i] = f[i] + tfout[i]
print("θf1=" + str(f1[i]) + ", θf2=" + str(f2[i]) + ", f=" +str(f[i]))
tcs = [f[i] for i in range(0,6)]
print('\033[1;35m----------------------内壁温度--------------------------------\033[0m')
#print(tcs)
return tcs#传递给下一个值
D_In_envelope.py--->芯块表面及中心
from C_Out_cladding import OutCladding
import math
def Ftci():
frn,feq,dcs,dci= 1.35,1.03,9.5,8.6
flag = True
gyhcs = [0.48,1.02,1.5,1.56,0.96,0.48] #归一化参数
q = 1820*1000000/(3.66*265*121)#线功率
#print("线功率"+str(q))#平均线功率,单位w/m
tcs = OutCladding() #外壁温度
#print(tcs)
atci = 350.0 #内壁假设温度
tci = [i for i in range(0,6)]
for i in range(0,6):
flag = True #初始化
while (flag):
tav = (tcs[i] + atci) / 2
kc = 0.00547*(1.8*tav + 32) + 13.8
tci[i] = tcs[i] + math.log(dcs/dci)*(q*frn*feq*gyhcs[i]) / (2 * 3.14*kc)
if (tci[i] - atci <= 0.00001):
flag = False
atci = tci[i]
print("第"+str(i+1) +"个内壁温度为" + str(tci[i]))
print('\033[1;31m------------------芯块表面及中心-----------------------------\033[0m')
tci=[tci[i] for i in range(0,6)]
return tci
E_Out_core.py--->qDNB及DNBR求解
from D_In_envelope import Ftci
#import math
def CoreBlock():
tci = Ftci()#包壳外壁温度/℃
#假设二氧化铀中心温度/℃
tu = [i for i in range(0,6)] #芯块表面温度
Ko = [i for i in range(0,6)]
to = [i for i in range(0,6)]
fnr,feq=1.35500,1.03
ql = 0.974*1820*1000000/(3.66*265*121)
gyhcs = [0.48,1.02,1.5,1.56,0.96,0.48]
for i in range(0,6):
tu[i] = tci[i] + 140.3*gyhcs[i]#(ql*fnr*feq*gyhcs[i]) / (4 * 3.14))=140.3*gyhcs[i]
print("第"+str(i+1) +"芯块表面温度" + str(tu[i]))
if (tu[i]>=300 and tu[i]<400):#Ko[i]积分热导率
Ko[i]=(tu[i]-300)/100*(2642-2132)+2132+ql*fnr*feq*gyhcs[i]/4/3.14159
#print("Ko[i]" +str(Ko[i]))
elif(tu[i]>=400 and tu[i]<500):
Ko[i]=ql*fnr*feq*gyhcs[i]/4/3.14159+(tu[i]-400)/100*(3093-2642)+2642
elif(tu[i]>=500 and tu[i]<=600):
Ko[i]=ql*fnr*feq*gyhcs[i]/4/3.14159+(tu[i]-500)/100*(3497-3093)+3093
else:
Ko[i]=0
if(Ko[i]>=3093 and Ko[i]<3497): #芯块中心温度计算范围℃(500-700,900-1000,1405-1550)
to[i]=(Ko[i]-3093)/(3497-3093)*100+500
elif(Ko[i]>=3497 and Ko[i]<=3865):
to[i]=(Ko[i]-3497)/(3865-3497)*100+600
elif(Ko[i]>=4514 and Ko[i]<=4806):
to[i]=(Ko[i]-4514)/(4806-4514)*100+900
elif(Ko[i]>=5840 and Ko[i]<=6195):
to[i]=(Ko[i]-5840)/(6195-5840)*(1550-1405)+1405
else:
to[i]=0
print("第"+str(i+1) +"芯块中心温度" + str(to[i]))
print('\033[1;34m----------------------qDNB及DNBR-------------------------------\033[0m')
F_Critical_heat.py--->控制体DNBR求解
import math
def FqDNB():
hfout=[1292958.6,1344717.9,1422084.7,1506219.5,1561993.1,1591926.1]
hfin =[1268601.9,1292958.6,1344711.9,1422084.7,1506219.5,1561993.1]
gyhcs = [0.48,1.02,1.5,1.56,0.96,0.48]
hfs,hfg,g,q = 1641744.3,945270.8 ,9774038.46,5.06*100000
dcs,s,frn,fqe= 0.0095,0.0126,1.35,1.03
P=15800000
dlzj = 4 * (s*s - math.pi*dcs*dcs / 4) / (math.pi*dcs)
a1 = 2.022 - 6.238*pow(10, -8)*P
a2 = 0.1722 - 1.43*pow(10, -8)*P
d = 0.2664 + 0.8357*math.exp(-124 * dlzj)
qDNB = [i for i in range(0,6)]
DNBR = [i for i in range(0,6)]
for i in range(0,6):
x = (hfout[i] - hfs) / hfg
a3 = math.exp((18.177 - 5.987*pow(10, -7)*P)*x)
a = 3.154 * pow(10, 6) * (a1 + a2*a3)
b = (0.1484 - 1.596*x + 0.1729*x*math.fabs(x))*0.2049*g / 1000000 + 1.037
c = 1.157 - 0.869*x
e = 0.8258 + 0.341*pow(10, -6)*(hfs - hfin[i])
qDNB[i] = a*b*c*d*e
DNBR[i] = qDNB[i]/ (q*fqe*frn*gyhcs[i])
print(str(i+1) + "号控制体qDNB:" + str(qDNB[i])+ " 控制体DNBR:" + str(DNBR[i]))
print('\033[1;35m------------------总压降------------------------------------\033[0m')
G_Pressure.py---->总的压力损失
def press():
pout, pin, pgj,pt = 0,0,0,0
birong= [ 0.0013370, 0.0013640, 0.0014134, 0.0014861, 0.0015575, 0.0016008 ]
vi= [ 0.0013293, 0.0013456, 0.0013816, 0.0014484, 0.0015288, 0.0015871 ]
vo = [ 0.0013456, 0.0013816, 0.0014484, 0.0015288, 0.0015871, 0.0016145 ]
uw = [ 3.16159e-005, 3.24830e-005, 3.32733e-005, 3.32740e-005, 3.32656e-005, 3.32556e-005 ]
uf = [ 9.28006e-005, 8.98162e-005, 8.50089e-005, 7.93670e-005, 7.48567e-005, 7.24024e-005 ]
g,Ko,Kgr,L,V,G = 9.8,1.0,1.05,3.66,3.809,9.806e+6 / 3600
dlzj = 1.18e-2
pel=[i for i in range(0,6)]
pf=[i for i in range(0,6)]
pa=[i for i in range(0,6)]
mxs=[i for i in range(0,6)]
re=[i for i in range(0,6)]
midu=[i for i in range(0,6)]
p=[i for i in range(0,6)]
fpel=[i for i in range(0,6)]
fpa=[i for i in range(0,6)]
fpout=[i for i in range(0,6)]
fpin=[i for i in range(0,6)]
ts,mc,js=0,0,0
for i in range(0,6):
midu[i]=(1 / birong[i] ) #初始化参数
re[i] = midu[i] * V*dlzj / uf[i]
mxs[i] = 0.184*pow(uw[i] / uf[i], 0.6) / pow(re[i], 0.2)#计算摩擦系数
fpel[i] = midu[i]* L*g / 6 #计算提升压降
pf[i] = mxs[i] * L*midu[i] * V* V / (dlzj * 6 * 2) #计算摩擦压降
fpa[i] = G * G*(vo[i] - vi[i]) #计算加速压降
fpout[i] = Ko * G*G*vo[i] / 2 #计算出口局部压降
fpin[i] = Ko * G*G*vi[i] / 2 #计算进口局部压降
#fre[i] = dlzj * midu[i]*V*V / u
pel[i] = fpel[i]
pf[i] = mxs[i] * L*midu[i] * V* V / (dlzj * 6 * 2)
pa[i] = fpa[i]
p[i] = pel[i] + pf[i] + pa[i]
pt = pt + p[i]
print(str(i+1) + "段提升:" + str(pel[i]))
print(str(i+1) + "段摩擦:" + str(pf[i]))
print(str(i+1) + "段加速:" + str(pa[i]))
ts += pel[i]
mc += pf[i]
js += pa[i]
pout = fpout[5]
pin = fpin[0]
pgj = Kgr * G*G*(vo[5] + vi[5])/4#计算格架出口压降
pt = pt + +pout + pin + pgj
print("出口:" + str(pout))
print("入口:" + str(pin))
print("格架:" + str(pgj))
print("总提升:" + str(ts))
print("总摩擦:" + str(mc))
print("总加速:" + str(js))
compress = ts+mc+js+pout+pin+pgj
print("总的压力损失:" + str(compress) )
print("------------------------END----------------------------------")
在编写程序的过程中,将专业知识和自己的兴趣结合在了一起,并有效的解决了生活在实际会遇到的问题,也给了自己极大的乐趣与自信,愈发向往开发者的生活,享受创造事物的乐趣。
网友评论