1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
import numpy as np
import matplotlib.pyplot as plt
import scipy.optimize as op
## ==================================
## ==== Paramètres ==================
ISYM = 2
nu = 0.25
k2 = 2*(1-nu)/(1-2*nu)
Nbracine = 8
sp = 5
sv = np.arange(0.01, sp, 0.01)
a0 = (0.2)**2
#xv = np.zeros([len(sv),Nbracine])
def Sym(a, s2, k2):
x = np.sqrt(a - s2)
y = np.sqrt(a /k2 -s2)
f = ( (np.sin(x)*np.cos(y)*(a -2*s2)**2)/x + np.cos(x)*np.sin(y)*4*s2*y )/a
return f
def Antisym(a, s2, k2):
x = np.sqrt(a - s2)
y = np.sqrt(a /k2 - s2)
g = ( np.sin(x)*np.cos(y)*4*s2*x + (np.cos(x)*np.sin(y)*(a - 2*s2)**2)/y )/a
return g
for n in range(Nbracine):
a0 = n**2 - 0.99
for j in range(len(sv)):
s2 = sv[j]**2
if n == 1:
Dfun = lambda a: 1
else:
Dfun = lambda a: np.prod( [a - xv[j, 0:n-1]], axis=1)
if ISYM == 1:
xv[j, n] = op.fsolve(lambda a: rl.Sym(a, s2, k2)/Dfun(a), a0)
else:
xv[j, n] = op.fsolve(lambda a: rl.Antisym(a, s2, k2)/Dfun(a), a0)
a0 = xv[j, n]
omega = np.sqrt(xv)
plt.figure()
plt.plot(sv, omega)
plt.xlabel('$kh$')
plt.ylabel('$fh$')
plt.title('Courbe de dispersion des 8 premiers modes de Lamb')
plt.grid()
plt.show() |
Partager