# Integrating Turbulence Models Into Aither - Part 1

## Part 1 - Explicit Formulation

This post will focus on integrating turbulence models into Aither’s explicit solvers. This includes calculation of the residual which is necessary for the implicit solvers. The next post in this series will cover integrating turbulence models into the LU-SGS implicit solver.

## Reynolds-Averaged Navier-Stokes Equations

To solve the Navier-Stokes equations with turbulence models we use the Favre and Reynolds-averaged equations as shown below. The mean flow equations are identical to the Navier-Stokes equations with the exception of the viscosity and thermal conductivity terms. The viscosity is replaced by its sum with the turbulent eddy viscosity . The thermal conductivity term is replaced by its sum with the turbulent thermal conductivity . The turbulence equations themselves only couple to the mean flow equations through the turbulent eddy viscosity.

In the above equations the turbulence model shown is a two equation k- model. The turbulent source terms consist of production, destruction, and cross diffusion terms. These terms are model dependent and their values for the SST model can be seen here.

## Numerical Solution Strategy

We solve the turbulence equations separately from the mean flow equations instead of solving both sets of equations simultaneously. This is done because the coupling between the equation sets is relatively weak, and solving the equations simultaneously requires more work. To solve the equations simultaneously using an implicit method requires a new flux jacobian to be calculated for each turbulence model in the code. Solving the equations separately allows the same flux jacobian to be used for all turbulence models.

To fully implement the turbulence models into the Aither code the inviscid and viscous flux calculations must be extended
for the turbulence equations. Also the code must now calculate the source terms of the turbulence models. The source terms
can provide a lot of issues numerically because they are characteristically *stiff*. These terms can severely limit the stable
time increment for a given time integration scheme. For this reason it is usually only practical to solve these equations
with an implicit method. Aither uses the Lower-Upper Symmetric Gauss Seidel (LU-SGS) implicit solver, so this must be extended
for the turbulence equations (covered in next post).

## Flux Calculations With Turbulence Equations

Aither uses the Roe flux difference splitting method to calculate the inviscid fluxes, and a central difference method to calculate the viscous fluxes. These flux calculations must be extended for use with the turbulence equations.

# Roe Flux With Turbulence Equations

To calculate the inviscid fluxes the primative variables are reconstructed at the cell faces. A given face will have two adjacent cells, so there will be two separated reconstructed states. These states may not be equal to each other and therefore form a Riemann problem. Roe’s approximate Riemann solver is used to determine the inviscid flux at the cell face. The flux is calculated using the convective fluxes from the left and right reconstructed states as well as a dissipation matrix as shown below. In the equations below variables marked with a ~ indicated Roe averaged quantities, and the refers to the right state minus the left state. The dissipation matrix () is calculated from the left eigenvalues of the Roe matrix (), the eigenvalues of the Roe matrix (), and the wave strengths ().

As can be seen from the above equations there is no coupling from the turbulence equations to the mean flow equations in the inviscid flux calculation. However, the mean flow equations have some coupling to the turbulence equations. The above formulation is written in a way that is independent of the face tangent vectors. More information on this formulation and its derivation can be found here.

# Viscous Flux With Turbulence Equations

The viscous fluxes are calculated in the same way whether turbulence equations are present or not. A central difference is used to reconstruct the state at the cell face. The viscous flux itself is calculated as in above. In order to calculate the viscous flux for the turbulence equations gradients of and are needed. Therefore the existing gradient calculation methods in the code are extended to calculate these additional gradients. All gradients are calculated using the Green-Gauss method.

## Residual Calculation

The residual calculation with turbulence equations is identical with to that without it with the exception of the source terms. There are no source terms in the mean flow equations, but they are present in the turbulence equations. The source terms are multiplied by the cell volume, not the cell face area. It is important to note that the source terms start out on the right hand side of the equation, opposite of the inviscid and viscous fluxes. The equation below shows how the source terms contribute to the residual calculation.

With the changes above and the addition of appropriate boundary conditions, the code has been extended to solve the turbulence equations in an explicit manner.