1D wave equation - bizarre problem

  • Context: Graduate 
  • Thread starter Thread starter smolloy
  • Start date Start date
  • Tags Tags
    1d Wave Wave equation
Click For Summary
SUMMARY

The discussion centers on a solver for the 1D wave equation implemented in Python, specifically addressing an issue where the wave does not return to zero after an initial disturbance. The equation used is phi(i,j+1) = deltat2/deltax2 * [phi(i+1,j) - 2phi(i,j) + phi(i-1,j)] + 2phi(i,j) - phi(i,j-1), with fixed boundary conditions at both ends. The user initially employed a Dirac delta function as an initial condition, which led to unexpected behavior, but later confirmed the solver's correctness with sinusoidal initial conditions, resulting in a standing wave.

PREREQUISITES
  • Understanding of the 1D wave equation and its physical implications.
  • Familiarity with numerical methods for solving partial differential equations.
  • Proficiency in Python programming for implementing numerical solvers.
  • Knowledge of boundary and initial conditions in wave mechanics.
NEXT STEPS
  • Explore the implementation of the 1D wave equation using finite difference methods in Python.
  • Investigate the effects of different initial conditions on wave behavior.
  • Learn about stability criteria for numerical solutions of wave equations.
  • Examine the extension of the wave equation to two spatial dimensions and its implications.
USEFUL FOR

Researchers, physicists, and software developers interested in computational physics, particularly those working on wave propagation simulations and numerical methods for differential equations.

smolloy
Messages
10
Reaction score
0
1D wave equation -- bizarre problem!

I am trying to write a solver for a 1D wave equation in python, and I have run into a bizarre problem that I just can't find a way out of.

I start with the wave equation, and then discretise it, to arrive at the following,

phi(i,j+1) = deltat2/deltax2 * [phi(i+1,j) - 2phi(i,j) + phi(i-1,j)] + 2phi(i,j) - phi(i,j-1)

I'm pretty sure this is correct.

I set boundary conditions such that the string is fixed at both ends (i.e. phi(0,t) = phi(L,t) = 0). As initial conditions I use phi(x,0)=0, and phi(x,deltat) = dirac_delta (i.e. all zeros, except for a spike in the middle).

With deltat and deltax set such that the solver should be stable, I then run my code.

The problem is that the central point (the point at which I place the Dirac delta) moves upwards (as it should), before slowing down (as it should), stopping (as it should), and then remains there indefinitely (as it most definitely should *not*!).

Thinking a little bit more about the structure of the wave equation, this kinda makes sense. It is an equality between the net force due to the spring-constant tension on the curved string, and the F=ma like momentum of the string. Thus, a negative curvature should accelerate downwards, thus generating a positive curvature, which accelerates upwards.

In other words, the string never comes back to zero until the reflections drag it that way!

This, surely, isn't the way the string should behave -- surely it should break down into two separate waves moving in opposite directions, with the initial disturbance moving back to zero.

What have I done wrong, and where should I go from here?? :D

PS: Thanks for your attention to this long rambling post!
 
Physics news on Phys.org


I suspect your intuition is more at fault than you numerics. Consider the function f=1 for positive x, -1 for negative x. Then the sum of a left moving copy of f (or a close smooth approximation) and a right moving copy of -f will give the behavior you describe.
 


Thanks for your reply.

I think the problem is that I didn't really use the right initial conditions. When I tested the code with a sinusoidal initial condition, I got a standing wave as the result -- which means that the code is correct.

Then, when I expanded it to two spatial dimensions, I got something that looked much more as I imagined.

Thanks for your time.
 

Similar threads

  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 19 ·
Replies
19
Views
4K
  • · Replies 0 ·
Replies
0
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 3 ·
Replies
3
Views
5K