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 | # Applied Python PRISM
# (PRISM) PaRametrIc System Model
#
# Written by Charlie Taylor <cet@appliedpython.com>
# Oct,21 2005
from math import *
import sys
from prism.MassItem import MassItem
from prism.props import Materials
from prism.Summary import Summary
from prism.props import Inc_liquid
from prism.fortran import orifice
class Line_Liq( MassItem ):
def __init__(self, name="liquid line", liqObj=None, matlName="Ti",
wdot=0.1, velFPS=20.0, pLine=400.0,
len_inches=50.0, Kfactors=2.0, Number=1,
sf=4.0, cxw=1.25, roughness=5.0E-6, mass_lbm=0.0, minID=0.0, thkInp=0.0):
# default roughness (5.0E-6) is for drawn tubing
MassItem.__init__(self, name, type="inert", mass_lbm=mass_lbm)
self.liqObj = liqObj
#if (liqObj is not Inc_liquid.Inc_liquid):
# print "ERROR...",name,"must have Inc_liquid object input for liqObj"
# sys.exit(1)
self.Number = Number
self.matlName = matlName
self.rho, self.sy, self.e, self.tming = Materials.getMatlProps(matlName)
self.thkInp = thkInp
self.velFPS = velFPS
self.wdot = wdot
self.Kfactors = Kfactors
self.roughness = roughness
self.pLine = pLine
self.len_inches = len_inches
self.sf = sf
self.cxw = cxw
self.minIDmassFlag = 0
self.minID = minID
self.reCalc()
def raiseMassToMinDiamMass(self):
self.minIDmassFlag = 0
if self.dinsid < self.minID:
self.minIDmassFlag = 1
thk = max(self.tming, self.sf * self.pLine * self.minID / self.sy / 2.0, self.thkInp)
IR = self.minID/2.0
self.mass_lbm = pi * ((IR+thk)**2 - IR**2) *\
self.len_inches * self.rho * self.cxw * self.Number
def reCalc(self, autoCalc=1):
self.autoCalc = autoCalc
self.Q = self.wdot / self.liqObj.rho
self.Ac = self.Q / (self.velFPS * 12.0)
self.rinsid = sqrt( self.Ac / pi )
self.dinsid = self.rinsid * 2.0
self.ReNum= self.liqObj.D * self.velFPS * \
(self.dinsid/12.0) / (self.liqObj.Visc/1.0E5) # liq Visc is in [lb/ft-sec * 1.0E5]
self.volLine = pi * self.rinsid**2 * self.len_inches
self.thkLine = max(self.tming, self.sf * self.pLine * self.dinsid / self.sy / 2.0, self.thkInp)
if self.wdot > 0.0:
self.dpLine = orifice.calcturbulenttubedp(self.len_inches ,\
self.Kfactors, self.dinsid, self.wdot, self.liqObj.D, self.roughness,
self.ReNum)
self.mass_lbm = pi * ((self.rinsid+self.thkLine)**2 - self.rinsid**2) *\
self.len_inches * self.rho * self.cxw * self.Number
else:
self.dpLine = 0.0
self.mass_lbm = 0.0
if self.dinsid < self.minID:
self.raiseMassToMinDiamMass()
self.doutside = self.dinsid+2.0*self.thkLine
def minGaugeStr(self, t):
if t<= self.tming:
return 'Min Gauge'
else:
return ''
def buildSummary(self):
summ = Summary( summName='Liquid Line',
componentName=self.name, mass_lbm=self.mass_lbm, type=self.type)
summ.addAssumption( 'fluid : ' + self.liqObj.symbol )
summ.addAssumption( 'Structural Material : ' + self.matlName )
summ.addAssumption( 'Allow Non-Standard wall thickness' )
if self.Number>1:
summ.addAssumption( 'Mass is for %i lines total'%self.Number )
if self.minIDmassFlag:
summ.addAssumption( 'Mass increased to reflect ID = %.3f in'%self.minID )
summ.addAssumption( '..........deltaP reflects ID = %.3f in'%self.dinsid )
# add inputs
summ.addInput('wdot', self.wdot, 'lbm/sec', '%g')
summ.addInput('velFPS', self.velFPS, 'ft/sec', '%g')
summ.addInput('len_inches', self.len_inches, 'in', '%g')
summ.addInput('Kfactors', self.Kfactors, 'vel heads', '%g')
summ.addInput('roughness', self.roughness, 'in', '%g')
summ.addInput('thkInp', self.thkInp, 'in', '%g')
summ.addInput('pLine', self.pLine, 'psia', '%g')
summ.addInput('sf', self.sf, '', '%g')
summ.addInput('cxw', self.cxw, '', '%g')
summ.addInput('# Lines', self.Number, '', '%i')
# add outputs
summ.addOutput( 'dpLine', self.dpLine, 'psig', '%.2f' )
summ.addOutput( 'ReNum', self.ReNum, '', '%E' )
summ.addOutput( 'thkLine', self.thkLine, 'in', '%.3f' )
summ.addOutput( 'rinsid', self.rinsid, 'in', '%.3f' )
summ.addOutput( 'dinsid', self.dinsid, 'in', '%.3f' )
summ.addOutput( 'doutside', self.doutside, 'in', '%.3f' )
summ.addOutput( 'volLine', self.volLine, 'cuin', '%g' )
summ.addOutput( 'rho', self.rho, 'lbm/cuin', '%g' )
summ.addOutput( 'sy', self.sy, 'psi', '%g' )
#summ.addOutput( 'e', self.e, 'psi', '%g' )
summ.addOutput( 'tming', self.tming, 'in', '%.3f' )
summ.addOutput( 'fluid rho', self.liqObj.rho, 'lbm/cuin', '%g' )
summ.addOutput( 'fluid visc', self.liqObj.Visc, '1.0E5 * lb/ft-sec', '%g' )
if self.Number>1:
summ.addOutput( 'wt/Line', self.mass_lbm/self.Number, 'lbm', '%.3f' )
return summ
if __name__ == "__main__": #self test
Fl = Inc_liquid.Inc_liquid( symbol="N2H4",T=530.0,P=240.0, mass_lbm=10.0)
wdotFl = 0.5
Ac = (0.375-2*0.02)**2 *pi / 4.0
Q = wdotFl / Fl.rho
velFPS = Q/12/Ac
h = Line_Liq(name="Fuel Line",wdot=wdotFl, matlName="Ti", velFPS=velFPS,
liqObj=Fl, Number=10, Kfactors=5.0)
print h.getMassStr()
print
print h.getSummary()
Ox = Inc_liquid.Inc_liquid( symbol="N2O4",T=530.0,P=240.0, mass_lbm=10.0)
wdotOx = 1.905
Ac = (0.75-2*0.049)**2 *pi / 4.0
Q = wdotOx / Ox.rho
velFPS = Q/12/Ac
h = Line_Liq(name="Oxidizer Line",wdot=wdotOx, matlName="Ti", velFPS=velFPS,
liqObj=Ox, Number=10, Kfactors=20.0, minID=1.0)
print h.getMassStr()
print
print h.getSummary()
|