I'm trying to implement a backward Euler Scheme using the Newton Raphson iteration. I understand that with each iteration, one makes an initial guess, calculates the residual and solve for the change. In my case the change is del w. After that I know to add the value to w^m and get an update value for w at the next m iteration. I know to check the convergence of the solution as the iterations go on. The problem I am having is how to implement the time step dt as t=0:Tmax/dt where Tmax is say 10. I'm confused on how the time stepping comes in. I've been trying to figure this out for a while so any help will be appreciated. Thank you!
while Rw(m)>10^-6 % Convergence condition
drdw(m)=(1-2*dt+2*t(n+1)^2*w(m)*dt);
Dw(m)=Rw(m)\drdw(m); %Inverse
w(m+1)=w(m)+Dw(m); %Newton method
Rw(m+1)=(-(w(m)-v(1)-2*w(m)*dt+t(n+1)^2*w(m)^2*dt)); %New Residual value
if Rw(m+1)>10^-6 %Check on the level of convergence
m=m+1;
else
Rw=1; % I was thinking I should make the Residual 1 for the next time step.
break
end