## Introduction

For structured orthogonal grids, the gradient of a scalar at a given control volume centroid can be easily computed using the definition of the derivatives. The case becomes more complicated when general unstructured grids are involved. The usual approach is to make use of Green-Gauss theorem which states that the surface integral of a scalar function is equal to the volume integral (over the volume bound by the surface) of the gradient of the scalar function.
$\int_{\Omega}\nabla \phi d\Omega = \int_{S} \phi dS$
Assuming that $\nabla \phi$ is constant over the control volume, the Green-Gauss equation can be rewritten as
$\int_{\Omega}\nabla \phi d\Omega =\nabla \phi_P \Omega = \int_{S} \phi dS$
We next approximate the integral over the surface as a summation of the average scalar value times the surface vector
$\nabla \phi_P =\frac {1}{\Omega}\sum_{faces} \phi_f \vec S_f$
The face value $\phi_f$ still needs to be defined. Following are some practical methods to compute the average face value.

## Face value computation

As mentioned above, the average value of the scalar at a given face has to be correctly approximated in order to yield a correct computation of the cell gradient. As the FVM uses a cell centered formulation, values at the faces are not readily available, they have to be interpolated. There are two main approaches to compute the face value of a scalar

• Cell based in which the face value is computed using the values at its straddling cells
• Node based in which the face value is computed using the values at its straddling nodes

Note that these methods are not specific for the computation of the gradient. They can be used in any occasion when the face value is needed.

### Cell based methods

We define $\alpha$ as the weighing geometric factor between cells P and N
$\alpha = \frac {\left | \vec r_N - \vec r_f \right |} {\left | \vec r_N - \vec r_P \right |}$
then a simple approximation for the face value can be defined as
$\phi _f = \alpha \phi_P + \left( {1 - \alpha} \right)\phi_N$
This approximation is also known as a weighted interpolation. It is defined by a compact stencil in that only the cells straddling the face are only involved in the interpolation.
A special case arises when the face is situated midway between the two control volumes and the approximation reduces to an arithmetic average
$\phi_f = 0.5 \left( \phi_P + \phi _N \right)$

The advantage of this approach is that it is simple to implement. All of the operations involved are face-based and do not require any additional grid connectivity. Furthermore, the procedure can be readily implemented in three dimensions.
From an accuracy point of view, the above relation leads to a second order approximation of $\phi_f$ only when the segment [PN] and surface Sf are aligned. Thus a second order accurate representation of the gradient is generally not achieved except for this case.
For highly skewed unstructured grids, the accuracy decreases with increasing skewness. In such a case, a correction is added to the above approximation and an iterative procedure is usually needed to find the face value.

### Node based methods

The value of $\phi_f$ can be computed as the mean of the nodes defining the face. This necessitates the estimation of the properties at the nodes. The properties at the nodes are calculated using the weighted average of the properties within the cells defining that node. The weight is taken as the inverse of the distance of the node from the cell center
$\phi_{vertex} = \phi_v = \frac{{\sum\limits_{n = 1}^{cells} {\frac{{\phi _{Pn} }}{{\left| {\vec r_v - \vec r_{Pn} } \right|}}} }}{{\sum\limits_{n = 1}^{cells} {\frac{1}{{\left| {\vec r_v - \vec r_{Pn} } \right|}}} }}$
where v denotes the concerned vertex and the loop is performed over the the cells that define the vertex. Pn is the index of the cell, and $\left| {\vec r_v - \vec r_{Pn} } \right|$ is the distance from the vertex to the cell centroid.
Finally, the face value is taken as the arithmetic average of the values at the vertices.
$\phi _f = {\begin{matrix} {1 \over {N_{fv}}} \end{matrix}} \sum\limits_{i = 1}^{N_{fv}} {\phi _i }$
where Nfv represents the number of Vertices defining a given face.

## Note

The above mentioned gradients are sometimes called unlimited gradients since the face value obtained from them can exceed the bounding cell values. For this reason, for implementing higher order schemes, it becomes important to restrict them, so as not to introduce over and undershoot of variables.