Any error analysis is based on the Taylor expansions. So, if I take a finite difference scheme, I can calculate the value of the function at any point using the known value at another node via Taylor. However, if I am "at the edge" of the domain, the value of the function is fixed by the boundary condition, so how to deal with that? For example, inside of the domain I can say $$\frac{f(x+h)-f(x-h)}{2h}=f'(x)+Ch^2$$ So my question is how the boundary condition affects the Taylor expansion for the calculation of the local error?
|
As you correctly pointed out, the two point central scheme for FD is second order local, which makes it first order globally. The important point I think you are missing, is that in a FD scheme with specified values at the edges of your spacial mesh, you are always inside the domain. You should never have to approximate a first derivative at the boundary since the value is known. If you aren't evaluating your DE at the boundary, you don't have to worry about your error since there isn't any. Now, if you have second order spacial derivatives, for other types of boundary conditions, things can get more complicated since you have to make sure a biased scheme at the edge is at least as high of order as your interior schemes. EDIT: Looking at your comments on other answers, here is where I think you are being hung up. When you are analyzing a standard interior node, you end with $\frac{f(x+h)-f(x-h)}{2h}=f'(x)+O(h^2)$ so you have 2nd-order local error. You got to this point by using the taylor expansion $f(x+h) = f(x) + f'(x)h + \frac{f''(x)h^2}{2} + H.O.T.$ and a similar expansion for the left hand neighbor. Now imagine you are at a node directly next to the boundary where you have a specified function value. The expansion $g =f(x+h) = f(x) + f'(x)h + \frac{f''(x)h^2}{2} + H.O.T.$ still holds true. Your previous analysis still applies with the added information, because your approximation of the first derivative assumed you could accurately evaluate the function at the left and right neighbors. The fact that you are given $g$ is irrelevant, because you are already acting like you were given $f(x+h)$ and $f(x-h)$. Hopefully this is a bit clearer for you. |
|||||||
|
|
You can use the boundary conditions very easy in your scheme. If you have Dirichlet boundary conditions, which means specifying the values at the boundaries, you just use them instead of $f(x+h)$ or $f(x-h)$. The accuracy of your scheme might degrade only if you have complex formed boundaries (i.e. curvy boundaries in 2D). Then you must use a Shortley-Weller scheme, which is only first order accurate. |
|||||
|