Sine-Gordon Animations

Equations of Motion

V[ϕ_,α_,b_]:=α(1-Cos[b ϕ])

ℒ[x_,t_,ϕ_,α_,b_]:=((1/2)(((((∂_tp)ϕ[xp,tp]))^2)-((((∂_xp)ϕ[xp,tp]))^2))/.{xp->x,tp->t})-V[ϕ[x,t,α,b]]

SineGordon[x_,t_,ϕ_,α_,b_]:=(∂_tp)((∂_((∂_tp)ϕ[xp,tp]))ℒ[xp,tp,ϕ,α,b])+(∂_xp)((∂_((∂_xp)ϕ[xp,tp]))ℒ[xp,tp,ϕ,α,b])==(∂_(ϕ[xp,tp]))ℒ[xp,tp,ϕ,α,b]/.{xp->x,tp->t}

Solutions

ϕarb[α_,b_,xini_,vini_,xrange_,trange_,bound_,ϕ_,x_,t_]:=NDSolve[{SineGordon[x,t,ϕ,α,b],ϕ[x,0]==xini[x],((∂_tp)ϕ[x,tp]/.tp->0)==vini[x],bound},ϕ[x,t],{x,xrange/.List->Sequence},{t,trange/.List->Sequence}]

ϕk[v_,b_,α_,x_,t_]:=(4/b)ArcTan[(E^((Sqrt[α])b(x-v t)/(Sqrt[1-(v^2)])))]

ϕka[v_,b_,α_,x_,t_]:=(4/b)ArcTan[((Sinh[v t/(Sqrt[1-(v^2)])])/(v Cosh[(Sqrt[α])b x/(Sqrt[1-(v^2)])]))]

ϕkk[v_,b_,α_,x_,t_]:=(4/b)ArcTan[((v Sinh[(Sqrt[α])b x/(Sqrt[1-(v^2)])])/(v Cosh[v t/(Sqrt[1-(v^2)])]))]

ϕbs[v_,b_,α_,x_,t_]:=(4/b)ArcTan[((v Sin[v t/(Sqrt[1+(v^2)])])/(v Cosh[(Sqrt[α])b x/(Sqrt[1+(v^2)])]))]

Animation Code

drawPendula[f_,range_,n_,rad_]:=Module[{lines,balls,ypos,pos},
lines={};balls={};
For[i=1,i≤n,i++,
ypos=range[[1]]+((i-1)/(n-1))(range[[2]]-range[[1]]);
pos={Sin[f[ypos]],ypos,-Cos[f[ypos]]};
AppendTo[lines,Line[{{0,ypos,0},pos}]];
AppendTo[balls,Sphere[pos,rad]];];
Graphics3D[Join[lines,{Blue,balls}],Boxed->False,PlotRange->{{-1.1,1.1},range,{-1.1,1.1}}]]

sineGordonAnimate[sol_,xrange_,trange_,n_,rad_]:=
Animate[drawPendula[sol[#,t]&,xrange,n,rad],{t,(trange/.List->Sequence)}]

Examples

sineGordonAnimate[ϕk[0.1,1,1,#1,#2]&,{-7,7},{-100,100},50,0.05]

xinit[x_]:=4 ArcTan[(E^(4(x+3)))]+4ArcTan[(E^(4(x-3)))]+4ArcTan[(E^(-4x))]

sol[x_,t_]=ϕ[x,t]/.ϕarb[1,1,xinit,0&,{-10,10},{0,30},0==(∂_t)ϕ[-10,t]==(∂_t)ϕ[10,t],ϕ,x,t][[1]];

sineGordonAnimate[sol,{-10,10},{0,30},100,0.05]