Converging-Diverging Nozzle v2- rhoCentralFoam
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.
Thanks so much for this great example.
I’ve have a very basic question to ask. why are you using the compressible flow solver not incompressible, as far as i know the supersoinc flow should incompressible. could you plzz help me to answer this question? because this is my resarch now adays. i will wait for you answer
Hi, thank you for sharing this useful case files. I am having trouble while constructing blockmesh, it was created by pointwise, I see but how can I create blockmesh in this case file? Which command should I use? Because it keeps giving error, and in the case file only .step , .txt and .xlsx extension file other than main folders. I could not figure it out, could you please give me some hints?
Hi, I am trying to reproduce your subsonic flow simulation (p/p0 = 0.89) but my results do not fit analytical data.
I think it could be due to incorrect boundary conditions on velocity. Can you tell me yours, please?
I’ve have a very basic question to ask. Which function is used in the terminal to generate the mesh? It’s clear to me that files labeled Geom will be used, but I’m unsure to how to utilise them. Thank you!
Hi, Thanks so much for this great example.
But can you tell me which version of OpenFOAM did you used?
I try to do the same Case in version OpenFoam extend 4.0, but my results are not good.
I think the reason is the boundary conditions in the new version, did you have any idea what i can do to have the correct result
What do you think would happen if you set a static pressure at the inlet and then specified a fixed mass flow rate for the sub and supersonic cases? Would the total pressure that develops at the inlet be unique?