Beispiel #1
0
X = [0] * (N + 1)
A = [0] * (N + 1)
B = [0] * (N + 1)
C = [0] * (N + 1)
D = [0] * (N + 1)
ITERATIONS = [[0] * (N + 1)] * 5
RESULT0 = [0] * (N + 1)
RESULT1 = [0] * (N + 1)
RESULT2 = [0] * (N + 1)
RESULT3 = [0] * (N + 1)
RESULT4 = [0] * (N + 1)
ALPHA = [0] * (N + 1)
BETA = [0] * (N + 1)
Y = [0] * (N + 1)
# константа а в уравнении
const = 4 * (2 * theta(T))**2 / math.pi * (r_0(rho))**2


# СЕТКА
def x():
    for i in range(N + 1):
        X[i] = (i / N)**2


def phi(s=s_current, T=T, rho=rho):
    for i in range(N + 1):

        if i == 0:
            PHI_S[s_current][0] = z / (theta(T) * r_0(rho))
        else:
            PHI_S[s_current][i] = z / (theta(T) * r_0(rho)) * (
Beispiel #2
0
def n_e_full1(i):
    return (((2*theta(T))**1.5)/(2*(math.pi)**2))*integral_1_2((V(i)+Chem_potential_e())/theta(T))
Beispiel #3
0
def rho_e(i):
    return c1*integral_1_2((V(i)+Chem_potential_e())/theta(T))
Beispiel #4
0
def n_e_pribl():
    return (((2*theta(T))**1.5)/(2*(math.pi)**2))*integral_1_2((Chem_potential_e())/theta(T))
Beispiel #5
0
def Vr(i):
    return (PHI[i] + Chem_potential_e_preved*X[i]*r0)*theta(T)
def Chem_potential_e():
    return theta(T)*PHI[N]
Beispiel #7
0
def x():
    for i in range(1,N + 1):
        X[i] = (i / N) ** 2
x()
X[0] = X[1]/2

n_e_full = [0]*(N+1)
#def Chem_potential_e():
#    return (RESULT3[N])
def Chem_potential_e():
    return -1.33*(10**(-2))
def n_e_pribl():
    return (((2*theta(T))**1.5)/(2*(math.pi)**2))*integral_1_2((Chem_potential_e())/theta(T))
u = n_e_pribl()
Z0 = u * (4/3) * math.pi * ((r0)**3)
print(((-Chem_potential_e())/theta(T)))
print(r0)
print(theta(T))
print(Z0)
#print(RESULT3[0])
#print(Chem_potential_e())
#Chem_potential_e =9.780787802584433
#print(Chem_potential_e())
Chem_potential_e_preved = -Chem_potential_e()/theta(T)
def Vr(i):
    return (PHI[i] + Chem_potential_e_preved*X[i]*r0)*theta(T)
def V(i):
    return Vr(i)/(X[i]*r0)
def g(r):
    return 1/(1+(math.e**(k*(r-R))))
Beispiel #8
0
 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)
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
for i in range(N + 1):
    if i == 0:
        RESULT_V[0] = z
    else:
        RESULT_V[i] = (V[i] * R[N] + eta(T, rho) * R[i]) * theta(T)
RESULT_R = [0] * (N + 1)
for i in range(N + 1):
    RESULT_R[i] = R[i]
Beispiel #10
0
RESULT = [0] * s
for i in range(s):
    RESULT[i] = [0] * (N + 1)

X = [0] * (N + 1)
A = [0] * (N)
B = [0] * (N)
C = [0] * (N)
D = [0] * (N)

ALPHA = [0] * (N + 1)
BETA = [0] * (N + 1)
Y = [0] * (N + 1)

# константа а в уравнении
const = 4 * (2 * theta(T))**(1 / 2) / math.pi * (r_0(rho))**2

# СЕТКА

for i in range(N + 1):
    X[i] = (i / N)**2
for i in range(N + 1):

    if i == 0:
        PHI_S[0][0] = z / (theta(T) * r_0(rho))
    else:
        PHI_S[0][i] = z / (theta(T) * r_0(rho)) * (1 - 3 / 2 * X[i] + 1 / 2 *
                                                   (X[i])**3) - eta(T,
                                                                    rho) * X[i]

