Numerical boundary conditions for wide approximation finite difference

AI Thread Summary
The discussion revolves around implementing numerical boundary conditions for a fourth-order finite difference stencil used to solve a differential equation. The user has a specific stencil for the second derivative but is uncertain about how to handle the boundary conditions for U-1 and UN+1. While Dirichlet boundary conditions are clear, the user seeks guidance on numerical boundary conditions since they do not have Neumann conditions. A suggestion is made to create unsymmetrical fourth-order approximations for the second derivative at the boundaries, which would eliminate the need for U-1 and UN+1. However, the user is instructed to include these points. The response emphasizes that the numerical solution should satisfy the differential equation at the boundary points, recommending finite difference approximations for the derivatives at U-0 and UN, which would provide the necessary equations to solve for all boundary values.
amalak
Messages
6
Reaction score
0
Hi,

I have to use a wide 5 point stencil to solve a problem to fourth order accuracy. In particular, the one I'm using is:

u'' = -f(x + 2h) + 16f(x + h) - 30f(x) + 16f(x - h) - f(x - 2h) / 12h2

or when discretized

u'' = -Uj-2 + 16Uj-1 -30Uj + 16Uj+1 -Uj+2 / 12h2

In addition to dirichlet boundary conditions (which are not troubling me to implement), I have to implement numerical boundary conditions for

U-1 and UN+1

The problem I'm encountering is I'm not sure what to try for these numerical boundary conditions (as in, I haven't a clue as to what may work). I have the scheme set up without those conditions, but that's not what I want. The only time I know U-1 and UN+1 come up are with Neumann boundary conditions, which I don't have.

Any help or pointers would be immensely appreciated, thank you.
 
Physics news on Phys.org
Thank you very much for your response. That method seems to make more sense, I think, but I've been instructed to use U-1 and UN+1, but thank you again.
 
OK, so they probably want your numerical solution satisfy the differential equation at the boundary points ##u_0## and ##u_N##, not just to satisfy the Dirichlet boundary conditions at the boundary points.

So, make finite difference approximations for the derivatives at ##u_0## using ##u_{-1}, u_0,. u_1, \dots## and plug them into the differential equation, and similarly at ##u_N##. That will give you two more equations, so you have enough equations to solve for ##u_{-1}, u_0,\dots, u_N, u_{N+1}##.
 
Back
Top