# Finite volume method for two dimensional diffusion problem

The methods used for solving two dimensional Diffusion problems are similar to those used for one dimensional problems. The general equation for steady diffusion can be easily derived from the general transport equation for property Φ by deleting transient and convective terms
${\frac {\partial}{\partialx}}\left(\Gamma{\frac {\partial\phi}{\partialx}}\right)+{\frac {\partial}{\partialy}}\left(\Gamma{\frac {\partial\phi}{\partialy}}\right)+S=0$
where, $\Gamma$ is the Diffusion coefficient and $S$ is the Source term.
A portion of the two dimensional grid used for Discretization is shown below:
In addition to the east (E) and west (W) neighbors, a general grid node P, now also has north (N) and south (S) neighbors. The same notation is used here for all faces and cell dimensions as in one dimensional analysis. When the above equation is formally integrated over the Control volume, we obtain
$\int _{\Delta {v}}{\frac {\partial}{\partialx}}\left(\Gamma{\frac {\partial\phi}{\partialx}}\right)dxdy+\int _{\Delta {v}}{\frac {\partial}{\partialy}}\left(\Gamma{\frac {\partial\phi}{\partialy}}\right)dxdy+\int _{\Delta {v}}S_{\phi}dV=0$
Using the divergence theorem, the equation can be rewritten as :
$\left[{\Gamma}_{e}A_{e}\left({\frac {\partial\phi}{\partialx}}\right)_{e}-{\Gamma}_{w}A_{w}\left({\frac {\partial\phi}{\partialx}}\right)_{w}\right]+\left[{\Gamma}_{n}A_{n}\left({\frac {\partial\phi}{\partialy}}\right)_{n}-{\Gamma}_{s}A_{s}\left({\frac {\partial\phi}{\partialy}}\right)_{s}\right]+{\bar {S}}\DeltaV=0$
This equation represents the balance of generation of the property φ in a Control volume and the fluxes through its cell faces. The derivatives can by represented as follows by using Taylor series approximation:
${{\Gamma}_{w}A_{w}\left({\frac {\partial\phi}{\partial {x}}}\right)}_{w}={\Gamma}_{w}A_{w}{\frac {({\phi}_{p}-{\phi}_{w})}{{\deltax}_{WP}}}$
Flux across the east face =
${{\Gamma}_{e}A_{e}\left({\frac {\partial\phi}{\partial {x}}}\right)}_{e}={\Gamma}_{e}A_{e}{\frac {({\phi}_{e}-{\phi}_{p})}{{\deltax}_{PE}}}$
Flux across the south face =
${{\Gamma}_{s}A_{s}\left({\frac {\partial\phi}{\partial {y}}}\right)}_{s}={\Gamma}_{s}A_{s}{\frac {({\phi}_{p}-{\phi}_{s})}{{\deltay}_{SP}}}$
Flux across the north face =
${{\Gamma}_{n}A_{n}\left({\frac {\partial\phi}{\partial {y}}}\right)}_{n}={\Gamma}_{n}A_{n}{\frac {({\phi}_{n}-{\phi}_{p})}{{\deltay}_{PN}}}$
Substituting these expressions in equation (2) we obtain
${\Gamma}_{e}A_{e}{\frac {({\phi}_{e}-{\phi}_{p})}{{\deltax}_{PE}}}-{\Gamma}_{w}A_{w}{\frac {({\phi}_{p}-{\phi}_{w})}{{\deltax}_{WP}}}+{\Gamma}_{n}A_{n}{\frac {({\phi}_{n}-{\phi}_{p})}{{\deltay}_{PN}}}-{\Gamma}_{s}A_{s}{\frac {({\phi}_{p}-{\phi}_{s})}{{\deltay}_{SP}}}+{\bar {S}}\DeltaV=0$
When the source term is represented in linearized form ${\bar {S}}\DeltaV=S_{u}+S_{p}*S_{\varphi }$ , this equation can be rearranged as,
$\left[{\frac {{\Gamma}_{e}A_{e}}{{\deltax}_{PE}}}+{\frac {{\Gamma}_{w}A_{w}}{{\deltax}_{WP}}}+{\frac {{\Gamma}_{n}A_{n}}{{\deltay}_{PN}}}+{\frac {{\Gamma}_{s}A_{s}}{{\deltay}_{SP}}}-S_{p}\right]\phi_{P}$ = ${\frac {{\Gamma}_{e}A_{e}}{{\deltax}_{PE}}}\phi_{E}+{\frac {{\Gamma}_{w}A_{w}}{{\deltax}_{WP}}}\phi_{W}+{\frac {{\Gamma}_{n}A_{n}}{{\deltax}_{PN}}}\phi_{N}+{\frac {{\Gamma}_{s}A_{s}}{{\deltax}_{SP}}}\phi_{S}+S_{u}$
This equation can now be expressed in a general discretized equation form for internal nodes, i.e.,
$a_{P}\phi_{P}=a_{W}\phi_{W}+a_{E}\phi_{E}+a_{S}\phi_{S}+a_{N}\phi_{N}+S_{u}$
Where,
| $a_{W}$ | $a_{E}$ | $a_{S}$ | $a_{N}$ | $a_{P}$ |
| ${\frac {{\Gamma}_{w}A_{w}}{{\deltax}_{WP}}}$ | ${\frac {{\Gamma}_{e}A_{e}}{{\deltax}_{PE}}}$ | ${\frac {{\Gamma}_{s}A_{s}}{{\deltax}_{SP}}}$ | ${\frac {{\Gamma}_{n}A_{n}}{{\deltax}_{PN}}}$ | $a_{W}+a_{E}+a_{S}+a_{N}-S_{p}$ |
The face areas in y two dimensional case are :
and
We obtain the distribution of the property $\varphi$ i.e. a given two dimensional situation by writing discretized equations of the form of equation (3) at each grid node of the subdivided domain. At the boundaries where the temperature or fluxes are known the discretized equation are modified to incorporate the boundary conditions. The boundary side coefficient is set to zero (cutting the link with the boundary) and the flux crossing this boundary is introduced as a source which is appended to any existing $s_{u}$ and $S_{p}$ terms. Subsequently the resulting set of equations is solved to obtain the two dimensional distribution of the property $\varphi$