import utils import math def calculate_params(): S_ceil = 3**0.5 * data['a']**2 / 2 eps_top = math.pi * (data['dTv'] - 2 * data['deltaSh'])**2 / 4 / S_ceil eps_km = math.pi * data['deltaSh'] * (data['dTv'] - data['deltaSh']) / S_ceil eps_col = (S_ceil - math.pi * data['dTv']**2 / 4) / S_ceil print("S_ceil = {} mm^2".format(S_ceil)) print("eps_top = {}".format(eps_top)) print("eps_km = {}".format(eps_km)) print("eps_col = {}".format(eps_col)) data = {} utils.fill_dict_from_file(data, "inputElementary.txt") if __name__ == '__main__': calculate_params()
break if len(upper_ts) != 0: LBoil = z[upper_ts[1]] - z[upper_ts[0]] else: LBoil = 0 out.write(("qVMax: %.3f MVt/m^3\nqlAvgMax: %.3f Vt/cm\nQtvsm: %.3f MVt\nqMax: %.3f MVt/m^2\nqAvg: %.3f MVt/m^2\n" +\ "Gtvsm: %.3f kg/s\nWtvsm: %.3f kg/s\nroWtvsm: %.3f kg/(m^2*s)\n" +\ "tOutShMax: %.3f C\ntInShMax: %.3f C\n" +\ "tFuel35Max: %.3f C\ntFuel14Max: %.3f C\nLBoil: %.3f m\n") % (qVMax, qlAvgMax, Qtvsm, qMax, qAvg, Gtvsm, Wtvsm, roW, t_sh_outer_max, t_sh_inner_max, t_fuel35_max, t_fuel14_max, LBoil)) data = {} utils.fill_dict_from_file(data, "..\\Distributions\\distributionsInput.txt") out = open("..\\Distributions\\distributionOut.txt", "w") #Constants calculation Gtvsm = data["Gtn"] * data["kR"] Wtvsm = data["w"] * data["kR"] water = IAPWS97(P=data["P1c"], x=0) ts = list(map(lambda x: water.T - 273, np.zeros(z.size))) q_distribution_over_the_height_calc(True) if __name__ == "__main__": calculate_distributions(True) main_characteristics_TVSM() out.write("deltaZ: %.3f m\n" % deltaZ)
qMax_smooth = spline(x195, distr_qMax_x(x195), x195new) x_table = np.arange(-0.2, 0.2 + 0.1, 0.1) distr_q_cr = interp1d(x_table, q_cr, kind='cubic') x_plot = np.arange(-0.2, 0.2 + 0.02, 0.02) plt.plot(x_plot, distr_q_cr(x_plot), label=r'$q_{кр}$') plt.plot(x_plot, distr_q_cr(x_plot) * (1 + 3 * 0.15), 'r--', label=r'$q_{кр. откл.}$') plt.plot(x_plot, distr_q_cr(x_plot) * (1 - 3 * 0.15), 'r--') plt.plot(xnew, q_smooth * 1e-6, 's--', label=r'$q_{ном}$') plt.plot(x195new, qMax_smooth * 1e-6, 'o--', label=(r'$%.1fq_{ном}$' % data["n"])) plt.xlabel(r'x', fontsize=14, fontweight='bold') plt.ylabel(r'q, $МВт/м^2$', fontsize=14, fontweight='bold') plt.legend() plt.grid(True) plt.show() data = {} utils.fill_dict_from_file(data, "heat_crisisInput.txt") calc_K() calc_q_critical() calc_x_and_q_and_plot()
def calc_x_and_q_and_plot(): step = 0.2 z = np.arange(0, 1.2 + step, step) z = np.append(z, 1.3) step_inter = 0.01 z_inter = np.arange(0, 1.3 + step_inter, step_inter) q_inter = interp1d(z_inter, q) q_nom = list(map(lambda z: q_inter(z), z)) print("==========q_nom'==========") print(q_nom) print("==========%.2fq_nom======" % data["n"]) q_max_nom = list(map(lambda x: x * float(data["n"]), q_nom)) print(q_max_nom) #x calculation param = {} resultsDistr = {} utils.fill_dict_from_file(param, "../Distributions/distributionsInput.txt") utils.fill_dict_from_file(resultsDistr, "../Distributions/distributionOut.txt") qMax = resultsDistr["kV"] * param["qSr"] * 1e6 z = np.append(np.arange(0, 1.2 + 0.2, 0.2), 1.3) f0 = -1 * (qMax * (param["Haz"] + 2 * resultsDistr["deltaZ"])) / np.pi * np.sin( np.pi / 2 * ((param["Haz"]) / (param["Haz"] + 2 * resultsDistr["deltaZ"]))) f = -1 * (qMax * (param["Haz"] + 2 * resultsDistr["deltaZ"])) / np.pi * np.sin( np.pi / 2 * ((param["Haz"] - 2 * z) / (param["Haz"] + 2 * resultsDistr["deltaZ"]))) - f0 water1 = IAPWS97(T=294.7 + 273, P=12.7) water2 = IAPWS97(P=12.7, x=0.0) x_in = (water1.h - water2.h) / 1.1554e+006 * 1e3 + 0.01 x = x_in + (param["kG"] * param["Pt"]) / (param["kQ"] * param["kR"] * param["Gtn"] * 1.1504e+006) * f x195 = x_in + (param["kG"] * param["Pt"]) / (param["kQ"] * param["kR"] * param["Gtn"] * 1.1504e+006) * f * float(data["n"]) print("----------x:----------\n") print(x) print("---------x%.2f:--------\n" % data["n"]) print(x195) distr_q_x = interp1d(x, q_nom) distr_qMax_x = interp1d(x195, q_max_nom) #splining xnew = np.linspace(min(x), max(x), 10) q_smooth = spline(x, distr_q_x(x), xnew) x195new = np.linspace(min(x195), max(x195), 20) qMax_smooth = spline(x195, distr_qMax_x(x195), x195new) x_table = np.arange(-0.2, 0.2 + 0.1, 0.1) distr_q_cr = interp1d(x_table, q_cr, kind='cubic') x_plot = np.arange(-0.2, 0.2 + 0.02, 0.02) plt.plot(x_plot, distr_q_cr(x_plot), label=r'$q_{кр}$') plt.plot(x_plot, distr_q_cr(x_plot) * (1 + 3 * 0.15), 'r--', label=r'$q_{кр. откл.}$') plt.plot(x_plot, distr_q_cr(x_plot) * (1 - 3 * 0.15), 'r--') plt.plot(xnew, q_smooth * 1e-6, 's--', label=r'$q_{ном}$') plt.plot(x195new, qMax_smooth * 1e-6, 'o--', label=(r'$%.1fq_{ном}$' % data["n"])) plt.xlabel(r'x', fontsize=14, fontweight='bold') plt.ylabel(r'q, $МВт/м^2$', fontsize=14, fontweight='bold') plt.legend() plt.grid(True) plt.show()
out.write("\n") def local_resistance_calc(): global deltaP_local ksi_in = 6 ksi_out = 4 ksi_nr = 2 ksi_vr = 3 ksi_dr5 = 1.1 ksi_sum = ksi_in + ksi_out + ksi_nr + ksi_vr + ksi_dr5; deltaP_local = ksi_sum * data["roH2O"] * data["w"] ** 2 / 2 out.write("deltaP_local: %.3f Pa\n" % (deltaP_local)) def result_calc(): deltaP = deltaP_tr + deltaP_local V = data["Gtn"] / data["roH2O"] Ntn = V * deltaP / data["etaN"] print(Ntn * 1e-3) out.write("deltaP: %.3f Pa\nNtn: %.3f Vt\n" % (deltaP, Ntn)) data = {} utils.fill_dict_from_file(data, "hydr_resistInput.txt") out = open("hydr_resistOutput.txt", "w"); frictional_resistance_calc() local_resistance_calc() result_calc() out.close()
import utils import math roH2O_tabl = 1 #Zv/S Dpdd = 6.61376e-10 def after_defence_calc(D_before_def): SrH2O = data["SrH2O"] * (data["roH2O"] / roH2O_tabl) dBet = -(SrH2O * data["dH2O"] + data["SrSt"] * data["dSt"] + math.log(Dpdd / D_before_def)) / (data['SrBet']) print("SrH2O = {} cm^-1".format(SrH2O)) print("dBet = {} cm".format(dBet)) return dBet data = {} utils.fill_dict_from_file(data, "inputNeutron.txt")
temps = [tW_start + 0.5 * interval_len + i * interval_len for i in range(20)] ro = [] for i in range(20): water = IAPWS97(T=temps[i] + 273.0, P=12.7) ro.append(water.v ** -1) ro = sum(ro) * interval_len / (tW_boil - tW_start) return ro data = {} utils.fill_dict_from_file(data, "input.txt") if __name__ == "__main__": cp = cP_calc() ro = ro_w_calc() r = 1.0974e6 delta_m = ro * data['V_w'] * (1 - 1 / math.e) # delta_m = ro * 26 * (1 - 1 / math.e) A = cp * ro * data['V_w'] * (data['tW_boil'] - data['tW_start']) B = r * delta_m C = A + B tau = 0
NO = data["%O"] / 100 * NN2O2 NN = data["%N"] / 100 * NN2O2 out.write("Air: N2O2\n") out.write("NN: %.3e\nNO: %.3e\n" % (NN, NO)) out.write("=============================\n") #99%Zr + 1%Nb def calc_tvel_shell_nc(): NZr = data["roZr"] * NA / data["MZr"] * 1e-24 out.write("Shell of Tvel: Zr 99% + Nb 1%\n") out.write("NZr: %.3e\n" % (NZr)) out.write("=============================\n") data = {} utils.fill_dict_from_file(data, 'NCInput.txt') out = open('NCOut.txt', 'w') calc_fuel_nc() calc_h2o_nc() calc_pel_nc() calc_svp_nc() calc_protection_bar_nc() calc_air_nc() calc_tvel_shell_nc() out.close()
out_file = open("KPDOut.txt", "w") out_file.write("Relative steam consumption\n") out_file.write("---------------------------\n") out_file.write( "gpg2 gpik g0 g1 g2 g3 gk gd gs gs1 gs2 gsp\n" ) out_file.write( "1 0 1 %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f\n\n" % (g1, g2, g3, gk, gd, gs, gs1, gs2, gsp)) out_file.write("Absolute steam consumption\n") out_file.write("---------------------------\n") out_file.write( "Gpg2 Gpik G0 G1 G2 G3 Gk Gd Gs Gs1 Gs2 Gsp\n" ) out_file.write( "%.3f 0 %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f\n\n" % (G0, G0, G1, G2, G3, Gk, Gd, Gs, Gs1, Gs2, Gsp)) out_file.write("Efficiency and heat power of reactor\n") out_file.write("---------------------------\n") out_file.write("etaE etaEATEC etaTATEC Qr Gtk\n") out_file.write("%.3f %.3f %.3f %.3e %.3e" % (etaE, etaEATEC, etaTATEC, Qr, Gtk)) out_file.close() data = {} utils.fill_dict_from_file(data, 'KPDinput.txt') calc_efficiency_and_write_to_file(data)
plt.plot(x, f1(x), label=r'$t_в$') plt.plot(z, t_s, '--', label=r'$t_s$') plt.plot(x, f2(x), '-.', label=r'$t_{об.н}$') plt.plot(x, f3(x), ':', label=r'$t_{об.вн}$') plt.plot(x, f4(x), '.-', label=r'$t_{топ35}$') plt.plot(x, f5(x), '-o', label=r'$t_{топ14}$') plt.grid(True) plt.legend(fontsize=14) plt.xlabel(r'z, $м$', fontsize=14, fontweight='bold') plt.ylabel(r't, $^oC$', fontsize=14, fontweight='bold') plt.show() data = {} utils.fill_dict_from_file(data, "..\\Distributions\\neutron_distr.txt") kV = data["kR"] * data["kZ"] #Constants calculation Gtvsm = data["Gtn"] * kr Wtvsm = data["w"] * kr water = IAPWS97(P=data["P1c"], x=0) if __name__ == "__main__": q_distribution_over_the_height_calc() temp_distribution_of_water_calc() temp_distribution_of_outer_shell() temp_distribution_of_inner_shell() temp_distribution_of_fuel() plot_graphs()
Gr = data["Wsr"] * data["roH2O"] * data["Stn"] / data["kG"] * data["Ntvs"] Gtn = Gr * data["kG"] / data["Ntvs"] deltaTr = data["Qr"] / (data["Cp"] * Gr) tVhR = data["tVihR"] - deltaTr file.write( "Gr: %.3f kg/s\nGtn: %.3f kg/s\ndeltaTr: %.3f C\ntVhR: %.3f C\n\n" % (Gr, Gtn, deltaTr, tVhR)) file.close() def avg_heat_characteristics_calculation(data): file = open("heat_paramsOutput.txt", "a") write_header(file, "Average heat characteristics") qV = (data["Qr"] / data["Vaz"]) / 1e6 Qtvs = data["kQ"] * data["Qr"] / data["Ntvs"] / 1e6 qlSr = Qtvs / (data["Ntvel"] * data["Haz"] * 1e-1) * 1e6 qSr = qlSr / (math.pi * data["dTvel"] * 1e-3) * 1e-4 file.write( "qV: %.3f MVt/m^3\nQtvs: %.3f MVt\nqlSr: %.3f Vt/cm\nqSr: %.3f MVt/m^2\n\n" % (qV, Qtvs, qlSr, qSr)) file.close() data = {} utils.fill_dict_from_file(data, "heat_paramsInput.txt") first_circuit_params_calculation(data) avg_heat_characteristics_calculation(data)