I am trying to solve a set of linear PDEs of the form $$F\left(\vec{y},\frac{\partial \vec{y}}{\partial x},\frac{\partial^2 \vec{y}}{\partial x^2},\frac{\partial \vec{y}}{\partial t}\right)=0.$$ To solve it I am using the method of lines where I discretize in $x$ to get a set of differential-algebraic equations (DAEs) which I solve using the IDA solver shown in this tutorial. It seems to be working okay, however, it is highly numerically unstable. I find that if I set atol=rtol=1e-1then the code works okay. If I reduce the error tolerance anymore the solution blows up to infinity. Do you know how I can increase stability? I am very new to solving DAEs so any advice is appreciated.


The equations are given, here: $$\frac{\partial u}{\partial t} = -\left[i\omega b + ik_\perp v - \sin\alpha\frac{\partial v}{\partial x}\right],$$ $$\frac{\partial b}{\partial t} = -\frac{i}{\omega}\left[\cos^2\alpha\frac{\partial^2 u}{\partial x^2}+\frac{\omega^2u}{v_A^2(x,t)}\right],$$ $$\cos^2\alpha\frac{\partial^2 v}{\partial x^2}+\frac{\omega^2v}{v_A^2(x,t)}=i\omega\left[ik_\perp b - \sin\alpha\frac{\partial b}{\partial x}\right],$$ where $$\vec{y}(x,t)=\begin{pmatrix} u(x,t) \\ b(x,t) \\ v(x,t) \end{pmatrix}.$$

  • $\begingroup$ Is your DAE index-1? Is the initial condition consistent with the algebraic constraints? $\endgroup$ Aug 5, 2020 at 13:20
  • $\begingroup$ I have edited the original post to include the equations I am solving. I am new to DAEs, these equations seem too complicated to calculate the index? $\endgroup$
    – Peanutlex
    Aug 5, 2020 at 13:33
  • 1
    $\begingroup$ Looks like using solvers from the SUNDIALS package for an ideal MHD problem. However some time derivatives have become $i \omega$ and some have not - is this correct? Can the third equation be cast in a time-evolution form, like the first two? $\endgroup$ Aug 5, 2020 at 21:35
  • $\begingroup$ Yes, this does come from an MHD problem. Here $t$ does not represent time, it actually represents a spatial coordinate. I used $t$ for this post to make it clear which variable I am integrating in and which variable I am discretizing in. Traditionally, $t$ is the coordinate which is integrated over with the method of lines. $\endgroup$
    – Peanutlex
    Aug 6, 2020 at 10:36


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.