In this post I go over the numerical solution to the compressible boundary layer equations. This is very useful when a quick estimate of shear stress, wall heat flux, or boundary layer height if necessary.

The sections of this post are:

**Introduction****Compressibility transformation****Using the general parabolic form****Numerical solution using Crank-Nicolson****Results and comparison to OpenFOAM****Conclusions**

## Introduction

For a compressible flow, the boundary layer equations are:

(Continuity)

(Momentum)

(Energy)

Since (in general) we are only concerned with the steady state boundary layer these equations reduce to:

(Continuity)

(Momentum)

(Energy)

These equations are a parabolic partial differential equation. Essentially what this means for us (the person trying to solve it) is that the boundary layer equations are an **initial value problem. **So if we know the initial boundary layer profile (for example on a flat plate) then the solution can be achieved by marching forward along the wall boundary. This is what we will do here.

In this post intend to solve the above equations allowing for flow with **pressure gradient, heat transfer, and compressibility. **

## Compressibility Transformation

Because of the complicated nature of the above equations, it is common practice to use a *compressibility transformation. *In general, compressibility transformations refer to a change of variables that allow the compressible flow equations to be solved using the same numerical methods and approaches as the incompressible boundary layer equations. In particular these transformation typically correct for the fact that density is now a variable that is directly couple to the pressure and temperature fields through the equation of state, and the temperature dependence of viscosity.

Here we will use the *Levy-Lees coordinate transformation*. This change of variables is:

(For the direction tangential to the wall)

(For the direction normal to the wall)

Additionally we define some new dependent variables:

A scaled velocity parameter:

A scaled total enthalpy parameter:

The Chapman-Rubeson constant:

The Prandtl number:

A dimensionless pressure gradient parameter:

When these variables and the transformations are applied to the boundary layer equations the following equations result:

Continuity:

Momentum:

Energy:

In the above equations the primes (‘) denote a derivative in the direction, and the subscript denote a derivative in the transformed streamwise () direction.

These equations can be found in the **EXCELLENT **textbook on boundary layer analysis from Schetz. You can find the details of the textbook in the references section of this post.

## Using the *General Parabolic **Form*

The transformed equations above are non-linear and quite annoying to solve. However, there is a simple trick that can be performed that makes numerical solution much easier.

The general parabolic PDE for two independent variables is:

It obvious from inspection that our new continuity, momentum and energy equations **ARE NOT** in the general parabolic form. However, we can make an approximation by lumping some of the terms into the coefficients of the terms of the general parabolic equations.

So for example the momentum equation becomes:

Where:

Similarly for the energy equation:

Where:

We now have two equations written in the general parabolic form which can be easily solved numerically (explained in the next section). Supplementing these two equations is the continuity equation which can simply be integrated at each streamwise location:

We now have 3 equations that can be solved for the 3 unknowns: F, G, and V. The boundary conditions for these equations are:

, , , and

## Solution of the Equations using Crank-Nicolson

The equations above are now in a form that can be solved in many different ways depending on your preferred flavor of PDE solution. In this post I am going to use my preferred method for this problem which is the Crank-Nicolson method.

Recall that in fact the boundary layer problem is an ** initial value problem. **To solve this we start at a known station on the boundary and march the solution downstream. This can be done

*explicitly,*or

*implicitly.*When we solve explicitly, this means that all of the derivatives and coefficients are calculated at the present location and used to predict the next step downstream. An implicit solution means that all of the derivatives are evaluated both at the current step (therefore as knowns) and at the next downstream step (therefore remain unknowns). This creates a matrix which must then be solved. The method we will use here (Crank-Nicolson) is an

*implicit*method.

Additionally, we are going to use an **uncoupled **approach. This means that the momentum, energy and continuity equations are solved in series, not simultaneously. In a coupled approach these equations are solved simultaneously in one large solution at each step.

Since the momentum and energy equations are in the identical parabolic form, I will just do a general proof for the solution procedure using a dummy variable, .

