NDS 求解波动方程时的不稳定性 [英] Instability while NDSolving a wave equation

查看:22
本文介绍了NDS 求解波动方程时的不稳定性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 NDSolve 来求解波动方程,以检查使用它代替我的旧特征方程是否更容易和/或更快.方法实现.

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}
]

有人可以帮我吗?

我已经将 NDSolve 解决方案(在 JxB 的编辑之后)与我的特性解决方案放在同一个动画中.除了最初的快速振荡外,它们匹配得足够近.随着时间的推移,它们往往会开始不同步,但我相信这可能是由于我们在推断特征时必须承认的一个小简化.

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.

红色:NDsolve;蓝色:手动"特性方法;

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

按 F5(刷新浏览器),从 t=0 重新开始动画.

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

(xx 标度是我在手动"方法中使用的点数,其中每个点代表 NDSolve/物理标度的 20 个单位)

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

NDSolve 网格采样,呈现完全不同的振荡效果.有没有人拥有或知道确保正确集成的技术?

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

推荐答案

通过将系数更改为无限精度(例如,1/9.8->10/98),并设置 WorkingPrecision->5(值 6 太高),我不再收到错误消息:

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.

这篇关于NDS 求解波动方程时的不稳定性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