# Applying the method of lines to parabolic PDEs: references and software

Could you please advise some literature about the numerical method of lines (MOL) for parabolic PDEs? It is a method of solving PDEs with discretizing only by space but not by time. A system of ODEs is obtained and it can be solved with, for example, Runge-Kutta method.

Do you know some solvers (programs, libraries) for applying the method of lines? Is this method applicable to multi-dimensional (2D, 3D) problems?

• Can you be more specific? Oct 17, 2014 at 6:47

A nice reference for this is Chapter 10 of LeVeque's finite difference book. Of course, it only covers basic finite difference approaches, and there are plenty of others (all within the method of lines framework). The method of lines is indeed applicable in multiple dimensions, and two-dimensional problems are discussed in the reference just given.

Most of the methods and libraries that exist are based on the method of lines, so if you want meaningful recommendations you'll need to ask a more specific question.

• Thank you. Do there exist libraries for solving PDEs (1D, 2D, 3D) with the method of lines? Or it is recommended to use only ODE solvers and construct the ODE system manually? What sparse ODE solvers can I use? Oct 20, 2014 at 11:39
• Yes, and there are so many such libraries that it would be pointless to try to list them all here. Please ask a new, more specific question. Comments are really a poor place to ask big questions. Oct 20, 2014 at 12:22

This is a fairly big question. The basic idea is that in solving $\partial_t u = \mathcal{L}u$, you approximate $\mathcal{L}$ with a matrix $A$, and solve $$u' = Au.$$ In this formulation you have two main issues:

• What method to use to solve the ODE. The method has to be implicit because of the nature of parabolic PDEs, and the stiff systems of ODEs that they produce.
• How to solve the systems of linear equations $A^{-1}x$ that appear in the ODE solver. Here $A$ is sparse.

These issues are not at all unique to the method of lines, or to parabolic equations. Books like "Solving ordinary differential equations" by Hairer and Wanner will cover this; "Finite difference methods" by LeVeque; there's an unfinished textbook available for free online here by Trefethen; other PDE textbooks cover this as well.

Note that just an explicit Runge-Kutta method to unlikely to work directly: the system of ODEs is typically stiff, sparse, and very large.

The question of how to solve the resulting systems of linear equations, roughly, can be addressed in different ways. If you can solve $A^{-1}x$ directly and efficiently, there is no problem. There are (diverse!) iterative methods, which work well if you can find a good preconditioner for the matrix. There are also different splitting methods, where you can write $A=A_1+A_2+\cdots$, and define a numerical solution to the ODE that depends only on solutions of systems $A_k^{-1}x$. You can pick $A_k$ to be convenient to solve, such as the individual parts of the differential operator going along individual dimensions. Alternating direction implicit methods are an example of this approach.

For software, most PDE packages do something like this, something like CVODE (in SUNDIALS) might be appropriate.

EDIT For nonlinear systems, the procedure is roughly the same, only instead of needing to solve systems like $A^{-1}x$ you need to solve systems of nonlinear equations with a Newton-like method, where the solution of $J^{-1}x$ with the Jacobian matrix needs to be efficient; again the Jacobian is likely to be sparse and very large. In this context, CVODE looks appropriate.

EDIT As David Ketcheson correctly points out, my answer assumes many things that are not explicitly specified in the question, which would make this answer quite misleading if those assumptions don't hold.

• Thank you. What if an equation is nonlinear? That's why I'd like to use the method of lines instead of finite differences. Oct 17, 2014 at 6:49
• @jokersobak This is why you need to be specific! I assumed it was a linear equation. I edited my answer. Oct 17, 2014 at 6:54
• @Kirill This is overall a reasonable answer, but you are assuming things that are not in the question -- linearity, sparsity of the jacobian, etc. Your answer could be misleading to the uninformed. Oct 17, 2014 at 8:32
• @DavidKetcheson Okay, but how else would one answer such a vague and broad question? If the poster really doesn't know much about these methods, they are likely to start learning where everyone else usually starts learning about these methods, with linear equations, especially the heat equation. Besides, a lot of the really basic things one learns about linear equations carry over to nonlinear equations as well. I think it's more helpful to understand, in detail, the simple cases first. Oct 17, 2014 at 19:17
• @jokersobak Stackexchange is terrible place for long-winded discussion-type questions. Can you ask a clear and precise question? Oct 18, 2014 at 19:58

I don't have enough reputation to comment, but I hope this answer helps you. Personally, I find that I learn best through example. Try looking at the code here to see how MOL was implemented in Python with centered finite difference approximation (an ODE solver was used).

If you'd like to learn more about solving ODEs, parabolic PDEs, and MOL, I suggest Heath's Scientific Computation (Chapter 11) which also provides some examples on solving MOL. Good luck!