Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Instability while NDSolving a wave equation

I'm trying to use NDSolve to solve a wave equations to check if it is easier and/or faster to use it instead of my old characteristics eq. method implementation.

I'm getting a lot of instability that I don't get with the characteristics method, and since these are simple equations, I wonder what is wrong... (hopefully, not the physical aspect of the problem...)

ans = Flatten@NDSolve[{
u[t, x]*D[d[t, x], x] + d[t, x]*D[u[t, x], x] + D[d[t, x], t] == 0,
D[d[t, x], x] + u[t, x]/9.8*D[u[t, x], x] + 
 1/9.8*D[u[t, x], t] + 0.0001 u[t, x]*Abs[u[t, x]] == 0,
u[0, x] == 0,
d[0, x] == 3 + x/1000*1,
u[t, 0] == 0,
u[t, 1000] == 0
},
d, {t, 0, 1000}, {x, 0, 1000}, DependentVariables -> {u, d}
]

Animate[Plot[(d /. ans)[t, x], {x, 0, 1000}, 
        PlotRange -> {{0, 1000}, {0, 6}}], {t, 0, 1000}
]

enter image description here

Can someone help me?

EDIT:

I've placed the NDSolve solution (following JxB's editing) with my characteristics solution, together on the same animation. They match close enough, with the exception of the initial quick oscillations. With time they tend do start do desynchronize, but I believe this is probably due to a small simplification we have to admit when deducing the characteristics.

simulation

Red: NDsolve; Blue: "manual" characteristics method;

press F5 (refresh your browser), to restart the animation from t=0.

(xx scale is the number of points I used with my "manual" method, where each point represents 20 units of the NDSolve/physical scale)

Playing with NDSolve grid sampling, renders completely different oscillation effects. Does anyone have or know of a technique to ensure a proper integration?

like image 296
P. Fonseca Avatar asked Sep 08 '11 16:09

P. Fonseca


People also ask

How do you solve wave equation problems?

ρ · utt = k · uxx + kx · ux. When the elasticity k is constant, this reduces to usual two term wave equation utt = c2uxx where the velocity c = √k/ρ varies for changing density.

What is the formula for stability?

RM can be calculated as : RM (Righting moment or moment of statical stability) = (W. GZ) = W. sinθ ( GM + 1/2 BM tan2θ) = 4000 x sin240(0.4 + 1/2 x 3.4 x tan2240 ) = 1200tm.

What is the significance of the problem wave equation?

The wave equation is one of the most important equations in mechanics. It describes not only the movement of strings and wires, but also the movement of fluid surfaces, e.g., water waves. The wave equation is surprisingly simple to derive and not very complicated to solve although it is a second-order PDE.

What is boundary condition in wave equation?

The (Neumann) boundary conditions are ux(0,t) = ux(L, t)=0.


1 Answers

By changing your coefficients to infinite precision (e.g., 1/9.8->10/98), and setting WorkingPrecision->5 (a value of 6 is too high), I no longer get the error message:

ans = Flatten@
  NDSolve[{D[u[t, x] d[t, x], x] + D[d[t, x], t] == 0, 
    D[d[t, x], x] + u[t, x] 10/98*D[u[t, x], x] + 
      10/98*D[u[t, x], t] + 1/10000 u[t, x]*Abs[u[t, x]] == 0, 
    u[0, x] == 0, d[0, x] == 3 + x/1000, u[t, 0] == 0, 
    u[t, 1000] == 0}, d, {t, 0, 1000}, {x, 0, 1000}, 
   DependentVariables -> {u, d}, WorkingPrecision -> 5]

Animate[
 Plot[(d /. ans)[t, x], {x, 0, 1000}, 
  PlotRange -> {{0, 1000}, {0, 6}}], {t, 0, 1000}]

I'm don't know this equation, so I don't believe the solution: small-scale oscillations grow initially, then are damped out.

like image 170
JxB Avatar answered Oct 13 '22 09:10

JxB