In many engineering systems, fluid can move at low speeds or very high speeds. This creates two important flow types: incompressible flow and compressible flow.
Contents
ToggleIn incompressible flow, the density of the fluid stays almost constant. This type of flow happens when the Mach number is very low (usually less than 0.3). Liquids often behave like incompressible fluids because they do not compress easily.
In compressible flow, the density of the fluid changes a lot with pressure and temperature. This happens mostly in gases when the Mach number becomes high (greater than 0.3). In supersonic flow (Mach > 1), these changes become even stronger, and special fluid behavior like shock waves and choked flow can occur.
The Mach number (M) is a number that compares the flow speed to the speed of sound in the fluid.
![]()
where V is the velocity, and a is the local speed of sound. It helps us understand if compressibility effects are important.

Figure 1: Mach number change contour in the convergent-divergent nozzle and velocity changes that, according to the Mach number contour, approach 3.
In this tutorial, we will simulate compressible flow in a nozzle using ANSYS Fluent. This will show how the flow accelerates, how choking happens at the throat, and how shock waves appear inside or after the nozzle. We will use a proper density-based solver, apply realistic boundary conditions like total pressure and total temperature at the inlet, and observe how flow expands or compresses after the throat.
The main simulation goals are:
- Calculate the Mach number field across the nozzle
- Compare pressure and temperature distributions — and show how they change in different regions
- Detect where the choke point occurs and where the shocks form
- Understand how compressibility changes the flow compared to incompressible behavior
This example also helps us learn how to:
- Use the compressible flow model in ANSYS Fluent
- Apply correct thermodynamic models (like ideal gas and Sutherland’s law)
- Solve high-speed flows with the density-based solver and capture shock waves
This tutorial is helpful for engineers and students who want to learn more about supersonic nozzle flow, compressibility, and Mach number effects.
Problem Definition
In this problem, we study compressible flow of air (ideal gas) inside a convergent–divergent nozzle. The nozzle shape is defined by the area relation
for the axis direction
, which creates a smooth contraction and expansion along the centerline. The total nozzle length is 1000 mm, and the circular cross‑section at the inlet has a diameter of 667.56 mm, as shown in the image. The flow enters the nozzle with an inlet pressure of 101325 Pa and an inlet temperature of 300 K, and it exits with a low outlet pressure of 3738.9 Pa, which forces the air to accelerate and reach supersonic speeds inside the throat and downstream region. This setup allows us to model the behavior of a 1‑D‑like compressible flow inside a smooth axisymmetric nozzle and compare the numerical results with analytical relations for Mach number distribution.

Figure 2: Geometry and boundary conditions of the convergent–divergent nozzle used in the compressible flow simulation, including analytical area function, inlet conditions, and outlet pressure.
Geometry Design
In this simulation, we study compressible flow in a nozzle. The first step is to design the nozzle geometry. This nozzle has a converging-diverging shape. The goal is to allow the flow to accelerate and create areas with high Mach number and possibly shocks.
To define the geometry, we use a formula for cross-sectional area as a function of the nozzle centerline (x):
; ![]()
This defines a symmetric nozzle shape. The geometry is created in axisymmetric form, which is common for compressible flows. We only model half of the nozzle, and ANSYS Fluent uses 2D axisymmetric simulation, which saves time and reduces computational cost.
The total length of the nozzle is 1000 mm, and the maximum diameter is 667.56 mm, based on the area function. The radius is 333.78 mm, which is used in the axisymmetric setup.
We use Excel to calculate the Y-coordinates of the wall, using the area formula. The axial direction (X) is divided into steps of 0.5 mm. This gives smooth geometry and accurate mesh control.
To import the shape into ANSYS DesignModeler, we:
- Save the (x, y) points in a Notepad (.txt) file in four sections (inlet, converging, throat, diverging).
- Inside ANSYS, go to:
Concept > 3D Curve > From File
Then use Concept > Sketch from Edge to create a sketch from the curve.
This method is simple and accurate. After this, the final nozzle shape is ready for meshing and simulation.

Figure 3: Nozzle geometry with axisymmetric layout created using surface area formula A = 0.1 + x². The nozzle has a length of 1000 mm and a maximum diameter of 667.56 mm. The shape is imported into ANSYS DesignModeler using 3D curve and sketch from edge.
Mesh Generation
A high-quality mesh is critical for accurate results in CFD. To simulate compressible flow inside the nozzle, we create a fully structured and aligned mesh in ANSYS Meshing.
We first define sizing for mesh control:
Go to: Mesh > Insert > Sizing, and set the element size to 0.01.
This ensures that small details are resolved correctly and boundary layers are captured efficiently.
Next, to generate a structured mesh, we apply:
Mesh > Face Meshing > Select the Entire Sketch
This creates an ordered grid along the nozzle profile, aligned with the flow, which is more accurate and faster to converge in compressible simulations.
This approach provides a consistent and smooth mesh, ideal for capturing shock waves and Mach number jumps.
We also define boundary names, which ANSYS Fluent uses in the setup:
Table 1: Geometry boundary condition naming table in ANSYS Mesh software
| Boundary Type | Name Assigned |
| Axis of symmetry | Axis |
| Velocity Inlet | Inlet |
| Pressure Outlet | Outlet |
| Wall boundary | Wall |
If a wall is not named, ANSYS Fluent assigns it as ‘wall’ automatically.
These names help set proper boundary conditions in Fluent and are essential for managing flow zones and post-processing.

