# How to define fluxes for two dimensional convection-diffusion equation?

I want to solve the following differential equation using control volume approach on a Cartesian mesh: $$\frac{\partial T}{\partial t} + \frac{\partial T}{\partial x} + \frac{\partial T}{\partial y}= \lambda[\frac{\partial^2 T}{\partial x^2} + \frac{\partial^2 T}{\partial y^2}]$$

Probably, there would be no harm in writing it as ($\lambda$ being contant): $$\frac{\partial T}{\partial t} + \frac{\partial [T - \lambda\frac{\partial T}{\partial x}]}{\partial x} + \frac{\partial [T - \lambda\frac{\partial T}{\partial x}]}{\partial y}= 0$$ For a moment if I define $$F = T - \lambda\frac{\partial T}{\partial x}$$ $$G = T - \lambda\frac{\partial T}{\partial y}$$

Now if I have a control volume around the point (i, j) Can I write the flux F on the right edge i.e. i+$\frac{1}{2}$ as: $$F_{i+\frac{1}{2}, j}^n = \frac{T_{i,j}^n + T_{i+1,j}}{2}^n - \lambda\frac{T_{i+1,j}^n - T_{i,j}^n}{dx}$$

Using this for all other fluxes, I am writing my discretized equation as (In fact, I want a final form of discretized equation to be like this): $$T_{i,j}^{n+1} = T_{i,j}^{n} - \frac{dt}{dx}[{F^n_{i+\frac{1}{2},j} - F^n_{i-\frac{1}{2},j}}] - \frac{dt}{dy}[{G^n_{i,j+\frac{1}{2}} - G^n_{i,j-\frac{1}{2}}}]$$ Is this definition correct or there could be some problems with this? I am not very familiar with the finite volume discretization of such hyperbolic PDEs. Is this method stable and accurate enough? I further want to use mesh refinement schemes.

• I am sorry. I will take care of this from now on. Apparently I could not find the later one at the time of asking question. Sep 10 '15 at 12:46

Edited after some corrections in the question:

One has to decide at which time level you evaluate the fluxes, i. e. to add also the index $n$ or $n+1$ to the values of $T, F, G$. The scheme is then explicit (in time) or implicit (in time). You took the explicit one. After your corrections the scheme looks like standard Finite Volume Method, see e. g. the book of LeVeque on "FVM for hyperbolic problems". By the way for positive lambda your equation is parabolic.

The scheme is stable in general depending on the time discretization, on how large is $\lambda$ or how fine is your mesh. You may use an upwind scheme for the convective part of your fluxes to improve the stability.

The explicit scheme to be stable you have the restriction on the time step $\delta t$ that must be proportional to $dx^2/\lambda$ or $dy^2/\lambda$ (which one is smaller). If you would choose the implicit scheme with the first order accurate upwind you have no stability restriction on $\delta t$, but you have to solve a system of linear equations with tridiagonal matrix.

• Frolkovic: Thanks for the answer. I made some edits based on your suggestion. As you can see, I am using explicit scheme. My lambda is positive. But can I ask a silly question here? How do we define a pde in three independent variables (x, y, t) to be hyperbolic or elliptic or parabolic? Also, as you said that I can use upwind scheme for convective part, so that means I can use $T_{i,j}^n$ instead of that average value at cell boundary i.e. $\frac{(T_{i,j}^n + T_{i+1,j}^n)}{2}$? Because in this case, I have assumed U = V = 1 Sep 9 '15 at 1:21
• 1. To check the type of PDE in general, see some lecture books or wikipedia (en.wikipedia.org/wiki/Partial_differential_equation), your equation is parabolic if $\lambda >0$ and hyperbolic if $\lambda=0$. 2.) Yes, you can use the upwind as you wrote. Comparing to the previous central scheme which is second order accurate, the suggested upwind scheme is only first order accurate. Sep 9 '15 at 13:33
• Frolkovic: Sir, for this PDE with λ>0. Should not it be elliptic? Because A=C=λ and B is zero? Sep 9 '15 at 13:40
• No, if you have look to wikipedia then you must consider there $y$ as $t$ (so it is only one-dimensional in space) and then $B=C=0$. Sep 9 '15 at 13:48
• Your last comment is correct. Sep 9 '15 at 14:08