def alpha(z): """Void fraction of the mixture on [0, L] Parameter: ---------- z: float, m; distance from the inlet at the bottom """ return two_phase.alpha(x(z), rhof, rhog)
from iapws import IAPWS97 as Steam import two_phase # Constants SHEM = 1.0 MDOT = 0.29 AFLOW = 1.5E-4 X = 0.15 P = 7.2 MPA_TO_PSI = 145.038 water = Steam(P=P, x=0) vapor = Steam(P=P, x=1) # Part 1: HEM Model alpha1 = two_phase.alpha(X, water.rho, vapor.rho, SHEM) print("1) Void fraction, HEM: {:.3f}".format(alpha1)) # Part 2: Bankoff's Correction psi = P * MPA_TO_PSI k = 0.71 + 1E-4 * psi alpha2 = k * alpha1 print("2) Void fraction, Bankoff: {:.3f}".format(alpha2)) # Part 3: Dix's Correlation # drift velocity for churn flow vvj = 1.53 * (water.sigma * 9.81 * (water.rho - vapor.rho) / water.rho**2)**0.25 jay = MDOT / AFLOW * ((1 - X) / water.rho + X / vapor.rho) b = (vapor.rho / water.rho)**0.1 c = alpha1 * (1 + (1 / alpha1 - 1)**b)
# Problem 5-1: Area-averaged parameters import two_phase from iapws import IAPWS97 as Steam # Given constants P = 7.2 # MPa X = 0.15 S = 1.5 A = 0.012 # m^2 MDOT = 17.5 # kg/s # Steam tables water = Steam(P=P, x=0) rhof = water.rho vapor = Steam(P=P, x=1) rhog = vapor.rho alpha = two_phase.alpha(X, rhof, rhog, s=S) beta = two_phase.alpha(X, rhof, rhog, s=1.0) mdotv = X * MDOT mdotl = (1 - X) * MDOT jayv = mdotv / (rhog * A) gv = mdotv / A gl = mdotl / A print(""" alpha = {alpha:.4f} mdotv = {mdotv:.2f} kg/s beta = {beta:1.4f} mdotl = {mdotl:.2f} kg/s jayv = {jayv:.2f} m/s Gv = {gv:.2f} kg/s/m^2 Gl = {gl:.2f} kg/s/m^2 """.format(**locals()))
print("\tConductive htc: {:.2f} W/m^2-K".format(hcond)) aht = 2 * pi * R**2 print("\tA_HT: {:.2f} m^2".format(aht)) qcond = hcond * aht * (TF - TSO) * 1E-6 print("\tqcond: {:.2f} MW".format(qcond)) dedt = qd - qboil - qcond print("\tdE/dt: {:.2f} MW".format(dedt)) print("\t -> system is", end=" ") if abs(dedt) < 0.01 * qd: print("holding steady") elif dedt > 0: print("heating up") else: print("cooling down") print("\nPart 2: Void Fraction") vvj = 1.53 * (9.81 * water0.sigma * (water0.rho - vapor0.rho) / water0.rho**2)**0.25 print("\tvvj: {:.3f} m/s".format(vvj)) hfg = (vapor0.h - water0.h) * 1000 g = Q2 / hfg print("\tG: {:.3f} kg/s/m^2".format(g)) jayv = g / vapor0.rho print("\tjayv: {:.3f} m/s".format(jayv)) alpha = jayv / (C0 + vvj) print("\t -> alpha = {:.3f}".format(alpha)) print("\nPart 3: HEM?") print("\t -> beta = {:.3f}".format(two_phase.alpha(1, water0.rho, vapor0.rho))) print("\t -> not a good approach")
print("\nPart 3: outlet enthalpy") hout = hin + qdot / MDOT print("\t -> hout = {:.1f} kJ/kg".format(hout)) print("\nPart 2: outlet temperature") xout = (hout - hf) / hfg print("\txout = {:.3f}".format(xout)) if 0 <= xout <= 1: tout = sat_vapor.T else: errstr = "Domain error: fluid is not saturated (x={:.4f})" raise ValueError(errstr.format(xout)) print("\t -> tout = {:.1f} degC".format(tout - KELVIN)) print("\nPart 4: outlet void fraction") alpha = two_phase.alpha(xout, RHOF, RHOG, s=1) print("\t -> alpha = {:.3f}".format(alpha)) print("\nPart 5: Non-boiling length") hfrac = (hf - hin) / (hout - hin) zonb = L / math.pi * math.asin(2 * hfrac - 1) lonb = L / 2 + zonb print("\t -> zonb = {:.2f} m = {:.2f} m (from inlet)".format(zonb, lonb)) print("\nPart 6: centerline temperature at onset of boiling") re = G * dh / MUC print("\tRe: {:.2e}".format(re)) pr = CPC * MUC / KC print("\tPr: {:.2f}".format(pr)) nu = models.dittus_boelter(re, pr) print("\tNu: {:.1f}".format(nu))
Uses a purely linear relationship. Parameter: ---------- z: float, m; axial position from the inlet Returns: -------- x: float; quality of the steam """ return z / L zvals = linspace(0, L) xvals = array([x(z) for z in zvals]) avals = array([two_phase.alpha(x, RHOF, RHOG) for x in xvals]) plot(zvals, xvals, "b-", label="Quality $X$") plot(zvals, avals, "r-", label="Void fraction $\\alpha$") xlim([0, L]) ylim([0, 1.05]) xlabel("z (m)") title("Problem 3: Axial profile") legend(loc='lower right') grid() print("\nPart 4: Pressure drops across the tubes") print("\tG: {:.0f} kg/s/m^2".format(G)) re = G * D / MUF print("\tRe: {:.2e}".format(re)) fff = models.mcadams(re) print("\tftp: {:.3f}".format(fff))
MDOT = 0.29 # kg/s G = MDOT / AFLOW # kg/s/m^2 P = 7.2 # MPa X1 = 0.15 # Steam tables water = Steam(P=P, x=0) rhof = water.rho mu = water.mu vapor = Steam(P=P, x=1) rhog = vapor.rho print("Steam tables: rhof = {:.1f} kg/m^3, {:.1f} kg/m^3, \ mu = {:.2e} Pa-s".format(rhof, rhog, mu)) print("Mass flux: {:.0f} kg/s/m^2".format(G)) print("\nPart 1) Adiabatic channel with Xin = {}".format(X1)) alpha1 = two_phase.alpha(X1, rhof, rhog) rhom1 = rhog + (1 - alpha1) * (rhof - rhog) print("\tMixture: alpha = {:.3f}, rhom = {:.1f} kg/m^3".format( alpha1, rhom1)) re = G * DH / mu print("\tReynolds: {:.2e}".format(re)) fff = models.mcadams(re) print("\tFric. fac.: {:.3f}".format(fff)) dp1 = rhom1 * 9.81 * L + fff * L / DH * G**2 / (2 * rhom1) print("\t -> DP = {:.3} kPa".format(-dp1 / 1000)) print("\nPart 2) Uniform heat flux") def x(z, x0=0): """Quality of the mixture on [0, L]
# Find the mass flow rate with COE mst = QDOT / 1000 / (hg - hin) mdot = mst / XOUT # water mixture in the downcomer hdown = hin * XOUT + hf * (1 - XOUT) water_down = Steam(P=P, h=hdown) rho_down = water_down.rho print("hdown: {:.0f} kJ/kg".format(hdown)) print("rho: {:.1f} kg/m^3".format(rho_down)) dp_down = rho_down * H * 9.81 print("DPdown: {:.1f} kPa".format(dp_down / 1000)) # water+steam mixture in the riser rhog = vapor.rho rhof = water.rho alpha = two_phase.alpha(XOUT, rhof, rhog) print("alpha: {:.4f}".format(alpha)) rhom = two_phase.mixture_density(rhof, rhog, alpha) print("rhom: {:.1f} kg/m^3".format(rhom)) dp_up = rhom * 9.81 * H print("DPup: {:.1f} kPa".format(dp_up / 1000)) # friction loss in the riser mu = water.mu g = lambda d: 4 * mdot / (pi * d**2) re = lambda d: g(d) * d / mu fff = lambda d: models.mcadams(re(d)) # Conservation of momentum com = lambda d: dp_down - dp_up - fff(d) * H / d * g(d)**2 / (2 * rhom) diameter = fsolve(com, 0.1)[0] print("\n" + "-" * 12)