42 lines
No EOL
1.2 KiB
Python
42 lines
No EOL
1.2 KiB
Python
import numpy as np
|
|
import math
|
|
import matplotlib.pyplot as plt
|
|
import EA
|
|
|
|
def acos(X):
|
|
Y=np.zeros_like(X)
|
|
for i in range(len(X)):
|
|
Y[i]=math.acos(X[i])
|
|
return Y
|
|
|
|
def EP1(xi,alpha):
|
|
return alpha*xi - acos((1-alpha*(1-np.cos(xi)))
|
|
/(1-EA.EA1(xi,alpha)))
|
|
|
|
def EP2(xi,alpha):
|
|
return alpha*xi - acos((1-(alpha**2)*(1-np.cos(xi)))
|
|
/(1-EA.EA2(xi,alpha)))
|
|
|
|
def EP3(xi,alpha):
|
|
theta=xi/2
|
|
return alpha*xi - acos((1-2*alpha*(np.sin(theta)**2)*(1-(1-alpha)*(np.cos(theta)**2)))
|
|
/(1-EA.EA3(xi,alpha)))
|
|
|
|
xi = np.linspace(0,np.pi/8,1000)
|
|
|
|
#print(EP1(xi,0.5),"\n",EP3(xi,0.5))
|
|
|
|
for alpha in [0.2,0.5,0.8]:
|
|
fig=plt.figure(1)
|
|
plt.title(r"Erreur de phase en fonction de $\zeta$ pour CFL = "+str(alpha))
|
|
plt.xlabel(r'$\zeta$')
|
|
plt.ylabel(r'$E_\phi$')
|
|
plt.axis([-0.02 , np.pi/8+0.02 , -0.0010, 0.0030])
|
|
plt.plot(xi,abs(EP1(xi,alpha)),'-g',label="Schema 1")
|
|
plt.plot(xi,abs(EP2(xi,alpha)),'-b',label="Schema 2")
|
|
plt.plot(xi,abs(EP3(xi,alpha)),'-r',label="Schema 3")
|
|
plt.legend(loc='upper left')
|
|
plt.grid(True)
|
|
plt.show(block=False)
|
|
#plt.savefig("EP"+"_CFL ="+str(alpha)+".png")
|
|
plt.close('all') |