4.4 Numerical schemes
The fvSchemes dictionary in the system directory sets the numerical schemes for terms, such as derivatives in equations, that appear in applications being run. This section describes how to specify the schemes in the fvSchemes dictionary.
The terms that must typically be assigned a numerical scheme in fvSchemes range from derivatives, e.g. gradient , and interpolations of values from one set of points to another. The aim in OpenFOAM is to offer an unrestricted choice to the user. For example, while linear interpolation is effective in many cases, OpenFOAM offers complete freedom to choose from a wide selection of interpolation schemes for all interpolation terms.
The derivative terms further exemplify this freedom of choice. The user first has a choice of discretisation practice where standard Gaussian finite volume integration is the common choice. Gaussian integration is based on summing values on cell faces, which must be interpolated from cell centres. The user again has a completely free choice of interpolation scheme, with certain schemes being specifically designed for particular derivative terms, especially the convection divergence terms.
The set of terms, for which numerical schemes must be specified, are subdivided within the fvSchemes dictionary into the categories listed in Table 4.5. Each keyword in Table 4.5 is the name of a subdictionary which contains terms of a particular type, e.g. gradSchemes contains all the gradient derivative terms such as grad(p) (which represents ). Further examples can be seen in the extract from an fvSchemes dictionary below:
18 ddtSchemes
19 {
20 default Euler;
21 }
22
23 gradSchemes
24 {
25 default Gauss linear;
26 grad(p) Gauss linear;
27 }
28
29 divSchemes
30 {
31 default none;
32 div(phi,U) Gauss linear;
33 }
34
35 laplacianSchemes
36 {
37 default Gauss linear orthogonal;
38 }
39
40 interpolationSchemes
41 {
42 default linear;
43 }
44
45 snGradSchemes
46 {
47 default orthogonal;
48 }
49
50
51 // ************************************************************************* //
The example shows that the fvSchemes dictionary contains the following:
 6 …Schemes subdictionaries containing keyword entries for each term specified within including: a default entry; other entries whose names correspond to a word identifier for the particular term specified, e.g. grad(p) for
 a fluxRequired subdictionary containing fields for which the flux is generated in the application, e.g. p in the example.
If a default scheme is specified in a particular …Schemes subdictionary, it is assigned to all of the terms to which the subdictionary refers, e.g. specifying a default in gradSchemes sets the scheme for all gradient terms in the application, e.g. , . When a default is specified, it is not necessary to specify each specific term itself in that subdictionary, i.e. the entries for grad(p), grad(U) in this example. However, if any of these terms are included, the specified scheme overrides the default scheme for that term.
Alternatively the user may insist on no default scheme by the none entry. In this instance the user is obliged to specify all terms in that subdictionary individually. Setting default to none may appear superfluous since default can be overridden. However, specifying none forces the user to specify all terms individually which can be useful to remind the user which terms are actually present in the application.
The following sections describe the choice of schemes for each of the categories of terms in Table 4.5.
4.4.1 Interpolation schemes
The interpolationSchemes subdictionary contains terms that are interpolations of values typically from cell centres to face centres. A selection of interpolation schemes in OpenFOAM are listed in Table 4.6, being divided into 4 categories: 1 category of general schemes; and, 3 categories of schemes used primarily in conjunction with Gaussian discretisation of convection (divergence) terms in fluid flow, described in section 4.4.5. It is highly unlikely that the user would adopt any of the convectionspecific schemes for general field interpolations in the interpolationSchemes subdictionary, but, as valid interpolation schemes, they are described here rather than in section 4.4.5. Note that additional schemes such as UMIST are available in OpenFOAM but only those schemes that are generally recommended are listed in Table 4.6.
A general scheme is simply specified by quoting the keyword and entry, e.g. a linear scheme is specified as default by:
The convectionspecific schemes calculate the interpolation based on the flux of the flow velocity. The specification of these schemes requires the name of the flux field on which the interpolation is based; in most OpenFOAM applications this is phi, the name commonly adopted for the surfaceScalarField velocity flux . The 3 categories of convectionspecific schemes are referred to in this text as: general convection; normalised variable (NV); and, total variation diminishing (TVD). With the exception of the blended scheme, the general convection and TVD schemes are specified by the scheme and flux, e.g. an upwind scheme based on a flux phi is specified as default by:
Some TVD/NVD schemes require a coefficient where corresponds to TVD conformance, usually giving best convergence and corresponds to best accuracy. Running with is generally recommended. A limitedLinear scheme based on a flux phi with is specified as default by:
4.4.1.1 Schemes for strictly bounded scalar fields
There are enhanced versions of some of the limited schemes for scalars that need to be strictly bounded. To bound between userspecified limits, the scheme name should be preceded by the word limited and followed by the lower and upper limits respectively. For example, to bound the vanLeer scheme strictly between 2 and 3, the user would specify:
There are specialised versions of these schemes for scalar fields that are commonly bounded between 0 and 1. These are selected by adding 01 to the name of the scheme. For example, to bound the vanLeer scheme strictly between 0 and 1, the user would specify:
Strictly bounded versions are available for the following schemes: limitedLinear, vanLeer, Gamma, limitedCubic, MUSCL and SuperBee.
4.4.1.2 Schemes for vector fields
There are improved versions of some of the limited schemes for vector fields in which the limiter is formulated to take into account the direction of the field. These schemes are selected by adding V to the name of the general scheme, e.g. limitedLinearV for limitedLinear. ‘V’ versions are available for the following schemes: limitedLinearV, vanLeerV, GammaV, limitedCubicV and SFCDV.
4.4.2 Surface normal gradient schemes
The snGradSchemes subdictionary contains surface normal gradient terms. A surface normal gradient is evaluated at a cell face; it is the component, normal to the face, of the gradient of values at the centres of the 2 cells that the face connects. A surface normal gradient may be specified in its own right and is also required to evaluate a Laplacian term using Gaussian integration.
The available schemes are listed in Table 4.7 and are specified by simply quoting the keyword and entry, with the exception of limited which requires a coefficient where