Figure 4: Structured mesh generated using sizing = 0.01 and face meshing in ANSYS. The mesh is aligned with the nozzle walls to better capture compressibility effects, shocks, and pressure changes during simulation.
Fluent Model and Solver Settings
In this part, we set up the compressible flow simulation in ANSYS Fluent. The correct solver and the correct models are very important for a high Mach number and supersonic nozzle CFD case. The steps below show the full setup.

Figure 5: Importing the mesh into ANSYS Fluent software, checking the mesh quality (no negative volume) and starting the numerical simulation settings of the convergent-divergent nozzle
General Solver Settings
In this simulation, we use the axisymmetric, steady, and density‑based solver because the nozzle flow is compressible and the Mach number is high. This solver makes the calculation stable and gives correct results for fast flows. We also display the axis to see the full shape of the nozzle and check the geometry before running the simulation. (Extra info: Density‑based solvers are the standard choice for supersonic CFD in ANSYS Fluent.)

Figure 6: General settings in Fluent. Axisymmetric, density-based, and steady solver are selected for compressible nozzle flow.
Models
We select the Inviscid model because viscosity is not important in this case and we only want to study pressure, temperature, and Mach number. Then we activate the energy equation so Fluent can compute temperature changes and compressible effects inside the nozzle. (Extra info: Inviscid flow helps avoid extra complexity and gives a clean result for ideal nozzle studies.)

Figure 7: Viscous model set to Inviscid and energy equation enabled for temperature and Mach number calculation.
Materials
The material is set to air, and it must be changed to Ideal Gas so Fluent can calculate density variations caused by pressure and temperature changes. This model is important because compressible flow depends strongly on density changes. (Extra info: Ideal Gas is required for Mach number prediction.)

Figure 8: Material set to Air–Ideal Gas to allow compressible flow and correct temperature changes.
Operating Conditions
We set the operating pressure to 0 Pa to avoid pressure oscillations and to simplify all pressure values in the simulation. This helps Fluent compute the flow more smoothly, especially in high‑speed and shock regions. (Extra info: This is a common step in compressible flow modeling.)

Figure 9: Operating pressure changed to 0 Pa for stable and accurate compressible flow calculations.
Boundary Conditions
The inlet uses a pressure inlet with a total pressure of 101325 Pa and a temperature of 300 K, and the outlet uses a pressure outlet with a low pressure of 3738.9 Pa to create acceleration and supersonic flow. Fluent may treat the outlet as an inlet when reverse flow happens, which is normal in compressible simulations. (Extra info: The low outlet pressure forces the flow to reach high Mach numbers.)

Figure 10: Boundary conditions: inlet pressure 101325 Pa, outlet pressure 3738.9 Pa, temperature 300 K.
Inlet Boundary (Pressure Inlet)
- Gauge Pressure: 101325 Pa
This is the ambient pressure.
Because operating pressure = 0, we must include the full pressure value here. - Supersonic Gauge Pressure: 98000 Pa
Fluent uses this value to estimate the initial Mach number and to help start the compressible simulation.
This value does not affect the final result. - Inlet Temperature: 300 K
Outlet Boundary (Pressure Outlet)
- Gauge Pressure: 3738.9 Pa
This low pressure forces the flow to accelerate and creates supersonic flow inside the nozzle. - Reverse Flow Note
If reverse flow happens, Fluent automatically treats the outlet as an inlet.
This is normal in compressible flow simulations.
Solution Methods
We use the Least Squares Cell‑Based method for gradients and Second‑Order Upwind for all flow variables because they give smooth results and capture the shock wave more accurately. These settings help the solution stay stable on structured meshes. (Extra info: Second‑Order Upwind improves prediction of pressure and temperature near the shock.)

Figure 11: Solution methods using Least Squares Cell-Based gradient and Second-Order Upwind for accurate shock capture.
Solution Controls
The Courant number is kept below 0.5 to keep the solver stable during the calculation, and the relaxation factors remain at the default values that give a smooth and safe convergence. This prevents sudden divergence and makes the simulation progress slowly but reliably. (Extra info: Low CFL is recommended for high‑speed flows.)

Figure 12: Courant number less than 0.5 used for stable compressible flow computation.
Residuals and Initialization
We set the residual target to 1e‑5 to reach a clean and accurate solution, and we initialize the domain from the inlet so the solver starts with realistic pressure and velocity values. This helps reduce the number of iterations needed for convergence. (Extra info: Inlet initialization is standard for nozzle problems.)

