1. The problem statement, all variables and given/known data
Well, I'm not sure if this is a correct subforum to post my problem, but to me it does seem to me as an academic problem. One I can not solve, apparently.
Well, anyway. I'm solving the 1+1 radial wave equation using finite difference. I shifted my grid, so that the origin (r=0) is not one of it's points. I also applied advection boundary condition to prevent reflections.
Now, the problem I have left are the boundary conditions near r=0. Since I'm using five point stencil to approximate spatial derivative, I need to apply them to 2 first points.
I assumed, that since my initial conditions (f(r,t=0)=10.0*exp(-100* r^2)) are symmetric (actually I'm trying to receive an analytic solution f(r,t)=(r-t)/r * 10.0*exp(-100* (r-t)^2), so the initial time derivative is appropriate), so should be the solution (otherwise it would depend on the angles, and I don't want it to).
Hence whenever my five point stencil calls for a non-existent point, I replace it with it's mirror, that lies within my grid.
And so unfortunately that doesn't work as expected. All in all, the "real" solution can be <0 for a given r and t, whereas my solution remains >0 (well, actually at some points the value is equal to, say -0,008, but then around it there are points with value of, say, 0,005, so that it's I believe just some random noise).
Since I checked my code couple of times, checked the initial conditions, I believe the problem lies within the BCs. And so, any help will be much appreciated!