I am using some finite difference algorithm to solve the problem of a parabolic equation. Reading the Leveque's book on finite differences he suggests to test convergence of the method by considering the ratio of differences between solutions, that is $$\frac{u_h-u_{h/2}}{u_{h/2}-u_{h/4}}$$. I understand that it is valid at any given point on the grid but can I estimate in the same way the convergence of the whole solution which is the vector with a dimension $N$, the number of grid points? My goal is to show convergence of the method where the error $e$ is defined as a difference between numerical solution and the function projected on the grid. That is I want to find $p$ s.t. $||e||=Ch^p$. Let me know if the approach is still valid, thus I would find the ratio not the differences but the ration of those norms, i.e. $$\frac{||u_h-u_{h/2}||}{||u_{h/2}-u_{h/4}||}$$
|
|
The usual procedure for verifying convergence rates is to take a problem where you know the exact solution analytically. The easiest way to do this is to start from the solution: Pick a function that satisfies the boundary data and then plug it into the differential equation to get the corresponding right-hand side. (This is sometimes called the method of manufactured solution.) A (very simple) example: Consider the one-dimensional parabolic problem $$ u_t - u_{xx} = f $$ with boundary conditions $u(t,0) = u(t,1) = 0$ and initial conditions $u(0,x) = 0$. Then you could choose, say, $$ u(t,x) = \sin(\pi x)t $$ and compute $$ f(t,x) = u_t(t,x) - u_{xx}(t,x) = (1+\pi^2t)\sin(\pi x)$$ and use this as the right hand side in your finite difference code. This is a bit more complicated if you need to consider, e.g., jumping coefficients, but it can be done by choosing the coefficients together with the right-hand side. |
|||||||||||
|
|
Yes, what you're proposing is certainly a valid approach. I will attempt to also answer what I think you have asked in the comments. If this is the answer you're looking for, then we should clarify the question. The error is of the form $$\|e_h\| = Ch^p + {\mathcal O}(h^{p+1})$$ where, importantly, $C$ is independent of $h$. Note that if we take the log of the above, we get $$\log(\|e_h\|) \approx \log(C) + p\log(h),$$ so if you plot error versus $h$ on a log-log plot, you should see a straight line with slope $p$. You can compute some values of $e_h$ for different $h$ using your method. Given two pairs $(h_1, e_{h_1})$ and $(h_2,e_{h_2})$, you can approximate $p$ as follows. Note that $$\frac{\|e_{h_1}\|}{\|e_{h_2}\|} \approx \left(\frac{h_1}{h_2}\right)^p$$ Thus $$p \approx \log\left(\frac{\|e_{h_1}\|}{\|e_{h_2}\|}\right)/\log\left(\frac{h_1}{h_2}\right).$$ |
|||||||||
|
|
The book by Patrick Roach is probably a good reference: Roache, Patrick J. "Verification and validation in computational science and engineering", Hermosa publishers, 1998. |
|||
|
|
|
Isn't it possible to use the root mean square differences between the $u$ values between iterations. The RMS values computed this way should decrease rapidly during the iterations. You could terminate your iterations if the value drops below a threshold. |
|||
|