I've been trying to find an applicable PDE solver for cases such as this:

enter image description here

Although when dealing with stiff equations in the complex domain, applying existing packages has been problematic.

I've looked into FiPy but it doesn't seem to be able to handle complex numbers well. A possible method was to split each function and parameters into 2 vectors denoting its real and imaginary part, although its applicability in dealing with the nonlinear PDE shown appears to complicate matters more. I'm also now looking through the documentation for FEniCS and seeing if it can be helpful (although once again complex variables seem to be problematic). I was also looking into making my own solver using basic methods such as Runge-Kutta but the solutions seem to vary wildly when I change parameters/domains. I have been looking into rezoning/adaptive stretching techniques but I will only be implementing that once I've gotten a basic PDE solver that can handle simple cases first.

Would you happen to have any recommendations for any particular packages or methods? I am currently using Python but am open to any recommendations.

One example of boundary/initial conditions would be: $$N(z,0) = \frac{1}{2} \cos(10^{-5}) \\ P(z,0) = 10^9 \sin(10^{-5}) \\ E(z,0) = 10^{10} \\ N(0,t) = \frac{1}{2} e^{\frac{-t}{10^6}} \\ P(0,t) = 10^9 e^{\frac{-t}{10^6}} \\ E(0,t) = 10^{10} e^{\frac{-t}{10^6}} \\ \\$$

(My apologies for the quite high values. This is after a rescaling to make the values closer in range, but they still are quite large. I will be working on modifying this so any suggestions with your own scalings are more than welcome.)

  • 1
    $\begingroup$ Can you provide more information on these equations, e.g. boundary and initial conditions for the dependent variables? $\endgroup$ Jun 12, 2016 at 13:47
  • 1
    $\begingroup$ A tip: You can use MathJax to typeset mathematical formulas. $\endgroup$ Jun 12, 2016 at 16:05
  • $\begingroup$ Thank you for the link. I didn't realize it was supported here. $\endgroup$
    – Mathews24
    Jun 13, 2016 at 15:18
  • $\begingroup$ Please edit the question to include the equations and BCs, rather than putting them in a comment. $\endgroup$ Jun 13, 2016 at 15:45
  • $\begingroup$ Done. The conditions are in the main post. $\endgroup$
    – Mathews24
    Jun 13, 2016 at 15:47

1 Answer 1


The approach of using two equations for the real and imaginary parts of an equation is often used. It may lead to more cumbersome formulas, but it is definitely possible and common. An example where this is done in deal.II (a library that I maintain) is here: https://www.dealii.org/developer/doxygen/deal.II/step_29.html


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.