# Equations

Cerisse solves equations in the general form

$$
\frac{\partial \mathbf{U} }{\partial t} + \frac{\partial \mathbf{F}*j }{\partial x\_j}  + \frac{\partial \mathbf{F}*{visc} }{\partial x\_j} =  \mathbf{S}
$$

Where $$\mathbf{U}$$ is the array in conservative variables

$$
\mathbf{U} = \begin{bmatrix} \rho \ \rho u\_i  \ E\_t \ \rho Y\_1 \ \rho Y\_2 \ ... \end{bmatrix}
$$

and $$\mathbf{F}$$ represent the fluxes of the conserved variables across a surface. For example in *x*-direction.

$$
\mathbf{F}\_x =
\begin{bmatrix}
\rho u \ \rho u\_2 + p \ \rho u v \ \rho u w \ u(E\_t + p) \ \rho u Y\_1 \ \rho u Y\_2 \ ...
\end{bmatrix}
$$

These are called the  **Euler fluxes**. If Euler fluxes are the only present, the resultant equations are the **Euler Equations.**

$$\mathbf{F}\_{visc}$$ represents the fluxes due to molecular transport (viscous streess, heat fluxes, mass disffusion, etc). While $$\mathbf{S}$$ is a generic source term. While combining these terms appropiately we can build differnt type of equations (check definition in [PROB](https://hslesdnsrf.gitbook.io/cerisse-docs/set-up/setup/prob)), such as **Euler**, **Navier-Stokes**, **Reactive Navier-Stokes**, etc. The general equations can be seen in [DNS](https://hslesdnsrf.gitbook.io/cerisse-docs/theory/equations/dns) .

## Finite Volume Method

The expression can be written in divergence form

$$
\frac{\partial \mathbf{U} }{\partial t} =\
-\nabla \cdot \left( \mathbf{F} +  \mathbf{F}\_{visc} \right) + \mathbf{S} =  -\nabla \cdot \mathbf{F}^\ast + \mathbf{S}
$$

Integrating over cell and dividing over control volume  $$V\_{ijk}$$

$$
\frac{1}{V\_{ijk}} \int \frac{\partial \mathbf{U} }{\partial t} dV =\
\frac{1}{V\_{ijk}}  \int -\nabla \cdot \mathbf{F}^\ast  , dV +  \frac{1}{V\_{ijk}}   \int \mathbf{S} dV
$$

Defining the cell-averaged value as

$$
\phi\_{ijk} = \frac{1}{V\_{ijk}}  \int \phi dV
$$

and using divergence theorem

$$
\frac{\partial \mathbf{U}*{ijk} }{\partial t} =\
\frac{1}{V*{ijk}}  \oint\_{\delta V} \mathbf{F}^\ast  \cdot \mathbf{n} , dA +  \mathbf{S}\_{ijk}
$$

Using polyhedral cells, the following expression follows by summing over the cells faces ()

$$
\frac{\partial \mathbf{U}*{ijk} }{\partial t}  =\
\frac{1}{V*{ijk}}  \sum\_{f=1}^{Nfaces} \mathbf{F}\_f^\ast \cdot \mathbf{n}*f , A\_f +  \mathbf{S}*{ijk}
$$

The above formulation ensures global conservation as the fluxes of shared faces between two control volumes cancel out.
