1+1 Radial wave equation- numerical. BC near origin

AI Thread Summary
The discussion revolves around solving the 1+1 radial wave equation using finite difference methods, specifically focusing on boundary conditions and convergence issues. The user has shifted their grid to avoid having the origin at a grid point and applied advection boundary conditions to minimize reflections. They encounter difficulties with boundary conditions near r=0, particularly when using a five-point stencil for spatial derivatives, leading to unexpected results where the solution remains positive despite the potential for negative values.The user also mentions splitting the wave equation into two first-order equations and employing the method of lines with a fourth-order Runge-Kutta time integrator. However, they observe that their code exhibits only first-order accuracy when comparing results to an analytical solution, which is contrary to expectations given their numerical methods. The user suspects that the issue may stem from the boundary conditions, particularly at one end where they used a simple scheme for spatial derivatives. They seek guidance on potential errors in their implementation that could be affecting convergence and accuracy.
irycio
Messages
96
Reaction score
1

Homework Statement


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!
 
Technology news on Phys.org
Wrong order of convergence while using method of lines

Hi!
Still fighting with radial wave equation :/. I've split it into 2 first order equations in time and am using method of lines to integrate it with RK4 as my time integrator, which is O(h^4). My spatial derivatives are are approximated using 3 point stencil (2nd derivative, O(h^2)) and 2 point centered scheme (1st derivative, present in radial wave eq., O(h^2) as well)). Now, I was comparing my results with analytical solution to check the convergence and eventually it seems that my code is only of a first order accuracy :( - half the step size, double the accuracy. Now, the only place I'm using the method of firs order is the absorbing boundary condition at one of the ends. I used the advection equation there and to avoid complications I used the simplest scheme to approximate a spatial derivative there. However, I start with a gaussian wave packet far from that boundary, so at least at the beginning it shouldn't make any difference.

The question hence is - what can I be doing wrong??
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
Thread 'Project Documentation'
Trying to package up a small bank account manager project that I have been tempering on for a while. One that is certainly worth something to me. Although I have created methods to whip up quick documents with all fields and properties. I would like something better to reference in order to express the mechanical functions. It is unclear to me about any standardized format for code documentation that exists. I have tried object orientated diagrams with shapes to try and express the...

Similar threads

Back
Top