# Vectorized Numerical Algorithms to Solve Internal Problems of Computational Fluid Dynamics
## 9 Numerical Scheme
### Nozzle Flow  
An unsteady one-dimensional flow of inviscid compressible gas in a convergent-divergent nozzle is considered. Air (\(\gamma=1.4\)) is a working gas. The cross-sectional area of the nozzle varies as (Figure 16)  
\[S(x)=1+2x^{2},\quad\text{where}\quad-1/3\leqslant x\leqslant 1.\]  
The numerical solution is compared with the exact solution in overexpanded and underexpanded flow regimes.  
Total pressure and total temperature are fixed on inlet boundary (\(p_{0}=p_{00}\), \(T_{0}=T_{00}\)). The third quantity is found from the characteristic relations. Specification of boundary conditions on outlet boundary depends on flow regime (flow speed), overexpanded or underexpanded. Flow regime on outlet boundary depends on nozzle pressure ratio  
\[\frac{p_{\infty}}{p_{00}}=\left(\frac{2}{\gamma+1}\right)^{\frac{\gamma}{\gamma -1}}.\]  
A static pressure on outlet boundary equals atmospheric pressure (\(p=p_{\infty}\)) if outflow is subsonic. Overexpanded flow regime occurs if \(p_{\infty}/p_{00}>0.528\) (pressure is restored to atmospheric pressure through a nozzle shock wave). No nozzle shock wave occurs if \(p_{\infty}/p_{00}<0.528\) (the flow speed continuously increases in streamwise direction). Calculations are carried out on a mesh containing 35 cells, with a step of \(\Delta x=0.038\). Initial conditions assume that \(u=0\), \(p_{0}=p_{00}\), \(T_{0}=T_{00}\).  
The results of numerical simulation, processed in the form of pressure dependencies on streamwise coordinates, are shown in Figure 17 (Courant number is 0.88) and Figure 18 (Courant number is 0.18). The symbols \(\blacksquare\) and \(\square\) correspond to Godunov-type schemes of first and second orders (figure a), symbols \(\rhd\) correspond to Roe scheme (figure b), symbols \(\lhd\) correspond to TVD scheme of second order (figure c), and symbols \(\bullet\) correspond to TVD scheme of third order (figure d). The computed results show that numerical schemes spread the discontinuity over 1-2 mesh cells, preserving the monotonic nature of numerical solution.  
In the case of the presence of a nozzle shock wave (Figure 17), the third-order TVD numerical scheme provides results that are close to the exact solution. When using the Godunov scheme, it takes 0.0352 s of estimated time (fourteen time steps) to achieve a steady state; the Godunov scheme of second order takes 0.0348 s (eleven steps); the Roe scheme takes 0.02 s (five steps); and the TVD schemes of second and third orders take 0.021 s (four steps) and 0.023 s (four steps).  
Numerical schemes provide similar results in overexpanded flow regimes. The Godunov scheme takes 0.0068 s (twelve time steps) to achieve a steady state; the [PERSON] scheme of second order takes 0.0082 s (sixteen steps); the Roe scheme takes 0.01 s (nineteen steps); and the TVD schemes of second and third orders take 0.007 s (thirteen steps) and 0.0072 s (eleven steps).  
Figure 16: Nozzle profile.  
Figure 17: Pressure distributions in streamwise direction computed with [PERSON] scheme (**a**), [PERSON] scheme (**b**), TVD scheme of second order (**c**), TVD scheme of second order (**d**) at \(p_{00}=10^{8}\) Pa, \(T_{00}=300\) K, \(p_{\infty}=8\times 10^{5}\) Pa. Symbols show numerical solution, and solid lines correspond to the exact solution.  
Figure 18: Pressure distributions in streamwise direction computed with Godunov scheme (**a**), [PERSON] scheme (**b**), TVD scheme of second order (**c**), TVD scheme of second order (**d**) at \(p_{00}=10^{6}\) Pa, \(T_{00}=300\) K, \(p_{\infty}=8\times 10^{5}\) Pa. Symbols show numerical solution, and solid lines correspond to the exact solution.