Finite volume methods, especially methods for complex geometries which employ curvilinear or unstructured grids, often make significant use of numerical schemes for computing the gradients of the dependent variables. Such gradient schemes may also have standalone uses, e.g.\ in postprocessing. The most popular such schemes rely on the divergence theorem and on least squares minimisation. This study aims to raise awareness of the fact that the former should be used with caution as it does not always converge to the exact gradient with grid refinement, whereas the latter is always at least first-order accurate. Furthermore, the issue of the best choice of weights for the least squares method is investigated both theoretically and through numerical experiments. It is proved that weighing each equation by the distance between the cell centres raised to the power $-3/2$ achieves second-order accuracy in some cases where the usual weights fail to do so, such as at boundary cells of structured grids. Finally, the schemes are used within a finite volume method to solve a simple diffusion equation on a series of highly distorted grids of increasing fineness, revealing that the inconsistency of the "divergence theorem" (or "Green-Gauss") gradient scheme propagates into the solution of the partial differential equation, whereas the "least squares" gradient scheme produces second-order accurate results. These results are reproduced also with the popular public domain PDE solver OpenFOAM, which uses the Green-Gauss gradient scheme by default.
['Alexandros Syrakos', 'Stylianos Varchanis', 'Yannis Dimakopoulos', 'Apostolos Goulas', 'John Tsamopoulos']
A critical analysis of some popular methods for the calculation of the gradient in finite volume methods, with suggestions for improvements