-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_slab.py
94 lines (58 loc) · 2.58 KB
/
test_slab.py
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
"""
Created on Wed Nov 8 16:34:22 2017
@author: Mihai
"""
import pytes
from test_class_slab import Asymmetric_slab
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
slab = Asymmetric_slab(R1=1.4, R2=1.4, kx0=1, c0=0.6, M_A=0)
x_range_pts = np.linspace(0, 2, 1000)
y_range_pts = np.linspace(0, 1, 1000)
x_range = np.linspace(0, 2, 51)
y_range = np.linspace(0, 1, 51)
kwargs = {'x-axis':'kx0', 'M_A':slab.M_A}
root_array = pytes.grid_solver(slab.disp_rel, x_range, y_range, kwargs, method='sp.newton')
points = pytes.grid_find_sign_change(slab.disp_rel, x_range_pts, y_range_pts, kwargs)
line = pytes.line_trace(slab.disp_rel, 1, 0.596, 0.001, 0, 2, kwargs)
gs = gridspec.GridSpec(1,2)
plt.figure(num=None, figsize=(15, 10), dpi=80, facecolor='w', edgecolor='k')
ax1 = plt.subplot(gs[:,1])
ax1.plot(root_array[:, 0], np.real(root_array[:, 1]), '.', color='b')
ax1.plot(root_array[:, 0], np.imag(root_array[:, 1]), '.', color='r')
ax1.plot(line[:,0], line[:,1], linestyle='-', color='b', linewidth=3)
ax1.set_xlim(x_range[0], x_range[-1])
ax1.set_ylim(y_range[0], y_range[-1])
ax1.set_ylabel(r'$vph$', fontsize=30)
ax1.set_xlabel(r'$kx_0$', fontsize=30)
ax1.set_title(r'grid_solver', fontsize=25)
ax2 = plt.subplot(gs[:,0])
ax2.plot(points[:, 0], points[:, 1], 'b,')
ax2.plot(line[:,0], line[:,1], linestyle='-', color='b', linewidth=3)
ax2.set_xlim(x_range_pts[0], x_range_pts[-1])
ax2.set_ylim(y_range_pts[0], y_range_pts[-1])
ax2.set_xlabel(r'$kx_0$', fontsize=30)
ax2.set_title(r'grid_find_sign_change', fontsize=25)
x_range_pts = np.linspace(0, 2, 1000)
y_range_pts = np.linspace(0, 1, 1000)
x_range = np.linspace(0, 2, 101)
y_range = np.linspace(0, 1, 101)
kwargs = {'x-axis':'M_A', 'kx0':slab.kx0}
points = pytes.grid_find_sign_change(slab.disp_rel, x_range_pts, y_range_pts, kwargs)
root_array = pytes.grid_solver(slab.disp_rel, x_range, y_range, kwargs, method='sp.newton')
plt.figure(num=None, figsize=(15, 10), dpi=80, facecolor='w', edgecolor='k')
ax3 = plt.subplot(gs[:,1])
ax3.plot(root_array[:, 0], np.real(root_array[:, 1]), '.', color='b')
ax3.plot(root_array[:, 0], np.imag(root_array[:, 1]), '.', color='r')
ax3.set_xlim(x_range[0], x_range[-1])
ax3.set_ylim(y_range[0], y_range[-1])
ax3.set_ylabel(r'$vph$', fontsize=30)
ax3.set_xlabel(r'$M_A$', fontsize=30)
ax3.set_title(r'grid_solver', fontsize=25)
ax4 = plt.subplot(gs[:,0])
ax4.plot(points[:, 0], points[:, 1], 'b,')
ax4.set_xlim(x_range_pts[0], x_range_pts[-1])
ax4.set_ylim(y_range_pts[0], y_range_pts[-1])
ax4.set_xlabel(r'$M_A$', fontsize=30)
ax4.set_title(r'grid_find_sign_change', fontsize=25)