Finite difference and Runge-Kutta for PDEs

In summary, the problem was that the wavepacket was oscillating on the smallest wavelengths and eventually blowing up. Reducing the time step may have prevented this.
  • #1
EmpaDoc
28
1
I made a small program to simulate the time development of a 1D wavepacket obeying the Schrodinger equation, mostly in order to learn a new programming language - so in order to not have to invoke big numerical methods packages, I opted for the simplest solution: The standard three-point finite-difference discretization for the Laplacian (kinetic term), and the 4-order Runge-Kutta method to propagate the wavepacket forward.

I notice that sooner or later, my wavepacket will start to develop oscillations on the smallest wavelengths, followed by a blowup. If I include a step potential to reflect against, this happens once the wavepacket encounters the potential. Otherwise it seems to happen when the wavepacket scatters against itself across the periodic boundary (as it expands).

Changing my three-point finite-difference to a five-point stencil only makes the problem worse.

I know that there are much better methods for PDE solving (e.g. Crank-Nicolson). But that's not really the point here. Now I am curious: What is the cause of this behavior? And-can I tweak the FD+RK so I can get it to work?
 
  • Like
Likes Milan Bok
Technology news on Phys.org
  • #2
The first thing I would try is reducing your time step (e.g. halve it). Possibly (by happenstance) your time step is close to the limit for stability, so it appears to be working OK until the instability has grown from 10^-6 or (10^-16) to be bigger than the true solution.

Using a solution scheme that has a higher order of accuracy than the order of the differential equation almost always results in conditional stability. That's why a 4th order method like RK is rarely "better" than a well-chosen lower order method like Crank Nicholson - there are very few 4th order differential equations in physics!
 
  • #3
Forget it! I just hadn't debugged the program properly...
Sorry. :(
At least I know now that FD+RK4 works fine with the Schrodinger equation.
 
  • #4
Can you explain what was the problem in your code ? I am also trying such a way but norm of wave function isn't constant and differs from analytical solution (Im trying to propagate free gaussian wave packet).
 
  • #5


Thank you for sharing your experience with using finite difference and Runge-Kutta methods for solving PDEs. It is commendable that you took the initiative to learn a new programming language and explore these numerical methods on your own.

The behavior you are observing, where the wavepacket develops oscillations and eventually blows up, is a common issue when using finite difference and Runge-Kutta methods for solving PDEs. This is known as numerical instability and can be caused by a variety of factors.

One possible cause is the choice of grid spacing in your finite difference discretization. If the grid spacing is too large, it can lead to inaccurate solutions and numerical instability. You can try decreasing the grid spacing to see if it improves the stability of your simulation.

Another factor to consider is the time step used in the Runge-Kutta method. If the time step is too large, it can also lead to numerical instability. You can experiment with different time steps to see if it helps improve the stability of your simulation.

Additionally, the boundary conditions you are using can also play a role in the stability of your simulation. If the boundary conditions are not properly handled, it can lead to numerical instability. You can review and adjust your boundary conditions to see if it helps improve the stability of your simulation.

It is important to note that while finite difference and Runge-Kutta methods are simple to implement, they may not always be the most efficient or accurate methods for solving PDEs. As you mentioned, there are other methods such as Crank-Nicolson that may be more suitable for your problem. It would be beneficial to explore and compare different methods to find the most appropriate one for your specific PDE.

In summary, the cause of the behavior you are observing is likely due to numerical instability, and you can try adjusting the grid spacing, time step, and boundary conditions to improve the stability of your simulation. However, it is also important to consider other methods that may better suit your problem. Overall, your curiosity and willingness to experiment with different methods is commendable and will ultimately help you gain a deeper understanding of PDEs and numerical methods.
 

1. What is the difference between finite difference and Runge-Kutta methods for solving PDEs?

Finite difference is a numerical method that approximates derivatives in a PDE by using discrete points, while Runge-Kutta is a numerical method that solves the PDE by breaking it down into a series of smaller, simpler equations.

2. Which method is more accurate for solving PDEs, finite difference or Runge-Kutta?

It depends on the specific PDE being solved and the level of precision required. Finite difference is generally more accurate for simpler PDEs, while Runge-Kutta tends to be more accurate for more complex PDEs.

3. Can finite difference and Runge-Kutta methods be used for any type of PDE?

Yes, both methods can be used to solve a wide range of PDEs, including linear and nonlinear equations. However, some PDEs may require modifications or specialized techniques for accurate solutions.

4. What are the main advantages of using finite difference and Runge-Kutta methods for solving PDEs?

Finite difference and Runge-Kutta methods are both computationally efficient and easy to implement. They also allow for the handling of complex boundary conditions and can handle problems with irregular geometries.

5. Are there any limitations to using finite difference and Runge-Kutta methods for solving PDEs?

One limitation is that these methods may struggle with PDEs that have highly oscillatory solutions or steep gradients. In these cases, specialized techniques may be needed for accurate solutions. Additionally, the accuracy of these methods can be affected by the choice of grid size and time step.

Similar threads

  • Programming and Computer Science
Replies
15
Views
2K
Replies
38
Views
423
  • Differential Equations
Replies
6
Views
2K
  • Programming and Computer Science
Replies
4
Views
6K
  • Differential Equations
Replies
12
Views
4K
  • Programming and Computer Science
Replies
5
Views
2K
  • Calculus and Beyond Homework Help
Replies
14
Views
2K
  • Programming and Computer Science
Replies
1
Views
2K
  • Programming and Computer Science
Replies
10
Views
12K
Replies
8
Views
13K
Back
Top