from Tabular_values import Na import matplotlib.pyplot as plt ENERGY_ISOTHERM_RHO = [[], [], [], [], []] RHO = [[], [], [], [], []] k = 0 while k < 3: rho_is = 0.001 for i in (0.001, 0.01, 0.1, 1., 10.): while rho_is < i * 10: RHO[k].append(rho_is) T_h = 3.98 / (10**3) * 10**k / 13**(4 / 3) rho_h = rho_is * Na * 11.19 * 1.4818 * 10**(-25) / 26 / 13 ENERGY_ISOTHERM_RHO[k].append( 2.626 * 10**3 / 26 * Energy(T_h, rho_h, 1, 1) * 13**(7 / 3)) rho_is += i k += 1 plt.plot(RHO[0], ENERGY_ISOTHERM_RHO[0], label="3.98 эв") plt.plot(RHO[1], ENERGY_ISOTHERM_RHO[1], label="39.8 эв") plt.plot(RHO[2], ENERGY_ISOTHERM_RHO[2], label="398 эв") plt.xscale('log') plt.yscale('log') plt.xlim(0.001, 100) plt.ylim(1, 100000) plt.xlabel('rho, г / см^3') plt.ylabel('E, кДж / г') plt.title('Энергия алюминия по различным моделям') plt.grid('true') plt.legend()
for i in range(2, n + 1): TABLE_P[i][0] = TABLE_P[1][0] + (i - 1) * (-0.02) for i in range(1, n + 2): for j in range(1, m + 1): #print(10 ** TABLE_E[i][0], 10 ** TABLE_E[0][j]) found_rho = mixture_calculation(10**TABLE_E[i][0], 10**TABLE_E[0][j], mixture) for k in range(len(mixture)): T_h = 10**TABLE_E[i][0] / mixture[k]["Z"]**(4 / 3) rho_h = 10**TABLE_E[0][j] * Na * 11.19 * 1.4818 * 10**( -25) / mixture[k]["Atom_weight"] / mixture[k]["Z"] PHI = progonka(T_h, rho_h, 1, 1) TABLE_P[i][j] += P(T_h, rho_h, PHI) * mixture[k]["Z"]**( 10 / 3) * mixture[k]["amount"] / nuclear_amount TABLE_E[i][j] += Energy(T_h, rho_h, 1, 1, PHI) * mixture[k]["Z"]**( 7 / 3) * mixture[k]["amount"] / Weight print(i, j) f = open('energy_sio2.txt', 'w') for i in range(len(TABLE_E)): for j in range(len(TABLE_E[i])): f.write(str(TABLE_E[i][j])) f.write(" ") f.write("\n") f = open('pressure_sio2.txt', 'w') for i in range(len(TABLE_P)): for j in range(len(TABLE_P[i])): f.write(str(TABLE_P[i][j])) f.write(" ")
#TA TABLE_E[0][1] = -4.000 TABLE_E[1][0] = 3.000 for j in range(2, m + 1): TABLE_E[0][j] = TABLE_E[0][1] + (j - 1) / m * 13 for i in range(2, n + 1): TABLE_E[i][0] = TABLE_E[1][0] + (i - 1) / n * (-8) for i in range(1, n + 1): for j in range(1, m + 1): T_now = 10**TABLE_E[i][0] / 36.7493224786 rho_now = 1.0 / (8.923608963522 * 0.01 * 10**TABLE_E[0][j]) # print(T_now, rho_now) # print(P(T_now, rho_now)) TABLE_E[i][j] = log10(Energy(T_now, rho_now, 1, 1)) print("T = ", TABLE_E[i][0], "rh0 = ", TABLE_E[0][j], "LG E = ", TABLE_E[i][j]) #T_now = 10 ** (-0.167) /36.749 #rho_now = 1.0 / (8.923608963522 * 0.01 * 10 ** 4) #print(P(T_now, rho_now)) #print(log10(P(T_now,rho_now))) for i in range(len(TABLE_E)): for j in range(len(TABLE_E[i])): print(TABLE_E[i][j], end=' ') print() # # # T_now = 10 ** LG_T[j] / 36.7493224786 # rho_now = 1.0 / (8.923608963522 * 0.01 * 10 ** LG_V[i])
def f2(T, rho): return Energy( T, rho, 13, 26) - E_0 - 1 / 2 * (P(T, rho, 26, 13) + P_0) * (1 / rho_00 - 1 / rho)
from Pressure import P from Internal_energy import Energy from numpy import dot from numpy import transpose from working_progonka import progonka rho_00 = 2.712 E_0 = Energy(293 * 10**(-3) / (1.160 * 10**4), rho_00, 13, 26) P_0 = P(293 * 10**3 / (1.160 * 10**4), rho_00, 26, 13) def f1(T, rho): return P(T, rho, 26, 13) - P_0 def f2(T, rho): return Energy( T, rho, 13, 26) - E_0 - 1 / 2 * (P(T, rho, 26, 13) + P_0) * (1 / rho_00 - 1 / rho) def newton_solver(P, T_pribl, rho_pribl): delta = [[0 for i in range(1)] for j in range(2)] delta[0][0] = 10**(-8) delta[1][0] = 10**(-8) epsilon = 10**(-8) mod_delta = 100 W = [[0 for i in range(2)] for j in range(2)] F = [[0 for i in range(1)] for j in range(2)] priblizhenie = [[0 for i in range(1)] for j in range(2)]
TABLE_P[n + 1][0] = -9.000 for j in range(2, m + 1): TABLE_P[0][j] = TABLE_P[0][1] + (j - 1) * 0.01 for i in range(2, n + 1): TABLE_P[i][0] = TABLE_P[1][0] + (i - 1) * (-0.02) for i in range(1, n + 2): for j in range(1, m + 1): #T_h = 10 ** TABLE_E[i][0] / z**(4 / 3) #rho_h = 10 ** TABLE_E[0][j] * Na * 11.19 * 1.4818 * 10**(-25) / Atom_weight / z T_h = 36.4 / z**(4 / 3) rho_h = 100 * Na * 11.19 * 1.4818 * 10**(-25) / Atom_weight / z PHI = progonka(T_h, rho_h, 1, 1) TABLE_E[i][j] = Energy(T_h, rho_h, 1, 1, PHI) * z ** (7 / 3) #TABLE_P[i][j] = P(T_h, rho_h, PHI) * z ** (10 / 3) TABLE_P[i][j] = delta_P(T_h, rho_h) * z ** (8 / 3) print("e =", TABLE_E[i][j], "p = ", TABLE_P[i][j]) f = open('energy_aluminium.txt', 'w') for i in range(len(TABLE_E)): for j in range(len(TABLE_E[i])): f.write(str(TABLE_E[i][j])) f.write(" ") f.write("\n") f = open('pressure_aluminium.txt', 'w') for i in range(len(TABLE_P)): for j in range(len(TABLE_P[i])):
def state_function_energy(T, rho, Atom_weight, z): #return 2.626 * 10**3 / Atom_weight * bilinear_interpolation_energy(T, rho) + ionic_contribution_energy(T, volume(rho, Atom_weight)) + cold_curve_energy(volume(rho, Atom_weight)) return 2.626 * 10**3 / Atom_weight * Energy(T, rho, z, Atom_weight)