# ШАГ СЕТКИ
Beispiel #11
0
 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)
Beispiel #12
0
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)
def electron_density(i):
    return const_e*int1_2((V(i)+Chem_potential_e())/theta(T))
def Vr(i):
    return ((PHI[i])*theta(T)*r0 - Chem_potential_e()*X[i]*r0)
def progonka_2N(T, rho):
    # константа а в уравнении
    const_a = 4 * (2 * theta(T))**0.5 / pi * (r_0(rho))**2

    PHI_S = [[0 for i in range(N + 1)] for j in range(s + 1)]
    RESULT = [[0 for i in range(N + 1)] for j in range(s)]

    for i in range(N + 1):
        if i == 0:
            PHI_S[0][0] = z / (theta(T) * r_0(rho))
        else:
            PHI_S[0][i] = z / (theta(T) *
                               r_0(rho)) * (1 - 3 / 2 * U[i] + 1 / 2 *
                                            (U[i])**3) - eta_0(T, rho) * U[i]

    s_current = 0

    while s_current < s:
        B = [0] + [
            -4 * U[i] * (1 + const_a * h_N**2 * U[i]**2 *
                         integral_minus_1_2(PHI_S[s_current][i] / U[i]**2))
            for i in range(1, N)
        ]
        D = [0] + [
            4 * const_a * h_N**2 * U[i]**3 *
            (2 * U[i]**2 * integral_1_2(PHI_S[s_current][i] / U[i]**2) -
             PHI_S[s_current][i] *
             integral_minus_1_2(PHI_S[s_current][i] / U[i]**2))
            for i in range(1, N)
        ]

        ALPHA = [0] * (N + 1)
        BETA = [0] * (N + 1)
        for i in range(N - 1, -1, -1):
            if i == N - 1:
                ALPHA[i] = 1 / (
                    1 - 2 * h_N + h_N**2 *
                    (1 + const_a * integral_minus_1_2(PHI_S[s_current][N])))
                BETA[i] = -h_N**2 * const_a * (
                    2 * integral_1_2(PHI_S[s_current][N]) - PHI_S[s_current][i]
                    * integral_minus_1_2(PHI_S[s_current][N])) * ALPHA[N - 1]
            else:
                ALPHA[i] = -A[i + 1] / (B[i + 1] + C[i + 1] * ALPHA[i + 1])
                BETA[i] = (D[i + 1] - C[i + 1] * BETA[i + 1]) / (
                    B[i + 1] + C[i + 1] * ALPHA[i + 1])

        # ИСКОМОЕ УРАВНЕНИЕ
        Y = [0] * (N + 1)
        for i in range(N + 1):
            if i == 0:
                Y[i] = z / (theta(T) * r_0(rho))
            else:
                Y[i] = ALPHA[i - 1] * Y[i - 1] + BETA[i - 1]

        for i in range(N + 1):
            RESULT[s_current][i] = PHI_S[s_current][i] * theta(T)

        for i in range(N + 1):
            PHI_S[s_current + 1][i] = Y[i]

        s_current += 1
    PHI = [RESULT[8][i] / theta(T) for i in range(N + 1)]

    return PHI
Beispiel #16
0
    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
Beispiel #17
0
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]))
import sympy
from sympy import *
import matplotlib.pyplot as plt
from progonka import PHI
import numpy as np
T = 0.001
rho =1
N=50000
A = 196.96657
r0 = 1.388*(A/rho)**(1/3)


X=[0]*(N+1)

const = ((2)**(0.5))/((math.pi)**2)
const_e = ((2*theta(T))**1.5)/(2*((math.pi)**2))
def Chem_potential_e():
    return theta(T)*PHI[N]
print(Chem_potential_e())

def x():
    for i in range(1,N + 1):
        X[i] = (i / N) ** 2
x()
X[0] = X[1]/2
H =[0]*(N+1)
def setka():
    for i in range(1, N + 1):
        H[i] = (i/N)
setka()
def int1_2(x):