コード例 #1
0
    return strength * abs(J)


stren = 1.
dur = 50
margin = 5e-4

model.w = np.array([1.1, 0.32])
model.theta0 = np.array([1.95, 3.08])

j = coupling(stren)
model.J = j * model.A
T = period(model.w)
var = [model.w[0], model.w[1], model.theta0[0], model.theta0[1], j]

times, thetas = model.solve(end=dur * T)

thetaDots = np.array([])
for theta in thetas:
    thetaDot = model(theta)
    thetaDots = np.append(thetaDots, thetaDot)

thetaDots = np.reshape(thetaDots, (thetas.shape))
phiDots = np.array([abs(row[1] - row[0]) for row in thetaDots])

header = 'Frequency difference evolving through time for initial\n$\omega$ = [{0:.2f}, {1:.2f}] rad/s, $\\theta$ = [{2:.2f}, {3:.2f}] rad at J = {4:.4f}'

fig = plt.figure(1)
plt.title(header.format(*var))
plt.plot(times, phiDots, 'r-')
plt.plot([0, times[-1]], [margin, margin], 'b--')
コード例 #2
0
		strength > 1 ... sync expected '''
    phi = model.theta0[1] - model.theta0[0]
    return strength * abs(model.w[0] - model.w[1] / (2 * np.sin(phi)))


def period(omega_arr):
    omega = np.amin(abs(omega_arr))  # slower node has longer period
    return 2 * np.pi / omega


stren = 2.
T = period(model.w)

j = coupling(stren)
model.J = j * model.A
times, thetas = model.solve(T)

theta_dots = np.array([])
for theta in thetas:
    theta_dot = model(theta)
    theta_dots = np.append(theta_dots, theta_dot)

theta_dots = np.reshape(theta_dots, (thetas.shape))
phi_list = np.array([abs(row[1] - row[0]) for row in theta_dots])

header1 = 'Frequency difference evolving through time for initial\n$\omega$ = [{0:.2f}, {1:.2f}] rad/s, \
$\\theta$ = [{2:.2f}, {3:.2f}] rad at J = {4:.2f}'

var = [model.w[0], model.w[1], model.theta0[0], model.theta0[1], j]

marg = 5e-3
コード例 #3
0
ファイル: sync.py プロジェクト: LukeHannigan/Senior-Project
J_list = np.linspace(0., 10., 21)

fig1 = plt.figure(1)
fig1.suptitle('Complex order parameter integration for\n$\omega$ = [{0:.2f}, {1:.2f}], initial $\\theta$ = [{2:.2f}, {3:.2f}]'\
.format(model.w[0], model.w[1], model.theta0[0], model.theta0[1]))

fig2 = plt.figure(2)
fig2.suptitle('$\\theta$ integration over interval for\n$\omega$ = [{0:.2f}, {1:.2f}], initial $\\theta$ = [{2:.2f}, {3:.2f}]'\
.format(model.w[0], model.w[1], model.theta0[0], model.theta0[1]))
i = 1

for j in J_list:

    model.J = j * model.A
    times, thetas = model.solve(end=3e2)

    _z = model.order(thetas)
    z1 = np.append(z1, _z[-1])

    if (j % (J_max / 4.)) == 0. and j < J_max:

        ax1 = fig1.add_subplot(2, 2, i)
        ax1.set_title('J = ' + str(j))
        ax1.plot(_z.real, _z.imag, 'c-', label='J={0:.2f}'.format(j))
        ax1.plot([_z[-1].real, _z[-1].real], [_z[-1].imag, _z[-1].imag], 'yo')
        ax1.set_xlim(-1, 1)
        ax1.set_ylim(-1, 1)

        ax2 = fig2.add_subplot(2, 2, i)
        ax2.set_title('J = ' + str(j))