# Solving Advection (Convection) - Diffusion - Reaction Partial Differential Equation in Python

I am looking for library written in Python which will enable me to solve the coupled nonlinear equations which looks like:

I need the library which will enable me to couple this solver to other models. For instance, I would like to impose different boundary conditions and change them in time (at any time step) as well as access to vector of solution at each time step and have possibility to change it (for instance, to implement non-local transport).

Other "wishes":

• fast
• To have possibility of parallel solving.
• and if possible easy to use.

Thank you in advance!

• How many $C_i$s do you have? Are $\varepsilon$, $\omega$, and $D_i$ variables or constants? If variables, do you have their forms or closure equations for them? Is the domain always going to be a cartesian box, or do you have geometry to worry about? Define fast. Oct 13 '14 at 16:28
• I have around 20 to 30 Ci. Epsilon, omega and D are x dependent(means I have equations for them like D(x) =A*exp(x).) I don't have geometry now just 1d or 2d box, but probably in far future I will have. Also I could have any types of boundary conditions (Robyn, Dirichlet, Neumann). Oct 13 '14 at 18:03

I suggest taking a look at FiPy:

http://www.ctcms.nist.gov/fipy/

It uses the finite-volume method, is written in Python, has certainly been used to solve the class of problems you describe, and was designed with flexibility in mind.

The documentation seems relatively good to me and the authors are responsive to requests for help via a mailing list.

• Thanks. It is pretty good. I was thinking about this package but wasn't sure: maybe there is something better. I want to consider as many as possible because I think it will be the core of long lasting development process and it is better to consider all possible variants now and do not migrate later.. Oct 15 '14 at 10:38
• I've played a lot with FiPy and realised that it is a way too slow :( Nov 10 '14 at 1:14
• @IgorMarkelov: Did you figure out what package best suits your problem? I have a similar problem with two coupled PDEs which are modified form of the transport equation that you have.
– user5510
Jul 4 '15 at 1:09
• I've used FiPy. Relatively slow but easy to use. Jul 4 '15 at 19:12
• @IgorMarkelov: Can you post an answer with an example of using FiPy to solve the equation in your question? Also, can you solve the above equation if your variable $D$ is varying with $(x,y)$? Thanks.
– user5510
Jul 19 '15 at 10:02