# CALCUL DE L'INFLUENCE DE P SUR L'ÉQUILIBRE DE LA SYNTHESE DE UF4

import numpy as np
import matplotlib.pyplot as plt
from scipy import optimize as sp # bibliotheque de la fonct. bisect (dichotomie)

K=1.1e-4
pression=np.linspace(1,500,500)
r=np.zeros(500)

# définition de la fonction f=Q-K(T) qui s'annule à l'équilibre
# x est le rendement
def f(x):
    return (4*(1-x))**4*K-(2*x)**2*(4-2*x)**2*(1/p)**2

for i in range(500): # pour chaque valeur de pression, on calcule le rendement.
    p=pression[i]
    r[i]=sp.bisect(f,0,1)

plt.figure(figsize=(15,8))
plt.plot(pression,r)

plt.grid()
plt.title("Rendement en fonction de P")
plt.ylabel("Rendement")
plt.xlabel("P en Bar")
plt.show()


