I just knew how to do Newton-Raphson iteration in time-independent 1D nonlinear differential equation. Then I applied to time-dependent 1D nonlinear differential equation, and I got confused.
Below is just test time-dependent 1D nonlinear differential equation I want to solve (I just made this up from heat equation, to make it nonlinear) $$ \frac{\partial u}{\partial t}+\frac{\partial^2 u}{\partial x^2}+u^2=0 $$ For this equation, I assumed I would need initial condition, and boundary condition $$ u(x,t=0)=\left\{ \begin{aligned} 1\qquad&(-1\leq x\leq 1)\\ 0\qquad&\text{otherwise} \end{aligned}\right.,\qquad u(-5,t)=0,\quad u(5,t)=0 $$ I set the $x$ range of $-5 \leq x \leq 5$, and planned to create code in Matlab.
I started with space discretization by using second-order difference $$ \frac{\partial u}{\partial t}+\frac{u_{i+1}-2u_{i}+u_{i-1}}{\Delta x^2}+u_{i}^2=0 $$ where $i$ denotes space discretization number
Then I applied Backward-Euler discretization for time discretization, which is $$ \frac{d q(x,t)}{dt}=f(t,x,q(x,t))\qquad\longrightarrow\qquad \frac{q_{j+1}-q_{j}}{\Delta t}=f_{j+1} $$ where $j$ denotes time discretization number (this is just intermediate step for me. I am planning to apply Trapezoidal Rule - Second order Backward Difference Formula (TR-BDF2) later) Now applying this, the equation looks like $$ \frac{u_{i,j+1}-u_{i,j}}{\Delta t}+\frac{u_{i+1,j+1}-2u_{i,j+1}+u_{i-1,j+1}}{\Delta x^2}+u_{i,j+1}^2=0 $$ Again, $i$ and $ j$ denotes space and time discretization respectively.
Then I applied Newton-Raphson(NR) scheme, which is for give equation $$ F(u)=0 $$ the solution is determined by iteration $$ F'(u^{k})\delta u^{k}=-F(u^{k}), \qquad \qquad u^{k+1}=u^{k}+\delta u^{k} $$ (I'm running out of space for discretization) where k denotes NR iteration number, and if $F(u)$ was system of equations, $F'(u)\delta u$ should be Jacobian. Do I have to set initial and boundary condition for $\delta u_{i,j}$ as well?
Now my equation looks like $$ \frac{\delta u_{i,j+1}^{k}-\delta u_{i,j}^{k}}{\Delta t} + \frac{\delta u_{i+1,j+1}^{k}-2\delta u_{i,j+1}^{k}+\delta u_{i-1,j+1}^{k}}{\Delta x^2} +2u_{i,j+1}^{k}\delta u_{i,j+1}^{k} = -\frac{u_{i,j+1}^{k}-u_{i,j}^{k}}{\Delta t} -\frac{u_{i+1,j+1}^{k}-2u_{i,j+1}^{k}+u_{i-1,j+1}^{k}}{\Delta x^2} -(u_{i,j+1}^{k})^2 $$
This is where I got stuck.
How do I proceed after this?
Am I missing something? like another boundary/initial conditions?
Because I only know $u_{i,1}^{0}$ and $\delta u_{i,1}^{0}$.
There are like, 11 unknowns due to backward differences ($j+1$).
Some literature says that I should solve this equation for "each time step"
Or, is this right way to apply Backward-Euler scheme and NR scheme to the time-dependent nonlinear differential equation?
Is there any good example solving time dependent nonlinear differential equation with Newton-Raphson iteration?