def mu_shtrih_0(Atom_weight, z): x0 = x_0(Atom_weight) x1 = x_0(Atom_weight + Atom_weight * 0.1) PHI_0 = progonka(T, 3 * Atom_weight / x0 / 4 / pi / Na / a_0**3, Atom_weight, z) mu0 = PHI_0[len(PHI_0) - 1] PHI_1 = progonka(T, 3 * Atom_weight / x1 / 4 / pi / Na / a_0**3, Atom_weight, z) mu1 = PHI_1[len(PHI_1) - 1] return (mu1 - mu0) / (x1 - x0)
def delta_P(T, rho): HI = hi(T, rho) PHI = progonka(T, rho, 1, 1) #print("Hi_n = ", HI[N], "len = ", len(HI)) return 8 / (3 * pi**4) * (2 / pi)**(1 / 3) * ( 2**(7 / 6) * 3**(2 / 3) * pi**(-5 / 3) * theta(T)**(1 / 2) * volume(rho, 1)**(2 / 3) * PHI[0]**2)**(-4 / 3) * (HI[N] * integral_1_2(PHI[N]) + igrek(PHI[N]))
def S(T, rho, Atom_weight, z): PHI = progonka(T, rho, 1, 1) # ВСПОМ. ИНТЕГРАЛ def S_sub_int(T, rho): max_i = 2 while (PHI[max_i] / X[max_i] >= 10**6) and (max_i < N): max_i += 1 if max_i % 2 != 0: max_i -= 1 integr_int_1 = [Z[i] for i in range(max_i + 1)] integr_int_2 = [Z[i] for i in range(max_i, N + 1)] integr_func_1 = 0 integr_func_2 = [ 5 / 3 * integral_3_2(PHI[i] / X[i]) * X[i]**2 - PHI[i] / X[i] * integral_1_2(PHI[i] / X[i]) * X[i]**2 for i in range(max_i, N + 1) ] #integr_res_1 = integrate.simps(integr_func_1, integr_int_1) integr_res_2 = integrate.simps(integr_func_2, integr_int_2) return integr_res_2 #ЭЛЕКТРОННАЯ ЭНТРОПИЯ def S_e(T, rho): const = 4 * 2**(1 / 2) * theta(T)**(3 / 2) * r_0(rho, 1)**3 / pi #print(const * S_sub_int(T, rho)) return const * S_sub_int(T, rho) ##ПОЛНАЯ ЭНТРОПИЯ def S(T, rho): return 0.9648 * 10**2 / Atom_weight * (S_e(T, rho) + 3 / 2 * log( 1836 * Atom_weight * theta(T) * volume(rho, 1)** (2 / 3) / 2 / pi, e) + 5 / 3) return S(T, rho)
def S_integrals(T, rho): HI = hi_function(T, rho) PHI = progonka(T, rho) max_i = 0 for i in range(1, N + 1): if PHI[i] / X[i] >= 10**6: max_i = i subfunc1 = [0] * (max_i + 1) subfunc2 = [] subx = [0] * (max_i + 1) for i in range(max_i + 1): subx[i] = X[i] nadx = [] for i in range(max_i + 1, N + 1): nadx.append(X[i]) for i in range(max_i + 1): subfunc1[i] = 4 / 3 * (22 * PHI[i]**2 * Z[i] + PHI[i]**(3 / 2) * HI[i]) for i in range(max_i + 1, N + 1): subfunc2.append(X[i] * HI[i] * integral_1_2(PHI[i] / X[i]) + 4 * Z[i]**2 * igrek(PHI[i] / X[i])) return scipy.integrate.trapz(subfunc1, subx) + scipy.integrate.trapz( subfunc2, nadx)
def P(T, rho, Atom_weight, z): PHI = progonka(T, rho, Atom_weight, z) #return (P_e(T, rho) + theta(T) / volume(rho)) return 32 / (3 * pi**3) * (2 / pi)**(2 / 3) * ( 2**(7 / 6) * 3**(2 / 3) * pi**(-5 / 3) * theta(T)**(1 / 2) * volume(rho, 1)**(2 / 3) * (PHI[0])**2)**(-5 / 3) * integral_3_2(PHI[N])
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): #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)):
def delta_mu(T, rho): HI = hi(T, rho) PHI = progonka(T, rho) return (2 * theta(T))**(1 / 2) / (6 * math.pi) * ( 1 / 2 * integral_minus_1_2(PHI[N]) + HI[N])
def delta_P(T, rho): HI = hi_function(T, rho) PHI = progonka(T, rho) return theta(T)**2 / (3 * math.pi**3) * (HI[N] * integral_1_2(PHI[N]) + igrek(PHI[N]))
def hi(T, rho): PHI = progonka(T, rho) PHI_2N = progonka_2N(T, rho) Y = [0] * (N + 1) Z = [0] * (N + 1) h = [0] * (N + 1) k1 = [0] * (N + 1) q1 = [0] * (N + 1) k2 = [0] * (N + 1) q2 = [0] * (N + 1) k3 = [0] * (N + 1) q3 = [0] * (N + 1) k4 = [0] * (N + 1) q4 = [0] * (N + 1) def priblizhenie_hi(sigma): const = 4 * (2 * theta(T))**0.5 / pi * (r_0(rho))**2 Y[N] = sigma Z[N] = sigma for i_iter in range(N, 1, -1): h[i_iter] = (-2 * i_iter + 1) / N**2 k1[i_iter] = h[i_iter] * const * ( integral_sht_1_2(PHI[i_iter] / X[i_iter]) * Y[i_iter] + X[i_iter] * igrek_sht(PHI[i_iter] / X[i_iter])) q1[i_iter] = h[i_iter] * Z[i_iter] #k2[i_iter] = h[i_iter] * const * (integral_sht_1_2(((PHI[i_iter] + PHI[i_iter - 1]) / 2) / ((X[i_iter] + X[i_iter - 1]) / 2)) * (Y[i_iter] + q1[i_iter] / 2) + ((X[i_iter] + X[i_iter - 1]) / 2) * igrek_sht((PHI[i_iter] + PHI[i_iter - 1]) / 2) / ((X[i_iter] + X[i_iter - 1]) / 2)) k2[i_iter] = h[i_iter] * const * ( integral_sht_1_2(PHI_2N[2 * i_iter - 1] / X[i_iter]) * (Y[i_iter] + q1[i_iter] / 2) + X[i_iter] * igrek_sht(PHI_2N[2 * i_iter - 1] / X[i_iter])) q2[i_iter] = h[i_iter] * (Z[i_iter] + k1[i_iter] / 2) #k3[i_iter] = h[i_iter] * const * (integral_sht_1_2(((PHI[i_iter] + PHI[i_iter - 1]) / 2) / ((X[i_iter] + X[i_iter - 1]) / 2)) * (Y[i_iter] + q2[i_iter] / 2) + ((X[i_iter] + X[i_iter - 1]) / 2) * igrek_sht((PHI[i_iter] + PHI[i_iter - 1]) / 2) / ((X[i_iter] + X[i_iter - 1]) / 2)) k3[i_iter] = h[i_iter] * const * ( integral_sht_1_2(PHI_2N[2 * i_iter - 1] / X[i_iter]) * (Y[i_iter] + q2[i_iter] / 2) + X[i_iter] * igrek_sht(PHI_2N[2 * i_iter - 1] / X[i_iter])) q3[i_iter] = h[i_iter] * (Z[i_iter] + k2[i_iter] / 2) k4[i_iter] = h[i_iter] * const * ( integral_sht_1_2(PHI[i_iter - 1] / X[i_iter - 1]) * (Y[i_iter] + q3[i_iter]) + X[i_iter - 1] * igrek_sht(PHI[i_iter - 1] / X[i_iter - 1])) q4[i_iter] = h[i_iter] * (Z[i_iter] + k3[i_iter]) Y[i_iter - 1] = Y[i_iter] + (q1[i_iter] + 2 * q2[i_iter] + 2 * q3[i_iter] + q4[i_iter]) / 6 Z[i_iter - 1] = Z[i_iter] + (k1[i_iter] + 2 * k2[i_iter] + 2 * k3[i_iter] + k4[i_iter]) / 6 Z[0] = Z[1] + 1 / 3 * (Z[1] - Z[2]) i_iter = 1 k1[i_iter] = h[i_iter] * const * ( integral_sht_1_2(PHI[i_iter] / X[i_iter]) * Y[i_iter] + X[i_iter] * igrek_sht(PHI[i_iter] / X[i_iter])) q1[i_iter] = h[i_iter] * Z[i_iter] k2[i_iter] = h[i_iter] * const * ( integral_sht_1_2(PHI_2N[2 * i_iter - 1] / X[i_iter]) * (Y[i_iter] + q1[i_iter] / 2) + X[i_iter] * igrek_sht(PHI_2N[2 * i_iter - 1] / X[i_iter])) #k2[i_iter] = h[i_iter] * const * (integral_sht_1_2(((PHI[i_iter] + PHI[i_iter - 1]) / 2) / ((X[i_iter] + X[i_iter - 1]) / 2)) * (Y[i_iter] + q1[i_iter] / 2) + ((X[i_iter] + X[i_iter - 1]) / 2) * igrek_sht((PHI[i_iter] + PHI[i_iter - 1]) / 2) / ((X[i_iter] + X[i_iter - 1]) / 2)) q2[i_iter] = h[i_iter] * (Z[i_iter] + k1[i_iter] / 2) k3[i_iter] = h[i_iter] * const * ( integral_sht_1_2(PHI_2N[2 * i_iter - 1] / X[i_iter]) * (Y[i_iter] + q2[i_iter] / 2) + X[i_iter] * igrek_sht(PHI_2N[2 * i_iter - 1] / X[i_iter])) #k3[i_iter] = h[i_iter] * const * (integral_sht_1_2(((PHI[i_iter] + PHI[i_iter - 1]) / 2) / ((X[i_iter] + X[i_iter - 1]) / 2)) * Y[i_iter] + q2[i_iter] / 2) + ((X[i_iter] + X[i_iter - 1]) / 2) * igrek_sht((PHI[i_iter] + PHI[i_iter - 1]) / 2) / ((X[i_iter] + X[i_iter - 1]) / 2)) q3[i_iter] = h[i_iter] * (Z[i_iter] + k2[i_iter] / 2) q4[i_iter] = h[i_iter] * (Z[i_iter] + k3[i_iter]) Y[i_iter - 1] = Y[i_iter] + (q1[i_iter] + 2 * q2[i_iter] + 2 * q3[i_iter] + q4[i_iter]) / 6 return Y def sigma_2(sigma_0, sigma_1): HI0_0 = priblizhenie_hi(sigma_0)[0] HI0_1 = priblizhenie_hi(sigma_1)[0] print('sigma = ', sigma_1 - (sigma_1 - sigma_0) * HI0_1 / (HI0_1 - HI0_0)) return sigma_1 - (sigma_1 - sigma_0) * HI0_1 / (HI0_1 - HI0_0) return priblizhenie_hi(-6.30651686)
import math import numpy as np import matplotlib.pyplot as plt from math import gamma from Changing_parameters import N, T, rho from Tabular_values import a_0, Na, E_h from Dirak_functions import integral_1_2, integral_3_2, integral_minus_1_2 from Atom_parameters import Atom_weight, z from Cell import z_0, r_0, volume, theta, eta from working_progonka import progonka, X PHI = progonka(T, rho, 1, 1) RESULT_V = [0] * (N + 1) R = [] F = [0] * (N + 1) V = [0] * (N + 1) for i in range(N + 1): R.append(X[i] * r_0(rho)) mu = PHI[N] for i in range(N + 1): if i == 0: F[0] = z / theta(T) else: F[i] = PHI[i] / X[i] * R[i] for i in range(1, N + 1): if i == N: V[N] = 0 else: V[i] = F[i] / R[i] * theta(T) - mu
def mu(x, Atom_weight, z): PHI = progonka(T, 3 * Atom_weight / x / 4 / pi / Na / a_0**3, Atom_weight, z) return PHI[len(PHI) - 1]
def mu_0(Atom_weight, z): PHI = progonka(T, rho, Atom_weight, z) return PHI[len(PHI) - 1]
def Energy(T, rho, z, Atom_weight): PHI = progonka(T, rho, Atom_weight, z) # ВСПОМ. ИНТЕГРАЛ def E_sub_int(T, rho): max_i = 2 while (PHI[max_i] / X[max_i] >= 10**6) and (max_i < N): max_i += 1 if max_i % 2 != 0: max_i -= 1 integr_int_1 = [Z[i] for i in range(max_i + 1)] integr_int_2 = [Z[i] for i in range(max_i, N + 1)] #integr_int_2 = [X[i] for i in range(max_i, N + 1)] integr_func_1 = [4/5 * PHI[i]**2.5 for i in range(max_i + 1)] integr_func_2 = [2 * Z[i]**5 * integral_3_2(PHI[i] / Z[i]**2) for i in range(max_i, N + 1)] integr_res_1 = integrate.simps(integr_func_1, integr_int_1) integr_res_2 = integrate.simps(integr_func_2, integr_int_2) return integr_res_1 + integr_res_2 const = 2**(0.5) / (pi**2) * (theta(T)**2.5) * (4/3) * pi * r_0(rho, 1)**3 # КИНЕТИЧЕСКАЯ ЭНЕРГИЯ #def E_k(T, rho): # #return (3 * 2**0.5 / pi**2) * volume(rho) * theta(T)**2.5 * E_sub_int(T, rho) # # return 3 * const * E_sub_int(T, rho) ## ПОТЕНЦИАЛЬНАЯ ЭНЕРГИЯ #def E_p(T, rho): # #return (2 * 2**0.5 / pi**2) * volume(rho) * theta(T)**2.5 * (integral_3_2(-eta(T, rho)) - 3 * E_sub_int(T, rho)) # return 2 * const * (integral_3_2(-eta(T, rho, 1, 1)) - 3 * E_sub_int(T, rho)) # Проверяем virial theorem #print(2 * E_k(Temperature_system, rho_system) + E_p(Temperature_system, rho_system)) #print(3 * P_e(Temperature_system, rho_system) * volume(rho_system)) ## ВНУТРЕННЯЯ ЭНЕРГИЯ ЭЛЕКТРОНОВ #def E_e(T, rho): # return E_k(T, rho) + E_p(T, rho) # # ПОЛНАЯ ЭНЕРГИЯ def E(T, rho): #return E_e(T, rho) - E_0 + 3/2 * theta(T) return const * (2 * integral_3_2(-eta(T, rho, 1, 1)) - 3*E_sub_int(T, rho)) + 0.76874512421364*1**(7/3) return E(T , rho)