|
|
Invisible <voi### [at] devnull> wrote:
> So apparently the wave equation tells us that the 2nd derivative of some
> physical quanitity "u" with respect to time is equal to the square of
> the wave propogation constant multiplied by the Laplacian of "u".
>
> ...which would probably mean something if I could figure out what a
> Laplacian is! :-S
>
> According to Wikipedia, the Laplacian of u is the sum of all partial 2nd
> derivatives of u with respect to every coordinate axis.
>
> ...so...the total curvature then? ._.
In a realistic setting, this could be pressure and velocity, in which case they
usually just differ by a phase of 90 degrees, if I recall correctly.
Or, think of it as a string under tension. If it has a positive second
derivative, then it is curved upward and that part of the string will tend to
accelerate upward. According to Newton's 2nd law, F=ma, so if the curvature
acts as a force, then it is proportional to the acceleration, a=d^2(u)/dt^2.
Using the constant c^2, which happens to end up as the wave speed, this gives
the 1-D wave equation:
d^2(u)/dt = c^2 * d^2(u)/dx^2.
For two dimensions, you just have curvature acting in two directions, so you add
them up and
d^2(u)/dt^2 = c^2 * ( d^2(u)/dx^2 + d^2(u)/dy^2 ) = c^2 * Laplacian(u)
To solve this, remember that the second derivative can be written discretely as
d^2(f)/dx^2 = ( f(i+1) - 2*f(i) + f(i-1) ) / ( dx^2 )
where f(i+1) and f(i-1) are the neighboring grid points and dx is the grid
spacing. Applying this to the time and space derivatives across a
two-dimensional grid, (assuming dx=dy),
( u(n+1) - 2*u(n) + u(n-1) ) / dt^2 = c^2 * ( u(i+1,j) + u(i-1,j) + u(i,j+1) +
u(i,j-1) - 4*u(i,j) ) / dx^2
Assuming you know the previous two time steps and that the right-hand side is
evaluated at time level n, just solve for u(n+1):
u(n+1) = 2*u(n) - u(n-1) + (c*dt/dx)^2 * ( u(i+1,j) + u(i-1,j) + u(i,j+1) +
u(i,j-1) - 4*u(i,j) )
So to solve the equation, make three grids. Set grids (n-1) and (n) to zero.
Solve for (n+1). Then transfer (n)->(n-1) and (n+1)->n. Now you're back where
you started so just repeat over and over. This should be stable as long as
(c*dt/dx) < 1. This is called the CFL number and ensures that waves don't
travel across more than one cell per time step.
To make it interesting, just say instead that
d^2(u)/dt^2 - c^2*Laplacian(u) = f(x,y,t)
where f(x,y,t) is just any old forcing function that can depend on space and
time and makes it actually move.
Sorry. That got a little long. Hope it's remotely useful...
- Ricky
Post a reply to this message
|
|