# OpenFOAM guide/Finite volume method (OpenFOAM)

OpenFOAM's finite volume method uses a co-located methodology on an unstructured polyhedral grid with arbitrary grid elements. Fluid dynamic quantities are centered on the control volume centroids. A variety of available interpolation, discretization, and matrix solution schemes can be selected at runtime. These are specified in the fvSchemes and fvSolutions files. OpenFOAM loads these schemes through its runTimeSelection mechanism which is flexible enough to allow different schemes to apply for each individual term in the equation. Implicit and explicit methodologies are separated into two different groupings: finite volume calculus for explicit; and finite volume method for implicit.

## Contents |

## 1 Mesh

OpenFOAM uses a co-located grid, i.e. the fluid dynamic properties are all stored at a single point within a control volume. In OpenFOAM this point is at the control volume centroid. The mesh allows for arbitrary polyhedral grid elements. There is no restriction to the number of points per face, nor to the number of faces enclosing a control volume.

There is a good treatise on the mesh structure in the OpenFOAM Programmer's Guide (now defunct).

## 2 Components

The solution method for an implicit equation differ significantly from the solution method for an explicit equation. Therefore OpenFOAM subdivides its finite volume method into two main namespaces:

- fvm ("finite volume method") for implicit equations; and
- fvc ("finite volume calculus") for explicit equations.

**Note:**As these are namespaces, no objects need to be created to make the functions they contain available. Including`fvCFD.H`automatically includes these files.

### 2.1 fvm namespace

The fvm is defined for implicit equations. Since the equation must be solved iteratively, rather than producing an immediate solution (like the fvc namespace), fvm namespace produces an fvMatrix object. This object can simply be solved using the `solve` method, but there are additional methods that an fvMatrix object can perform to facilitate a solution algorithm, such as `relax`.

In other words, the fvm namespace creates an **fvMatrix** from an **operator**. For example, the Laplacian operator:

fvm::laplacian(phi, U)

A number of different discretization schemes are available for each operation. These are loaded at run time using runTimeSelection, based on the schemes defined in fvSchemes.

### 2.2 fvc namespace

Since an explicit equation can be solved immediately, the fvc namespace does so. In other words, given an operation on a **volume field**, the fvc namespace produces another **volume field**.