Note that there are some explanatory texts on larger screens.

plurals
  1. POInstability while NDSolving a wave equation
    primarykey
    data
    text
    <p>I'm trying to use <code>NDSolve</code> 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.</p> <p>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...)</p> <pre><code>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 -&gt; {u, d} ] Animate[Plot[(d /. ans)[t, x], {x, 0, 1000}, PlotRange -&gt; {{0, 1000}, {0, 6}}], {t, 0, 1000} ] </code></pre> <p><img src="https://i.stack.imgur.com/kz2YV.png" alt="enter image description here"></p> <p>Can someone help me?</p> <p><strong>EDIT:</strong></p> <p>I've placed the <code>NDSolve</code> 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.</p> <p><img src="https://i.stack.imgur.com/a40W4.gif" alt="simulation"></p> <p>Red: <code>NDsolve</code>; Blue: "manual" characteristics method;</p> <p>press F5 (refresh your browser), to restart the animation from <code>t=0</code>.</p> <p>(xx scale is the number of points I used with my "manual" method, where each point represents 20 units of the <code>NDSolve</code>/physical scale)</p> <p>Playing with <code>NDSolve</code> grid sampling, renders completely different oscillation effects. Does anyone have or know of a technique to ensure a proper integration?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload