Recently I read a CFD Online forum post where the accuracy of rhoCentralFoam was called into question.
The test case was the simple example of a converging diverging nozzle flow. In fact, I have already done a blog post regarding this. However, I tackled the problem using a large reservoir. In fact, it would have been more prudent to just simulate the nozzle and attempt to match the example from the NASA cfd benchmarking website:
So this is what I’ve done!
The case file can be found here:
The geometry in the case is an axi-symmetric converging diverging nozzle defined by a cosine function. I built the geometry and mesh in PointWise (just for the sake of time… I mean, I already did a detailed nozzle post). The result is here:
Three cases are calculated for comparison on the nasa site given above:
- Subsonic flow at exit (Pe/Po=0.89)
- Supersonic flow with shock wave in expanding section (Pe/Po=0.75)
- Supersonic flow at the exit (Pe/Po=0.16)
Case 1- Subsonic
For the subsonic case, it is important to remember that the outlet pressure MUST be set. Why? Because for a given nozzle geometry and stagnation pressure there is more than one possible solution since the flow is not choked!
The two most important boundary conditions here are the inlet and outlet. The inlet is specified using the totalPressure boundary condition (in my set-up P0=10000 Pa). You can also specify the total temperature. However, this will not affect the mach number or pressure profiles, only the velocity, density and temperature profiles. I set the temperature to be fixed at 298 K. The nozzle itself is an adiabatic, slip wall. The front and back are wedge types. The outlet is set to zeroGradient for velocity and temperature and the pressure is fixed to 8900 Pa (P/Po=0.89)
The results for pressure distribution and Mach number are shown here. Remember that since we are comparing P/Po and Mach number, it didn’t matter that I used a different pressure and temperature than the test case. I also included gifs showing the unsteady part of the simulation at the start.
Clearly the results match! Woohoo! One down, two to go!
Case 2- Supersonic with shock in diverging section
Tip for supersonic flow solution: Initialize the problem as a shock tube! Then the throat is choked right away in the simulation and convergence to the solution is faster!
In this case we must also specify the outlet pressure. Why? Because there are multiple solutions possible! Changing the back pressure changes the strength and location of the shock in the diverging section! So the setup is identical to the subsonic case for the inlet and nozzle. The only difference is that the outlet is set to 7500 Pa (P/Po=0.75). In order to speed convergence, we can use the setFields utility to set the LHS of the nozzle to the stagnation pressure, and the RHS of the nozzle to the outlet pressure.
The results for pressure distribution and Mach number are shown here:
Hurray! Two for two!
Case 3- Supersonic Flow
The fully supersonic case is in fact the most simple. Recall that a supersonic nozzle is actually an initial value problem! This is in contrast to the subsonic cases, or cases with shocks, where they are boundary value problems (the outlet pressure controls the solution). But in order to achieve the supersonic flow solution we just set the outlet pressure to be zeroGradient. Additionally, we again start the solution as a shock tube.
So you might ask, but we were given a specified outlet pressure! Well, we CAN set this outlet pressure. But this unnecissarily restricts our solution. Having a back pressure very close to, but not exactly the same as the actual supersonic outlet pressure could make things difficult. It is much easier to let the solution converge to where IT THINKS the right answer is. Then, how closely we match the outlet pressure is in fact an indicator of the quality of our solution!
Here are the results:
Three for three! rhoCentralFoam has passed the test.
As always comment and correct me where my mouth (or keyboard) has made error.