# Convection diffusion reaction equation (stiffness, solver)

I am trying to solve the CDR-Equation in 2D:

$$\frac{\partial c(x,y)}{\partial t} + \nabla \cdot ( -d\nabla c(x,y) + \vec{v}(x,y) c(x,y))+ a c(x,y)=0\,,$$ with Boundary Conditions (length of square is $L$): $$c(0,y)=0$$ $$-d\nabla c(L,y) + v(L,y) (c(L,y))=0\,.$$. $$c(x,y=0)=0$$ $$c(x,y=L)=0$$

1.) Why exactly is this equation stiff? Does it depend on the reaction term $ac(x,y)$?

2.) Can I solve the equation with the Crank-Nicholson method? Is the error huge? If yes, what is the best method?

• Please correct the second boundary condition and add some boundary condition on the other two sides of the square domain. Crank-Nicolson with a correct treatment of reaction term and advection term (the last one maybe with an upwind method) shall give an accurate scheme. For too large time steps you can have some unphysical oscillations in numerical solution, but if you would like to have an accurate numerical solution, you should avoid such large time steps. Jan 11 '16 at 20:03
• Stiffness is generally regarded as a property of the ODEs you get by semi-discretizing, not of the PDEs. Do you have a semi-discretization in mind? Jan 12 '16 at 6:36
• I am asking for stiffness, because the CDR equation is often given as an example for a stiff equations. And there are multiple papers discussing different solvers because of the difficulties in handling it. Jan 12 '16 at 13:01

1. Mathematically speaking, stiffness is meaningless for a single differential equation, and is rather attributed to a set of differential equations that have different time-scales (e.g. when trying to solve two coupled equations with time-scales of 1 second and 1 day, respectively). However, a single equation can also be referred to as stiff if certain numerical integration methods are numerically unstable. Source/sink terms can give rise to stiffness, for instance: $$\frac{dy}{dt}=-1000y$$ is a good example where sink term has given rise to stiffness. That being said, $ac(x,y)$ might be causing the stiffness in your PDE.

2. Theoretically, you can solve any time-dependent PDE with Crank-Nicolson method. However, you should use adaptive time-steps when solving a stiff equation, otherwise the computational cost is huge. The naive Crank-Nicolson formulation is based on fixed time-step, however, you can derive your customized version with adaptive time-step. But, I do not recommend as it is cumbersome. Your best alternative, in my opinion, is to use method of lines. You can find useful information about this method here. To give you a rough idea, in the method of lines, you discretize your PDE with respect to spatial variables (and not time). This eventually gives you a set of first order ODEs (ordinary differential equation) with respect to time. Now you can simply use a stiff ODE solver (e.g. Adam's Bashforth method) to integrate the set of ODEs.

• This answer is, in my opinion, somewhat misleading. For a better explanation of stiffness, see e.g. this answer. Jan 13 '16 at 6:18
• I am not quite following you. What part exactly you don't agree? @DavidKetcheson Feb 23 '16 at 2:40
• Your example is not stiff, by the most accepted modern definitions. You probably disagree, and I'm not going to argue with you here in the comments; please just read up on stiffness. Here is a good reference. Feb 23 '16 at 3:41
• Thank you for the reference. I'll definitely look into that for more in-depth discussion. However, for the record have a look here (under "Motivating example"): en.wikipedia.org/wiki/Stiff_equation @DavidKetcheson Feb 24 '16 at 15:26
• Yep, Wikipedia gets it wrong too. Feb 24 '16 at 18:06