-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjj2_identical.py
executable file
·54 lines (44 loc) · 1.75 KB
/
jj2_identical.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
#!/usr/bin/python
#
# Two identical Josephson junctions coupled via a quasiparticle current.
#
import math
import numpy
import sde
import sympy
import sys
def init_vector(sdei, i):
return numpy.random.uniform(0.0, 2.0 * numpy.pi, sdei.num_threads)
# Random initial phase of the AC drive.
const_pars = {
'phi0': lambda sdei: numpy.random.uniform(0.0, 2.0 * numpy.pi, sdei.num_threads)
}
sim_params = {'i1': 'constant force on the 1st particle',
'i2': 'constant force on the 2nd particle',
'alpha': 'coupling strength',
'd0': 'noise strength',
'a1': 'AC drive amplitude for the 1st particle',
'a2': 'AC drive amplitude for the 2nd particle',
'omega': 'AC drive frequency'}
local_vars = {
'ns0': lambda sdei: sympy.sqrt(sdei.S.d0 * sdei.S.dt),
}
code = """
dx0 = i1 - sinf(x0) + alpha * (i2 - sinf(x1)) + (a1 + alpha * a2) * cosf(omega * t + phi0);
dx1 = i2 - sinf(x1) + alpha * (i1 - sinf(x0)) + (alpha * a1 + a2) * cosf(omega * t + phi0);
"""
ns_map = {0: ['ns0', 0], 1: [0, 'ns0']}
period_map = {0: sde.PeriodInfo(period=2.0 * math.pi, freq=1),
1: sde.PeriodInfo(period=2.0 * math.pi, freq=1)}
sdei = sde.SDE(code, sim_params, num_vars=2, num_noises=2, const_pars=const_pars, noise_map=ns_map, period_map=period_map,
local_vars=local_vars)
output = {'path': {
'main': [sde.OutputDecl(func=sde.avg_moments, vars=[0, 1])],
},
'summary': {
'main': [sde.OutputDecl(func=sde.drift_velocity, vars=[0, 1])],
# 'abs': [sde.OutputDecl(func=sde.abs_drift_velocity, vars=[0, 1])],
}
}
sdei.prepare(sde.SRK2, init_vector, freq_var='omega')
sdei.simulate(output)