Figure 13: Residual targets set to 1e–5 for all equations.
Run Calculation
The simulation runs for 1000 iterations, which is enough for all residuals to reach the target and for the flow inside the nozzle to stabilize. This produces smooth contours of pressure, temperature, and Mach number. (Extra info: If convergence is reached earlier, Fluent will stop automatically.)

Figure 14: Simulation runs for 1000 iterations or until all residuals reach 1e–5.
Post‑Processing
Pressure Contours
We first display the static pressure contour to see how the pressure drops smoothly along the nozzle. Then we show the dynamic pressure contour to understand how the flow speed increases in the narrow part, and we also display the total pressure phasor to check the overall pressure behavior in the domain. These views help us see that the pressure changes follow the normal pattern of compressible flow inside a converging–diverging nozzle.

Figure 15: Final static pressure (on the left) and dynamic pressure (on the right) contours from the numerical simulation and their associated changes.
Velocity and Mach Number Contours
Next, we show the velocity contour and the Mach number contour to study the speed of the flow. The Mach number reaches 3, which clearly shows that the flow is supersonic at the nozzle exit. A shock wave may appear in some cases, but in this problem, the flow stays smooth and we do not see a shock phenomenon. These contours confirm that the flow accelerates correctly based on the boundary conditions.

Figure 16: Velocity contour (on the left) and final Mach number (on the right) corresponding to the numerical simulation and its related changes.
Vector Display
We also display the velocity vectors in the computational domain to see the direction and strength of the flow. The vectors for the Mach number show how the flow moves from subsonic to supersonic regions in a clean and stable way. This view helps us understand the flow pattern inside the nozzle.

Figure 17: Velocity vectors colored by Mach number in the nozzle
Plots
Finally, we create plots of static pressure along the centerline and the nozzle wall to compare how the pressure changes in both regions. We also plot the Mach number along the centerline to see how it increases from inlet to outlet. These simple graphs help confirm that the simulation gives correct compressible‑flow results.

Figure 18: Graphs of static pressure changes (right) and Mach number changes (left) at the center of the nozzle and on the nozzle walls.
Validation of the Numerical Results
To validate the simulation, we compare the Mach number from CFD with the analytical Mach number from the one‑dimensional similar‑flow theory of a convergent‑divergent nozzle. The analytical relation comes from the differential area‑velocity equation for compressible flow, shown in the figure, and it expresses the change in area with Mach number and velocity. Using this formula :
dA/A = (M² – 1) · (du/u).
and the area distribution of the nozzle, we calculate the theoretical Mach number along the centerline.
Then we extract the CFD Mach number along the same centerline in the post‑processing step. This comparison shows that the numerical Mach distribution follows the analytical trend well, and the maximum Mach number reaches about 3, which confirms correct supersonic behavior in the nozzle. The validation plot, added from Tecplot, displays both curves on the same graph and shows good agreement between the theoretical model and the numerical solution.

Figure 19: Analytical relation for 1D compressible nozzle flow used to compute the theoretical Mach number (quasi) in Tecpolt.
Conclusion
This study showed that numerical simulation can predict the behavior of compressible flow inside a converging–diverging nozzle with good accuracy. The Mach number from the CFD model matched the analytical value from the one‑dimensional formula shown in the figure, and this confirms that the setup, mesh, and solver were correct. The results also showed smooth changes in pressure, velocity, and Mach number, and the flow reached a Mach number of 3 at the exit, which is fully supersonic. This means that the density‑based solver and the ideal‑gas model captured the physics of compressible flow correctly.
Numerical simulation is used in many real industries because it helps engineers understand flow behavior before building any device. It is used in aerospace, automotive, energy, HVAC, and industrial equipment to study nozzles, turbines, compressors, ejectors, jet engines, and cooling systems. Numerical simulation reduces cost, speeds up design, and makes testing safer. It is also useful for learning how pressure, temperature, and velocity change inside systems where the flow is fast and compressible.
Importance of Mach Number and Compressible Flow
The Mach number is very important in engineering because it shows when the flow becomes compressible. When the Mach number is higher than 1, the flow is supersonic and behaves very differently from low‑speed flow. Pressure waves, shocks, density changes, and temperature jumps happen in this region. Correct modeling of Mach number helps engineers design safer and more efficient devices such as nozzles, rockets, jets, and cooling systems. Because of this, compressible‑flow simulation is a key part of many modern engineering projects.
Related CFDLAND Products
For more learning and hands‑on practice, several products on the CFDLAND website are useful for people who want to study compressible flow and Mach number effects.
The Rotating Detonation Combustor (RDC) CFD Simulation shows how shocks and supersonic waves interact with combustion.
The Detonation Wave Propagation in Orifice Simulation teaches how shock waves move through narrow passages.
The Energy Loss in Nozzle (Compressible Flow) package is useful for understanding compressible nozzle behavior similar to this tutorial.

All of these training products can be found in our CFD SHOP, and they help users learn compressible‑flow simulation in ANSYS Fluent with clear steps and ready‑to‑use files.
