# 2.5 Introduction to Finite Volume Methods

## 2.5.1 Finite Volume Method in 1-D

The basis of the finite volume method is the integral convervation law. The essential idea is to divide the domain into many control volumes and approximate the integral conservation law on each of the control volumes. For example, as shown in Figure 2.13, cell $$i$$ lies between the points at $$x_{i-\frac{1}{2}}$$ and $$x_{i+\frac{1}{2}}$$. Note that the points do not have to be equally-spaced.

Figure 2.13: Mesh and notation for one-dimensional finite volume method.

The one-dimensional form of Equation 2.1 is

 $\frac{{\rm d}}{{\rm d}t}\int _{x_ L}^{x_ R} U\, dx + \left.F(U)\right|_{x_ R} - \left.F(U)\right|_{x_ L} = \int _{x_ L}^{x_ R} S(U,t)\, dx. \label{equ:conservation_1d}$ (2.99)

Thus, applying this to control volume $$i$$ (and recalling that $$S=0$$ for convection) gives,

 $\frac{{\rm d}}{{\rm d}t}\int _{x_{i-\frac{1}{2}}}^{x_{i+\frac{1}{2}}} U\, dx + \left. F(U)\right|_{x_{i+\frac{1}{2}}} - \left.F(U)\right|_{x_{i-\frac{1}{2}}} = 0. \label{equ:conservation_1d_ cv}$ (2.100)

Next, we define the mean value of $$U$$ in control volume $$i$$ as,

 $U_ i \equiv \frac{1}{\Delta x_ i} \int _{x_{i-\frac{1}{2}}}^{x_{i+\frac{1}{2}}} U\, dx, \quad \mbox{where} \quad \Delta x_ i \equiv x_{i+\frac{1}{2}} - x_{i-\frac{1}{2}}.$ (2.101)

Then, Equation 2.100 becomes,

 $\Delta x_ i \frac{{\rm d}U_ i}{{\rm d}t} + \left. F(U)\right|_{x_{i+\frac{1}{2}}} - \left.F(U)\right|_{x_{i-\frac{1}{2}}} = 0. \label{equ:conservation_1d_ cv_ final}$ (2.102)

At this point, no approximations have been made thus Equation 2.102 is exact. Now, we make the first approximation. Specifically, we assume that the solution in each control volume is constant,

 $U(x,t) = U_ i(t) \quad \mbox{for} \quad x_{i-\frac{1}{2}} < x < x_{i+\frac{1}{2}}.$ (2.103)

Thus, the finite volume approximation will be piecewise constant as shown in Figure 2.14.

Figure 2.14: Piecewise constant solution for one-dimensional finite volume method.

With this assumed form of the solution, the next issue is to determine the flux at $$i\pm \frac{1}{2}$$ at a time $$t$$. This can be done with the knowledge that the solution convects with the velocity $$u(t)$$. Thus, for the initial instant after $$t$$ (which we denote as $$t^{+} = t + \epsilon$$ where $$\epsilon$$ is an infinitesimal, positive number):

 $U(x_{i+\frac{1}{2}},t^{+}) = \left\{ \begin{array}{cc} U_{i}(t) & \mbox{if } u(t)>0 \\ U_{i+1}(t) & \mbox{if } u(t)<0 \end{array}\right.$ (2.104)

The flux can be calculated directly from this value of $$U$$,

 $F(x_{i+\frac{1}{2}},t^{+}) = \left\{ \begin{array}{cc} u(t) U_{i}(t) & \mbox{if } u(t)>0 \\ u(t) U_{i+1}(t) & \mbox{if } u(t)<0 \end{array}\right.$ (2.105)

An alternative way to write this flux which is valid regardless of the sign of $$u(t)$$ is,

 $F(x_{i+\frac{1}{2}},t^{+}) = \frac{1}{2}u(t)\left[U_{i+1}(t) + U_{i}(t)\right] - \frac{1}{2}|u(t)|\left[U_{i+1}(t) - U_{i}(t)\right]. \label{equ:upwindflux_ convection1d_ continuous}$ (2.106)

This flux, which uses the upstream value of $$U$$ to determine the flux, is known as an ‘upwind' flux. When $$U$$ is positive, the ‘upwind' direction is the negative $$x$$ direction because the solution moves towards the positive $$x$$ direction as $$t$$ increases. When $$U$$ is negative, the ‘upwind' direction is the positive $$x$$ direction because the solution moves towards the negative $$x$$ direction as $$t$$ increases.

The final step in arriving at a full-discrete approximation for one-dimensional convection is to discretize Equation 2.102 in time. This can be done choosing any of the ODE integration methods we studied previously. For simplicity, we choose the forward Euler method so that the final fully-discrete form of the finite volume method is,

 $\Delta x_ i \frac{U_ i^{n+1} - U_ i^ n}{{\Delta t}} + F_{i+\frac{1}{2}}^{n} - F_{i-\frac{1}{2}}^ n = 0, \label{equ:conservation_1d_ FVM}$ (2.107)

where we use the notation,

 $F_{i+\frac{1}{2}}^ n = \frac{1}{2}u^ n\left(U_{i+1}^ n + U_{i}^ n\right) - \frac{1}{2}|u^ n|\left(U_{i+1}^ n - U_{i}^ n\right). \label{equ:upwindflux_ convection1d}$ (2.108)