BVP sine-Gordon problem solved with Runge Kutta

65 Views Asked by At

We have the following BVP on xgrid [-2,2] and tgrid[0,4] $$ u_{tt} -u_{xx} + \text{sin}(u)=0, u(x,0) = \sin(\pi x)^2e^{-x^2}, u_t(x,0)=\sin(\pi x)^4e^{-x^2}, 0=u(-2,t)=u(2,t) $$ and we have to solve it using RK4. We semi-discretize $u_{xx}$ such that we can write the equation as $$u_{tt} = Lu - \sin(u)$$ where $L = \frac{\partial^2}{\partial x^2}$, and then we let $u=v$, $v_t=w$, and $w_t=Av-\sin(v)$ $$ (w_t) = v_{tt} = \begin{bmatrix} \ddot{v_1} \\ \ddot{v_2} \\ \vdots\\ \vdots \\ \ddot{v_M} \\ \end{bmatrix} = \frac{1}{h^2} \cdot \begin{bmatrix} -2 & 1 & \\ 1 & -2 & 1 \\ & \ddots & \ddots & \ddots \\ & & 1 & -2 & 1 \\ & & & 1 & -2 \end{bmatrix} \cdot \begin{bmatrix} v_1 \\ v_2 \\ \vdots \\ \vdots \\ v_{M} \end{bmatrix} + \frac{1}{h^2} \cdot \begin{bmatrix} f_1(t) \\ 0 \\ \vdots \\ 0 \\ f_2(t) \end{bmatrix} - \sin \begin{bmatrix} v_1\\ v_2 \\ \vdots \\ \vdots \\ v_M \\ \end{bmatrix}. $$\

How would we proceed from here with time-integration with RK4? We later also need to find an approximaton for $u_x$, to find the energy of the system.