Recall that the general parabolic equation is:

Now, the Crank-Nicolson algorithm is as follows. Given an equation of the form (using our variables here):

The solution is obtained by:

Index n, refers to the streamwise location, and index i refers to the normal location. This is demonstrated in the figure below.

In the equation, all derivatives are calculated using finite difference approximations. Now we will apply this to our general parabolic PDE. To start, we rearrange the equation to put the streamwise derivative on the LHS of the equation:

Insert the 2nd order central difference approximations for first and second normal derivatives, and use Crank-Nicolson for the streamwise derivative.

Next we place all of the knowns (index n) on the RHS, and all of the unkowns (index n+1) on the LHS, and collect like terms. This yields:

The above equation creates a tri-diagonal matrix that is solved at each step. Notice that in order to solve the equations this way we **do not **apply the Crank-Nicolson algorithm to the coefficients A, C, or D. This is because it would create a non-linear matrix solution. Because of this, the present approach is infact only **s****emi-implicit. **

A figure showing the construction of the tridiagonal matrix formed from this equation is shown below:

## Solution Algorithm

Now that we understand the Crank-Nicolson method and how it can be used to formulate a tridiagonal matrix we can formulate our solution algorithm. For simplicity I have mapped out the algorithm in the figure below:

As I said before, this algorithm is a **segregated (or uncoupled), semi-implicit solution** to the boundary layer equations.

I should point out that the algorithm shown in the figure above can easily be improved upon. For instance, the coefficients A thru D can be evaluated as an average between the current step at the next step. This is an application of the trapezoidal rule and the solution then becomes iterative. In these iterations as well, one can easily add an update step to account for changing thermophysical properties such as viscosity, thermal conductivity and specific heats that depend on the solution!

All of these improvements are in fact included in the code used for comparison in the next section. This is because we are comparing the solver to a simulation in rhoCentralFOAM that also accounts for changing thermophysical properties.

## Results and Comparison to rhoCentralFoam

As a test case, we are going to solve a laminar boundary layer behind an oblique shock on a flat.. I am not going to go into very much detail for the oblique shock case set-up since it is so simple, and I have done one very similar here.

A schematic of the simulation is shown here:

The above simulation set-up is a very simple way achieve an oblique shock solution. The boundary conditions for this simulation were:

- P∞=101 Pa, T∞=298 K, U∞=[650.391, -236.723, 0] (Approximately Mach 2)
- Wall temperature was: Tw=283.15
- With a plate length (L) of 0.1 m these properties correspond to a free-stream Reynolds number of 4452.
- Sutherland’s law was used for viscosity
- NASA Janaf polynomials were used for specific heat capacity and enthalpy

Here’s a video of the simulation result:

Now to use our compressible boundary layer solver we must recognize that the external properties of the boundary layer will be the “post-shock” conditions. So this can be calculated either using the known oblique shock relations, or by extracting them from the OpenFOAM simulation (I did the latter).

To compare the solutions I extracted the wall heat flux, and the wall shear stress from the simulation. This is done using the OpenFOAM utilities wallHeatFlux, and wallShearStress.

We can see that our solution is pretty good! Both the shear stress and the wall heat flux run right on top of each other! Obviously for this problem the solver outlined in this post is adequate.

## Conclusions

In this post I outlined how one can write a numerical solver for the compressible laminar boundary layer equations. I then compared it to a solution achieved using OpenFOAM’s compressible flow solver rhoCentralFOAM and achieved very close results.

Please let me know if I made any mistakes! There were a lot of equations to transcribe from my notebook so I’m sure I messed some up.

If you want more detail for some parts I will gladly add to this post upon request! I skipped over some steps to keep the length of this post down. For instance I didn’t show how the algorithm changes when using averaged coefficients.

## Some Useful References

[1] Schetz, J. and Bowersox, R. (2011). Boundary layer analysis. Reston, VA: American Institute of Aeronautics and Astronautics.