在 Mathematica 中求解刚性方程

计算科学
2021-11-30 21:34:51

我有解决僵硬方程的问题。关于如何解决这个问题的任何想法?我试过“StiffSwitching”,但没有用。我使用 Mathematica 10 解决了这个问题。

这是我的代码。如果我写的代码很糟糕,我很抱歉,但我已经按照说明如何从 Mathematica 复制和粘贴代码,这就是我最终的结果。

With[{n = 0.6}, ODE3[L_] := {Derivative[1][H][\[Eta]] == -2*F[\[Eta]] - ((1 - n)/(1 + n))*\[Eta]*Derivative[1][F][\[Eta]], 
        F[\[Eta]]^2 - (G[\[Eta]] + 1)^2 + (H[\[Eta]] + ((1 - n)/(1 + n))*\[Eta]*F[\[Eta]])*Derivative[1][F][\[Eta]] == 
         (Derivative[1][F][\[Eta]]^2 + Derivative[1][G][\[Eta]]^2)^((n - 1)/2)*Derivative[2][F][\[Eta]] + 
          Derivative[1][F][\[Eta]]*((n - 1)*(Derivative[1][F][\[Eta]]^2 + Derivative[1][G][\[Eta]]^2)^((n - 3)/2)*(Derivative[1][F][\[Eta]]*Derivative[2][F][\[Eta]] + 
             Derivative[1][G][\[Eta]]*Derivative[2][G][\[Eta]])), 2*F[\[Eta]]*(G[\[Eta]] + 1) + (H[\[Eta]] + ((1 - n)/(1 + n))*\[Eta]*F[\[Eta]])*Derivative[1][G][\[Eta]] == 
         (Derivative[1][F][\[Eta]]^2 + Derivative[1][G][\[Eta]]^2)^((n - 1)/2)*Derivative[2][G][\[Eta]] + 
          Derivative[1][G][\[Eta]]*((n - 1)*(Derivative[1][F][\[Eta]]^2 + Derivative[1][G][\[Eta]]^2)^((n - 3)/2)*(Derivative[1][F][\[Eta]]*Derivative[2][F][\[Eta]] + 
             Derivative[1][G][\[Eta]]*Derivative[2][G][\[Eta]])), F[0] == 0, G[0] == 0, H[0] == 0, F[L] == 0, G[L] == 0}]


sol4[L_] := Flatten[NDSolve[ODE3[L], {F, G, H}, \[Eta], 
    Method -> {"Shooting", "StartingInitialConditions" -> {G[0] == 0, Derivative[1][G][0] == -0.65, F[0] == 0, Derivative[1][F][0] == 0.55, 
        H[0] == 0}}]]


Plot[Evaluate[{F[\[Eta]], G[\[Eta]], H[\[Eta]]} /. sol4[14]], {\[Eta],
   0, 14}, PlotStyle -> Thick, Frame -> True, 
 FrameLabel -> {"\[Eta]", "F, G, H"}, 
 Epilog -> {Dashed, Thickness[0.005], 
   Line[{{0, 0.8844}, {8, 0.8844}}]}]

我得到了这种类型的错误:

At \[Eta] == 11.976704516552642`, step size is effectively zero; singularity or stiff system suspected. 

这只有在我让 n=1 时才有效。但我必须绘制从 0.6 到 1.4 的不同 n 值。下面是我从 Mathematica 得到的图。

这就是 Mathematica 给我的

如果有人可以帮助我并向我解释,那就太好了。先感谢您!

1个回答

在求解边界值问题时,射击法使用非线性寻根法来寻找满足边界条件的初始条件。要查看这里发生了什么,请将您的 BVP 替换为与您告诉拍摄方法开始的第一个猜测相对应的 IVP。也就是说,更换

F[L] == 0, G[L] == 0

F'[0] == 0.55, G'[0] == -0.65

并绘制 IVP 的结果解。与求解 BVP 不同,Mathematica 实际上会在奇点发生时为您提供直到时间 11.977 的解。你可以在图中清楚地看到函数是如何爆炸的——所以绝对不是刚度导致了这种情况:

在此处输入图像描述

这清楚地表明您的问题是某些(很多?)初始值会导致奇点。所以拍摄方法是不合适的,除非碰巧它尝试的初始值恰好不会导致奇点。

当我尝试将起始初始条件设置为F'[0] == 0.5, G'[0] == -0.7(一些猜测和反复试验)时,它似乎工作正常,给出了一个满足 BCs 的解决方案:

在此处输入图像描述