Hi
I’d like to know how to implement a Kuramoto-like (coupled nonlinear oscillators) system in DifferentialEquations.jl. If you are familiar with this stuff, I am trying to produce a system proposed by Matthew,Mirollo and Strogatz Here is the paper
To my understanding, this is just a system of ODE. I produced a minimal example of it here with three oscillators(below). The thing is that they use 800 oscillators.
How one is supposed to implement (elegantly) a large system of DiffEqs in DifferentialEquations.jl ??? With Metaprogramming? Another magic?
My MWE:
Each oscillator z_{j} is just
z_{j}=(1-|z_{j}|^2+iw_{j})z_{j}+K(mean(all \,\, z_{j}) -z_{j})
function parametrized_strogatz(du,u,p,t)
#Coupling constant
K=p.K
##order parameter
du[1]=(du[2]+du[3]+du[4])/3.0
#oscillators
du[2] = (1.0-abs2(u[2])+p.w2*im)u[2]+K*(u[1]-u[2])
du[3] = (1.0-abs2(u[3])+p.w3*im)u[3]+K*(u[1]-u[3])
du[4] = (1.0-abs2(u[4])+p.w4*im)u[4]+K*(u[1]-u[4])
end
u0 = [1.0+0.0im,1.0+0.0im,1.0+0.0im] ##starting points
pushfirst!(u0,sum(u0)) ## starting point of the order parameter(sum of all oscillators)
tspan = (0.0,100.0)
# K=coupling constant
#wi=natural frequency of oscillator i
p = (K=0.9,w2=7,w3=10,w4=13)
prob = ODEProblem(parametrized_strogatz,u0,tspan,p)
sol = solve(prob)
p1=plot(sol,vars=(0,[1,2,3,4]),labels=["Order parameter" "oscillator 1" "oscillator 2" "oscillator 3"])