Objective: I am trying to simulate the following advection-diffusion-reaction equation in 2D space (x,y) and time. $$\begin{align}\text{ADR Equation: }\frac{\partial C}{\partial t} + \nabla\left(v.C - D\nabla{C} \right)=  \alpha.C\end{align}$$I discretized the above ADR equation in 2D using finite-difference implicit scheme and as a result I get the following discretized equation. $$\begin{align}p_1C^{n+1}_{i,j-1}+p_2C^{n+1}_{i-1,j}+p_3C^{n+1}_{i,j}+p_4C^{n+1}_{i+1,j}+p_5C^{n+1}_{i,j+1} = C^{n}_{i,j}\end{align}$$where, $p_1, p_2, p_3, p_4, p_5$ are constants in time.I want to solve this as a system of equations using $A^{n+1}.C^{n+1}=C^{n}$, with no-flow i.e. $C=0$ outside the boundary domain. Here, $A^{n+1}$ would be a penta-diagonal, symmetric (not sure about this) and a diagonally dominant matrix. I have derived matrix $A$ for $2\times2$, $3\times3$ and $4\times4$ systems. For example, below you can see matrix $A$ for $3\times3$ and $4\times4$ systems, respectively. Issue: I am not sure if the form of matrix $A$ I have derived is correct because as per my understanding it should be symmetric, however, it's not as per my derivations.Owing to an unsymmetric form of the matrix $A$ I need help to efficiently form $A$ for $N\times N$ system. Would appreciate if someone could use their awesome numerical skills to answer these issues.
ADR equation implicit solution: Penta-diagonal matrix for a 2D $N\times N$ system
finite difference;matrix;advection diffusion;implicit methods