(4.1) 
A limited scheme with is therefore specified as default by:
4.4.3 Gradient schemes
The gradSchemes subdictionary contains gradient terms. The discretisation scheme for each term can be selected from those listed in Table 4.8.
The discretisation scheme is sufficient to specify the scheme completely in the cases of leastSquares and fourth, e.g.
The Gauss keyword specifies the standard finite volume discretisation of Gaussian integration which requires the interpolation of values from cell centres to face centres. Therefore, the Gauss entry must be followed by the choice of interpolation scheme from Table 4.6. It would be extremely unusual to select anything other than general interpolation schemes and in most cases the linear scheme is an effective choice, e.g.
Limited versions of any of the 3 base gradient schemes — Gauss, leastSquares and fourth — can be selected by preceding the discretisation scheme by cellLimited (or faceLimited), e.g. a cell limited Gauss scheme
4.4.4 Laplacian schemes
The laplacianSchemes subdictionary contains Laplacian terms. Let us discuss the syntax of the entry in reference to a typical Laplacian term found in fluid dynamics, , given the word identifier laplacian(nu,U). The Gauss scheme is the only choice of discretisation and requires a selection of both an interpolation scheme for the diffusion coefficient, i.e. in our example, and a surface normal gradient scheme, i.e. . To summarise, the entries required are:
The interpolation scheme is selected from Table 4.6, the typical choices being from the general schemes and, in most cases, linear. The surface normal gradient scheme is selected from Table 4.7; the choice of scheme determines numerical behaviour as described in Table 4.9. A typical entry for our example Laplacian term would be:
4.4.5 Divergence schemes
The divSchemes subdictionary contains divergence terms. Let us discuss the syntax of the entry in reference to a typical convection term found in fluid dynamics , which in OpenFOAM applications is commonly given the identifier div(phi,U), where phi refers to the flux .
The Gauss scheme is the only choice of discretisation and requires a selection of the interpolation scheme for the dependent field, i.e. in our example. To summarise, the entries required are:
The interpolation scheme is selected from the full range of schemes in Table 4.6, both general and convectionspecific. The choice critically determines numerical behaviour as described in Table 4.10. The syntax here for specifying convectionspecific interpolation schemes does not include the flux as it is already known for the particular term, i.e. for div(phi,U), we know the flux is phi so specifying it in the interpolation scheme would only invite an inconsistency. Specification of upwind interpolation in our example would therefore be:
4.4.6 Time schemes
The first time derivative () terms are specified in the ddtSchemes subdictionary. The discretisation scheme for each term can be selected from those listed in Table 4.11.
There is an offcentering coefficient with the CrankNicolson scheme that blends it with the Euler scheme. A coefficient of corresponds to pure CrankNicolson and and corresponds to pure Euler. The blending coefficient can help to improve stability in cases where pure CrankNicolson are unstable.
When specifying a time scheme it must be noted that an application designed for transient problems will not necessarily run as steadystate and visa versa. For example the solution will not converge if steadyState is specified when running icoFoam, the transient, laminar incompressible flow code; rather, simpleFoam should be used for steadystate, incompressible flow.
Any second time derivative () terms are specified in the d2dt2Schemes subdictionary. Only the Euler scheme is available for d2dt2Schemes.
4.4.7 Flux calculation
The fluxRequired subdictionary lists the fields for which the flux is generated in the application. For example, in many fluid dynamics applications the flux is generated after solving a pressure equation, in which case the fluxRequired subdictionary would simply be entered as follows, p being the word identifier for pressure:
{
p;
}