31 lines
1,011 B
Python
31 lines
1,011 B
Python
import numpy as np
|
|
import sympy
|
|
import matplotlib.pyplot as plt
|
|
|
|
def EA1(xi,alpha):
|
|
return 1-np.sqrt(1-2*alpha*(1-alpha)*(1-np.cos(xi)))
|
|
|
|
def EA2(xi,alpha):
|
|
return 1-np.sqrt(1-(alpha**2)*(1-alpha**2)*((1-np.cos(xi))**2))
|
|
|
|
def EA3(xi,alpha):
|
|
theta=xi/2
|
|
return 1-np.sqrt((1-2*alpha*(np.sin(theta)**2)*(1-(1-alpha)*(np.cos(theta)**2)))**2
|
|
+(2*alpha*np.cos(theta)*np.sin(theta)*(1+(1-alpha)*(np.sin(theta)**2)))**2)
|
|
|
|
xi = np.linspace(0,np.pi/8,1000)
|
|
|
|
for alpha in [0.2,0.5,0.8]:
|
|
fig=plt.figure(1)
|
|
plt.title(r"Erreur d'amplitude en fonction de $\zeta$ pour CFL = "+str(alpha))
|
|
plt.xlabel(r'$\zeta$')
|
|
plt.ylabel(r'$E_A$')
|
|
plt.axis([-0.02 , np.pi/8+0.02 , 1e-15, 1e-1])
|
|
plt.semilogy(xi,EA1(xi,alpha),'-g',label="Schema 1")
|
|
plt.semilogy(xi,EA2(xi,alpha),'-b',label="Schema 2")
|
|
plt.semilogy(xi,EA3(xi,alpha),'-r',label="Schema 3")
|
|
plt.legend()
|
|
plt.grid(True)
|
|
plt.show(block=False)
|
|
#plt.savefig("EA"+"_CFL ="+str(alpha)+".png")
|
|
plt.close('all')
|