Message Boards Message Boards

Solve wave equation in a definite amount of time?

Posted 8 years ago

Hi I'm trying to solve the wave equation (with initial and boundary conditions) with Mathematica, but once I hit evaluate notebook, it never stops running. The code is as follows:

ClearAll["Global`*"];
Clear[Derivative];
v = 1;
L = 10;
lambda = 2*L;
c = 3*10^8;
omega = 2*Pi*c/lambda;
tmax = 30*L/v;

Solution = 
 NDSolve[{v^2*D[u[x, t], x, x] - D[u[x, t], t, t] == 0, 
   u[x, 0] == 0, (D[u[x, t], t] /. t -> 0) == 
    0, (D[u[x, t], x] /. x -> 0) == 
    Tanh[t]*Sin[omega*t], (D[u[x, t], x] /. x -> L) == 0}, 
  u, {x, 0, L}, {t, 0, tmax}]

Any suggestions?

POSTED BY: Hao-Jan Shue
Posted 8 years ago

The problem appears to be related to the speed of light.

If you slow light down to c=3 or c=30 or c=300 it finishes quickly. For c=3000 it takes much longer, but does finish. For larger values of c I suspect this exponential trend continues.

Could you possibly scale your problem in a way to evade this?

POSTED BY: Bill Simpson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract