Abstract
This work performs systematic studies for code verification for turbulence modeling in our research CFD code SENSEI. Turbulence modeling verification cases including cross term sinusoidal manufactured solutions and a few exact solutions are used to justify the proper Spalart–Allmaras and Menter’s SST turbulence modeling implementation of the SENSEI CFD code. The observed order of accuracy matches fairly well with the formal order for both the 2D/3D steady-state and 2D unsteady flows when using the cross term sinusoidal manufactured solutions. This work concludes that it is important to keep the spatial discretization error in a similar order of magnitude as the temporal error in order to avoid erroneous analysis when performing combined spatial and temporal order analysis. Since explicit time marching scheme typically requires smaller time-step size compared to implicit time marching schemes due to stability constraints, multiple implicit schemes such as the singly diagonally implicit Runge–Kutta multistage scheme and three point backward scheme are used in our work to mitigate the stability constraints.
Introduction
Computational fluid dynamics (CFD) is a method to mathematically model and numerically solve physical problems involving fluid flows. There are various types of flows, including laminar flows and turbulent flows. Laminar flow transitions to turbulent flow when the Reynolds number becomes large enough. Miscellaneous methods have already been developed including Reynolds-averaged Navier–Stokes (RANS) models, large Eddy simulation and direct numerical simulation to model turbulent flows. This work will only focus on the RANS method. RANS models can be categorized as zero equation models (Prandtl’s mixing length model for an example), one equation models (e.g., Spalart–Allmaras [1]), two equation models ( [2], [3], SST [4], etc.), etc. The Boussinesq approximation is usually introduced to close the RANS equations by ensemble averaging over the Navier–Stokes equations since there is no analytic expression for the Reynolds stresses. The Boussinesq approximation relates the Reynolds stresses with mean flow velocities through the use of eddy viscosity. The eddy viscosity is solved differently using different RANS models. For example, the Spalart–Allmaras (SA) model solves the eddy viscosity through a working variable, while the SST model calculates the eddy viscosity by solving the kinetic energy and turbulent dissipation rate equations. The SA model is relatively cheap in terms of computational cost, and it is often used in flows with just slight separation such as transonic flow past airfoils, etc. The model which is a two equation model performs well for free shear flows, and the model is a good option for wall-bounded flows. The SST model, also known as the Menter’s SST, is devised to combine the advantages of (suitable for the free shear flow) and model (suitable for the inner region of the boundary flow).
Code verification [5,6] is a set of procedures to ensure that the implementation of a code is numerically correct. Order of accuracy test is a more rigorous criterion than expert judgment, error quantification, and consistency/convergence [7]. The method of manufactured solutions or numerical benchmark solutions or exact solutions combined with order of accuracy verification is usually utilized to rigorously verify whether a code can achieve the expected order of accuracy or not. For steady-state flows, the spatial residuals are driven to machine zero and then the iteratively converged result is compared to the exact steady-state solution to obtain the discretization error. For unsteady flows, the iterative procedure is similar but the temporal discretization error also exists and should be accounted for, that is, the overall discretization error is comprised of the spatial and temporal discretization error. There are multiple sources of error affecting the code verification analysis [5], such as poor mesh quality, improper time-step size, large subiterative errors, round-off error accumulation, which is especially important for ill-conditioned systems and unsteady flows, and even implementation errors which can be easily overlooked.
Since not many exact solutions exist for the compressible Navier–Stokes equations, the method of manufactured solution (MMS) becomes a rigorous method for order of accuracy analysis [5]. The MMS can be applied to any codes using any numerical scheme as the verification process only deals with the correctness of the numerical solution in those codes, ignoring whether the solution itself is physical or not. However, MMS may require the manufactured solutions to be smooth so the analysis of nonsmooth solutions including shocks and discontinuities may not be well supported.
In fact, there are plenty of studies on 2D and 3D exact solutions to the unsteady incompressible Euler/Navier–Stokes equations. Al-Saif and Harfash [8] proposed a reduced differential transform method which is an iterative procedure to obtain some Taylor series solutions to the kinetically reduced local incompressible Navier–Stokes equations. Different isentropic Euler vortex problems were tested in Ref. [9], with characteristic and periodic boundaries being compared to obtain improved observed order of accuracy (OOA) for high order flux reconstructions. In Ref. [10], 2D steady and unsteady incompressible viscous flows in which the vorticity is proportional to the stream function transported by a uniform stream were studied. Shah et al. [11] presented a time-accurate numerical method using high order accurate compact finite difference to solve some incompressible Navier–Stokes problems. Dirichlet boundary condition was applied for general cases and periodic boundary condition was applied for periodic cases. Tavelli and Dumbser [12] proposed an arbitrarily high order accurate discontinuous Galerkin method for solving the three-dimensional incompressible Navier–Stokes equations on a staggered unstructured grid. Tsoutsanis et al. [13] compared structured and unstructured finite volume and Lagrange-remap methods and investigated the accuracy and efficiency of second- to ninth-order using the vortex pairing problem.
More analytical solutions to the incompressible Euler/Navier–Stokes equations can be also found in Refs. [14–19]. Plugging any of these solutions into the unsteady compressible Euler/Navier–Stokes equations only requires a source term to be derived for the energy equation [20,21], that is, the exact solution still satisfies the continuity and momentum equations. If the flow Mach number is small (0.1 or so), the magnitude of the source term is also very small, but it cannot be neglected when an OOA test is performed. For an incompressible flow for which only the exact initial solution exists, such as the 3D Taylor–Green vortex flow [22], a usually used approach is using an incompressible flow solver [12,23,24] or using a high order approximate process [25] to obtain a reference solution, and use the compressible solver solution to compare to the incompressible reference solution. Kokkinakis and Drikakis [26] did a comprehensive accuracy and computational cost comparison between different schemes (OOA ranging from 2 to 9) in a weakly compressible turbulent channel flow based on the direct numerical simulation result directly. Nonphysical MMS are also widely used for code verification of steady [27–29] and unsteady [30–32] CFD problems. In Ref. [27], a thorough code verification study using nonphysical MMS was performed on an unstructured finite volume CFD code. Different options including the governing equations, different boundary conditions, and different solvers were verified. Minion and Saye [31] applied various high order temporal time marching schemes for the incompressible Navier–Stokes equations and found that order reduction for the temporal accuracy can occur if applying time-dependent boundary conditions. Yu et al. [32] used MMS to verify a fluid–structure-interaction solver for both 2D and 3D cases. Instead of using a simultaneous refinement for the spatial and temporal spacing, a recursive Richardson extrapolation approach was used to subtract the spatial error from the total error, allowing the separation of the temporal error for unsteady problems.
Following up the work in Ref. [33] which compares the SENSEI results with NASA published numerical benchmark solutions by CFL3D [34,35] and FUN3D [36], this work is focused on the steady/unsteady Euler/Navier–Stokes solver code verification in the SENSEI CFD code [33,37,38]. SENSEI has the functionality to estimate the truncation error, which can be used to obtain high order discretization error estimates using error transport equations [39]. In this work, both exact solutions and manufactured solutions will be applied for code verification of the Euler/Navier–Stokes solvers in SENSEI.
The Computational Fluid Dynamics Code Base: Structured, Euler/Navier–Stokes Explicit–Implicit Solver
Overview of Structured, Euler/Navier–Stokes Explicit– Implicit Solver.
SENSEI is an acronym for structured, Euler/Navier–Stokes explicit–implicit solver, which is our in-house flow solver initially developed by Derlaga et al. [37]. The initial code was written in a very structured programing style which contained a lot of similar subroutines, with some modern Fortran features such as derived type data and pointers being used. Jackson et al. [38] refactored the SENSEI code completely using an object-oriented programing style and implemented the negative Spalart–Allmaras turbulence model into SENSEI for some 2D problems [40]. Turning SENSEI into an object-oriented code enables users to add new capabilities to SENSEI more easily due to the improvement of SENSEI’s modularity. Xue et al. [33] followed up the work of Jackson et al. [38] by implementing the 3D turbulence models including the negative Spalart–Allmaras [1] and Menter’s shear stress transport [4,41] and parallelized SENSEI using domain decomposition and message passing interface [42]. Now SENSEI is capable of solving the Euler, laminar, and Favre-averaged Navier–Stokes equations with Spalart–Allmaras and Menter’s shear stress transport models. Multiple turbulence cases have been compared by using SENSEI, CFL3D [35], and FUN3D [36].
Structured, Euler/Navier–Stokes explicit–implicit solver is a multiblock structured finite volume code and is embedded with several inviscid flux options including Roe’s flux difference splitting [43], Steger–Warming flux vector splitting [44], and Van Leer’s flux vector splitting [45]. Monotonic upstream-centered scheme for conservation laws (MUSCL) extrapolation and k-exact reconstruction are offered to achieve second- and high-order inviscid flux, respectively. The viscous and turbulent flux are second-order accurate using a central flux scheme after applying the Green–Gauss theorem. Various time marching schemes including explicit/implicit Runge–Kutta [46–48] and explicit/implicit Euler are offered. SENSEI has various boundary conditions such as slip/nonslip wall, supersonic/subsonic inflow/outflow, interblock boundaries, etc. Ghost cells as well as boundary face flux options are offered in SENSEI to enforce boundaries accurately, depending on the boundary type.
Turbulence Models Into the Favre-Averaged Navier–Stokes Equations Equations.
In Eq. (6), PrL is the (laminar) Prandtl number and PrT is the turbulent Prandtl number. In order to close the system, a turbulence model is needed to model the turbulent eddy viscosity μT and the turbulent kinetic energy k.
The Negative Spalart–Allmaras Turbulent Model.
The MDTT term for the SA model is zero. Since the model does not model the turbulent kinetic energy, k, all terms related to k in Eq. (2) are dropped for the SA model.
The Menter’s Shear Stress Transport Turbulence Model.
The Menter’s Shear Stress Transport Turbulence Model With Vorticity Source Term.
The production limiter used in the standard Menter’s SST model is still employed in the k-equation.
Finite Volume Discretization.
where f is the cell face number (there are six faces for each hexahedral cell), is the face area, and Sh is the cell averaged source term vector. It should be noted that we have not yet discretized the temporal term, which will be covered next.
Temporal Discretization.
where s is the number of stages, bi and aij are constants, which can be found in Ref. [51]. For explicit Runge–Kutta schemes, all aij = 0 when , and for SDIRK, all aij = 0 when i < j. Many Runge–Kutta schemes can achieve high order accuracy for the temporal terms, but this work mainly uses second-order unless otherwise specified. Newton’s iteration is used for implicit Runge–Kutta schemes in this work.
As can be seen, three point backward requires the solutions from the previous two steps (no intermediate substep required) and it can achieve second-order accuracy for the temporal terms. SDIRK is used for the first step in SENSEI so that the three point backward can be initiated.
Nondimensionalization.
Observed Order of Accuracy Test
For steady flows, the observed order of accuracy can be obtained from performing a systematic refinement over a series of spatial meshes. The process of performing code verification for unsteady flow and steady flow is generally similar but different in the following aspects. First, the steady flow does not have any temporal discretization error, while the unsteady flow does and the temporal discretization error should be quantified. Second, the order of the spatial discretization error can be different from the order of the temporal discretization error; therefore, attention should be paid to ensure these two errors are in the same order if possible. For some explicit schemes, it is difficult to use a large time-step size due to the numerical stability constraints. Due to this reason, implicit time marching schemes may be required. Also, usually different primitive variables for the Euler/Navier–Stokes equations may have different frequencies in time, and a common time-step size may not guarantee the spatial discretization errors be close to the temporal discretization errors for all variables. The subiterative error and round-off error need to be driven down small enough compared to the discretization error, in order to obtain convincing results.
Spatial Discretization Error.
where r represents the mesh refinement factor of one mesh over the other. Note that this refinement factor r is assumed to be the same in all spatial directions (as well as in time for unsteady flows).
Temporal Discretization Error.
where q is the formal order of accuracy for the temporal discretization error (temporal DE).
Spatial and Temporal Discretization Error.
A more complicated form of the overall discretization error has spatial-temporal mixed terms [53], which is not considered in this paper, as the feature only exists for some specific schemes.
It should be mentioned that the temporal discretization error may be much smaller compared to the spatial discretization error for some unsteady problems, so attention should be paid to ensure that it does not adversely affect the final observed order of accuracy [5]. The temporal domain can be regarded as one extra dimension to the spatial domain, requiring a reasonable time-step size so that the temporal discretization error is of a similar order to the spatial discretization error.
Results
We tested several cases in this work, including 2D Euler convecting vortex flow, 2D Taylor–Green vortex flow, and cross-term sinusoidal (CTS) manufactured solutions. Both the steady and unsteady solutions for CTS are considered for the purpose of verification of the steady/unsteady solvers in SENSEI. All the test cases were run on a Dell Precision 5820 with an Intel Xeon Processor W2265 12 C 3.5 GHz 4.8 GHz Turbo-HT 19.25 MB (165 W) DDR4-2933, with 128 GB 8 × 16 GB DDR4 ECC (Error correction code). It should be noted that mesh refinement of a 3D unsteady case is easily stuck in an out of memory issue since we need to refine the mesh in all three dimensions, and unsteady cases need more memory space to store intermediate step results, only 2D cases are used for unsteady flow verification. SENSEI can output different norms including L1, L2, and norms, but their behaviors are quite similar for the test cases in this work so we will only show L norms.
Two-Dimensional Euler Convecting Vortex Flow.
where (x0, y0) is the vortex center, , β is the vortex strength, and γ is the ratio of specific heats. For the Euler case in this work, β = 5, , with . Therefore, this problem has a Mach number of 2.54. The reference values are unrealistic but it does not matter as the OOA test does not require realistic solutions. The domain of interest is . The initial vortex center is at (5,0). Periodic boundaries are applied for the four faces.
As discussed earlier, proper time-step sizes should be determined so that the temporal discretization errors are of similar orders as the spatial discretization errors. Although SENSEI applies nondimensionalization to keep different equations on a similar order of magnitude, errors for different primitive variables are still likely to be not similar. A global consideration for the time-step size should be seriously taken. For this 2D Euler convecting vortex flow, a systematic separate OOA study is performed to determine a proper time-step size before a combined OOA study. The nondimensional discretization errors of the density and u velocity component applying the SDIRK 2 scheme are given in Fig. 1. It can be seen that a good nondimensional time-step size on the 128 × 128 mesh is about 0.025 (since , the dimensional time-step size is 0.025 s), since similar orders of magnitude reductions can be achieved as the time-step is coarsened (moving to the right on the 128 × 128 curve) and as the mesh is coarsened (moving from the 128 × 128 curve to the 64 × 64 curve at the same dt = 0.025). However, due to the fact that Newton’s iteration requires the time-step size to be small to be stable, a nondimensional time-step size of 0.0125 is used, which will make the temporal discretization error smaller than the spatial discretization error, but they still have the same order of magnitude. When refining systematically in the combined order analysis, time-step sizes on other levels of meshes can be easily derived. Figure 2 shows the nondimensional error contours at with on the 128 × 128 mesh. The largest errors occur near the convecting vortex center (), which is reasonable. The error contour plots can help detect potential implementation issues if there are some strange behaviors in the OOA test.
Figures 3 and 4 show the combined OOA results of applying the SDIRK 2 scheme and the three point backward scheme( on the 128 × 128 mesh), respectively. For both schemes, an observed order of around 2 is achieved for all primitive variables if the refinement is enough, indicating the implementation should be correct. However, there are some discrepancies. First, the SDIRK 2 scheme has lower discretization errors compared to the three point backward scheme, which is expected as SDIRK 2 has more intermediate stages than three point backward. However, SDIRK 2 requires more memory space. Second, their behaviors for the OOA plots are different on coarse meshes, which suggests that SDIRK 2 enables a larger time-step size to balance the spatial and temporal discretization error, since the OOA is higher than 2 using SDIRK 2 on coarse level meshes. This 2D Euler convecting vortex flow can also be used to justify the correct implementation of the Euler solver and periodic boundary condition in SENSEI.
Two-Dimensional Taylor–Green Vortex.
where , Re is the Reynolds number, M is the Mach number, and R is the gas constant. For this laminar flow case, . A case using Reynolds number of 1 and Mach number of 0.027 is tested. In fact, other configurations are also tried and show similar behavior. The domain of interest is , which is one period spatially. Dirichlet boundaries are applied for the four boundaries. Note that the pressure term decays faster compared to the velocity terms, so attention may be needed when choosing the time-step size.
The first thing to verify an unsteady case is to determine a proper time-step size. Figure 5 shows the separate order analysis results for the pressure and density (Re = 1). It can be seen that a good nondimensional time-step size on the 256 × 256 is around 0.7. However, still being subject to the stability constraints of Newton’s iterative method, a nondimensional time-step size of 0.375 is used. This implies that the temporal discretization error is smaller than the spatial discretization error but their difference is not large (still in the same order). Similarly, when refining or coarsening systematically, time-step sizes on other levels of meshes can be easily calculated.
Figure 6 shows the dimensional solution contours obtained at . The units for the pressure and u velocity contours are Pa and m/s, respectively. The decaying factors for the pressure and u velocity component at are 0.28 and 0.53, respectively, where is the nondimensional time (dimensional time t over ). Figure 7 shows the nondimensional error contours for the pressure and u velocity component at . For the pressure, as it damps out 72% of its initial amplitude, larger errors only exist near the boundaries. In contrast, the u velocity has larger regions with large errors. The errors look reasonable with no strange behaviors shown. One interesting thing we found about this case is that on the coarsest mesh (8 × 8), only one time-step is used to iterate to the final time-step, since there is enough viscosity (Re = 1) to guarantee a stable iterating process.
Figure 8 shows the OOA results of applying the SDIRK 2 scheme. For this case, the nondimensional discretization errors for the u and v velocity are quite close so their lines in Fig. 8 are highly overlapped. It is surprising to see that the discretization errors drop faster than second-order on some intermediate levels of mesh, and it causes the OOA to reduce on fine meshes. The overall observed OOA for the pressure and density variables are around 1.5, which is not perfect. One reason of this order reduction may be that the temporal discretization errors of SDIRK 2 are still smaller than the spatial discretization errors on the meshes of 64 × 64 and 128 × 128, and then return to comparable order of magnitude when refining further. Another potential reason would be that some components of the discretization errors of SDIRK 2 for this case have opposite signs on some intermediate meshes and causes the order increase on these meshes. It can be seen from Fig. 8 in which the line connecting the 32 × 32 and 256 × 256 points directly are close to second-order slope, especially taking into account that we use consecutive data points to calculate the OOA, instead of using a base data point as the reference. The 2D Taylor–Green vortex case is used to verify the NS implementation in SENSEI.
Cross-Term Sinusoidal Manufactured Solutions.
where ai are coefficients (mean flow and turbulence equations use different coefficients). For the manufactured solution, , which has a Reynolds number of 500 and a Mach number of 0.15. We run all cases to a final time of so that we can have enough variations in time. In our tests, the coarsest mesh has eight cells in each dimension of a curvilinear domain of about . For unsteady CTS, we choose the coefficients a21 intentionally so that is the same order as or , or equivalently is the same order as . Our choice ensures that the variations in space and time are similar. We will apply a separate order analysis to further show the discretization errors are similar in space and time.
Steady-State Cross-Term Sinusoidal Method of Manufactured Solution.
For the turbulence model implementation verification in SENSEI, the first thing to do is verify steady-state flows. The 3D steady-state manufactured solutions for some of the primitive variables in the Menter’s SST model are shown in Fig. 9. For the steady-state cases, since temporal schemes do not affect the verification results as the final solution is steady-state, only results using Euler implicit are shown for the steady-state CTS MMS. The Reynolds number for this CTS MMS case is about 78 × 106 (low Reynolds numbers range from 5000 to 7000 are also tried and show similar behavior). If a lower dimension problem is solved then the relevant coefficients are set to 0. The grid size in the paper ranges from to (d is the dimension, i.e., two for 2D and three for 3D).
Prior to verifying Menter’s SST models in SENSEI, we have already tested the SA model implementation by comparing to some published results and using CTS MMS. The relevant results can be found in Ref. [33]. In this work, the observed order of accuracy results for the 2D and 3D Menter’s SST models are given in Fig. 10. For both the 2D and 3D CTS MMS cases, the values for the turbulent kinetic energy and turbulent eddy dissipation rate are chosen carefully so that the turbulent eddy viscosity has the same order O(1) as the viscous kinematic viscosity. Although the chosen value of the turbulent eddy viscosity and the viscous kinematic viscosity is , which is much higher than the actual value (about ), the purpose here is to make the influence of the mean flow and turbulent flow approximately equal to verify the two systems together. Note that it is only for the code verification purpose. Actually, it is easier to converge the MMS cases using a physical value (e.g., ) for the viscosity than using a nonphysical value (e.g., ). Also, the observed order of accuracy using the physical value for the viscosity is still near two on the 2D and 3D CTS MMS cases. For the turbulent kinetic energy and turbulent eddy dissipation rate, the observed OOA is slightly greater than 2 on fine meshes for the 2D case, which may imply that some components of the discretization errors are canceled out. The Reynolds number for the 2D case and the 3D case shown are about 5600 and 7000, respectively. For the 3D Menter’s SST, the grid size of 2563 is not applicable as it encounters an out of memory issue. The steady-state turbulent CTS MMS is used to verify the steady-state turbulent flow implementation in SENSEI.
Unsteady Cross-Term Sinusoidal Method of Manufactured Solution.
For unsteady solutions, because different primitive variables have different periodic frequencies (their largest difference may be five times, still less than an order of magnitude), different primitive variables have different magnitudes of temporal discretization errors. Similar to what we have done earlier in this work for the unsteady Euler and laminar NS test cases, we need to find a proper time-step size for all variables on a given mesh and then coarsen or refine to get time-step sizes on other meshes. Figure 11 shows a systematic separate order analysis for the pressure variable and u velocity component using the SST turbulence model. It can be seen that on the 256 × 256 mesh, a dimensional time-step size of s is reasonable to guarantee that the temporal discretization errors are of the same order of magnitude as the temporal discretization errors for both variables. Coarsening the mesh to the 8 × 8 level, we can obtain the coarsest time-step size to be .
Figure 12 shows the 2D CTS OOA results using the Menter’s SST model. After enough refinement, the OOA is close to second-order for all the primitive variables. It is not surprising to see that the ω variable performs poorly on some intermediate meshes, but eventually improves to be second-order accurate on finer meshes. In this OOA test, some components of the discretization errors may cancel out each other because having the opposite signs or boost each other because having the same sign, and this causes the OOA oscillates between the 1.5 and 2.0 range. This behavior is related to the specific values in the CTS MMS and can disappear with some other values. This CTS MMS is used to verify the Menter’s SST model implementation in SENSEI.
For the SA model, since the 1024 × 1024 mesh cannot be fully converged in the Newton’s iteration when using the same time-step size as the Menter’s SST model, we reduced the time-step sizes by 37.5% (now using 0.625 of the time-step size for the Menter’s SST model), which will make the temporal discretization errors smaller but still comparable to the spatial discretization errors. Figure 13 shows the OOA results using the SA model. For all the variables, the OOA is close to second-order when sufficiently refined. This SA CTS MMS is used to verify the SA turbulence implementation in SENSEI.
Figure 14 shows the nondimensional error contours using the SA model at with a prescribed s on the 256 × 256 mesh. It can be seen that the errors are uniformly distributed in the whole domain for both the u velocity component and the turbulence working variable.
Conclusions
In this work, the SENSEI compressible flow solver was verified using the cross-term sinusoidal manufactured solutions and a few exact solutions. For all the solution verification cases presented in this work, fairly good observed order of accuracy results were obtained for the discretization error. Based on the results for all the test cases in this work, we believe that both the temporal and spatial terms for the Navier–Stokes equations (laminar or turbulent) have been implemented correctly in SENSEI. Based on the results in this work, we want to remind that special attention should be paid so that the temporal discretization errors are of the same order as the spatial discretization errors. When performing a systematic OOA test for unsteady flow solutions. Otherwise, some implementation errors for the temporal terms may not be easily found because the temporal discretization errors are usually smaller for general cases.
Acknowledgment
This material is partially based on research sponsored by the U.S. Air Force.
Funding Data
U.S. Air Force (Agreement No. FA865019-2-2204; Funder ID: 10.13039/100006831).
Data Availability Statement
The datasets generated and supporting the findings of this article are obtainable from the corresponding author upon reasonable request.