# Breather solutions of Sine-Gordon Using Finite Differences

I'm attempting to simulate a standing breather of the form $$u(x,t)=4\tan^{-1}\left(\sqrt{3}\cos\left(\frac{t}{2}\right)sech\left(\frac{\sqrt{3}x}{2}\right)\right)$$ for the Sine-Gordon equation $$u_{tt}-u_{xx}+\sin u =0$$ on the real line by using centered differences in both time and space. Because of reflections and the use of zero Dirichlet conditions, I get something like this after just a bit of time:

How does one avoid this and make it seem like the simulation is on the whole of $\mathbb{R}$?

Code in MATLAB for reference

l=40;delta=0.08;T=80;h=0.1;
t=linspace(0,T,T/delta);
x=linspace(-l,l,l/h);
u=zeros(length(x),length(t));
u0=4*atan(sqrt(3)*sech(sqrt(3)*x/2));
ut0=0*x;
for n=2:length(x)-1
u(n,1)=u0(n);
u(n,2)=(delta/h)^2/2*(u0(n+1)+u0(n-1))-(delta)^2/2*sin(u0(n))+(1-(delta/h)^2)*u0(n)+delta*ut0(n);
end
for m=2:length(t)-1
for n=2:length(x)-1
u(n,m+1)=(delta/h)^2*(u(n+1,m)+u(n-1,m))-delta^2*sin(u(n,m))+2*(1-(delta/h)^2)*u(n,m)-u(n,m-1);
end
plot(x,u(:,m+1));
ylim([-4 4]);
xlabel('x');
ylabel('u(x,t)');
pause(0.001);
end

• AFAIK, in order to avoid reflections from the boundary one can use either absorbing boundary conditions (ABC), perfectly matching layers (PML) or sponge techniques. Another thing is that central finite differences lead to non-monotone schemes which produce non-physical oscillations and are said to be bad for hyperbolic equations. So probably you should consider using some other discretization schemes (WENO methods, or something like that). – VorKir Mar 15 '17 at 2:18