{'fraction_non_alphanumeric': 0.03739153770462474, 'fraction_numerical': 0.013149655604257984, 'mean_word_length': 4.762886597938144, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Numerical aspects of wall-distance computation for turbulence modeling

Numerical aspects of the PDE-based approaches to computing the distance-function involved in many RANS models are discussed focusing on solving Eikonal equation written in advection-diffusion form. This approach is implemented and tested within the in-house structured multi-block general purpose CFD code. A technique which allows considerable increasing the robustness of the numerical procedure is proposed and tested on a set of generic 2D geometries (NACA4412 and 30P30N 3-element airfoils, backward-facing step) and more complex 3D configurations (Stanford diffuser and Common Research Model of commercial aircraft). It is shown that this technique permits to avoid convergence problems typically observed for the Eikonal-type equation and to compute the distance-function for all of the tested configurations. The results obtained show high efficiency of the technique and its potential for turbulence computations of industrial flows.


Introduction
The closest distance from a considered field point to a solid surface is involved in formulation of many RANS turbulence models, including the "top-rated" SA [1] and SST [2] models. Hence, physically meaningful, computationally robust and efficient approaches to this distance definition are of high practical interest. Defining it geometrically is known to be computationally expensive, especially on moving meshes, and is not physically justified for turbulence modeling around sharp elements of aircrafts, cavities, trailing edges of airfoils, and thin wires [3]. For this reason the users of RANS turbulence models sometimes prefer to sacrifice high accuracy of the distancebased models and to employ the less accurate models (e.g. k − ε ) not containing the wall distance.
The methods relying upon partial differential equations (PDEs) and returning "effective wall distance" or "distance-function" rather than the "pure" geometric distance are known to have a higher potential in terms of both physics and numerics. However, numerical aspects of the PDEbased approaches are non-trivial and, as of today, no general guidelines are available ensuring the robust and accurate performance of such approaches for a wide range of geometries in different types of CFD codes.
In this work two types of PDE-based wall distance computations are considered, namely the ones based on solving the Poisson and Eikonal equations. We demonstrate that for the purpose of turbulence modeling, the Eikonal-based approach is preferable. However robustness and efficiency of numerical methods for wall distance computations based on the Eikonal equation are known to be rather sensitive to the initial conditions [3][4][5][6][7] and, in particular, the methods do not converge when the initial field is substantially different from the target solution.
To overcome the convergence problem, a technique we called "variable CFL number" is proposed to restore the convergence of the Eikonal equation independently of initial conditions. The technique is implemented and tested within the in-house structured multi-block general purpose CFD code of SPbPU "Numerical Turbulence Simulations" (NTS code [8]). The robustness of this technique is demonstrated based on a set of generic 2D and more complex 3D configurations: NACA4412 and 30P30N 3-element airfoils, backward-facing step, Stanford 3D diffuser, and Common Research Model of a commercial aircraft (CRM).

Approach based on Poisson equation
A Poisson-based approach proposed by Spalding [9] employs the solution of Poisson equation,∇ 2 φ = −1, for an auxiliary variable φ with homogeneous Dirichlet boundary condition φ = 0 on the solid walls and Neumann conditions on outer domain boundaries. Then, according to [10], the wall distance function may be then defined as: or similarly to [11] as: An advantage of the latter being that it does not involve absolute values. Although solution of the Poisson equation needed for finding distance-function is generally straightforward, the resulting distance fields to be non-smooth and have singularities for some aerodynamic configurations (see section 5). For this reason in the current work another approach which is based on solution of the Eikonal equation is considered.

Approach based on Eikonal equation
Employing the Eikonal-type equations in the context of the wall-distance function definition was investigated in many studies (see, e.g., [3][4][5][6][7]). Here we consider a generalized form of the Eikonal equation: where d is the wall-distance function, and α is the "diffusion" coefficient . The latter typically is set to 1.0 but other values can also be used. The boundary conditions for equation (3) are imposed as follows: at the solid walls, the homogeneous boundary condition d = 0 is used, and at the other boundaries (inflow and outflow boundaries of internal flows and the far-field boundaries of external flows) the Neumann condition is adopted.
Introducing the diffusion term in the Eikonal equation results not only in the distance function suitable for turbulence modeling but also improves stability of the solution procedure [4,6]. However, the distance field is α dependent and no guidelines on its optimal choice in terms of physics and numerics are available in the literature. In this work different configurations were considered, and the value of 0.2 was found to be an optimal.

Implementation of the Eikonal-based approach in NTS code
The semi-discrete form of equation (3) is obtained by its linearization with use of Picard method and 1 st -order backward implicit time-integration scheme: where U n denotes the quantity ∇ d n , δ d = d n+1 − d n , R = 1 − U n · ∇ d n + α d n ∆ d n , operators ∇ and ∆ are the discrete analogs of the gradient and Laplace operators respectively. The convective and diffusion terms in equation (4) are approximated with 1 st -order upwind scheme and 2 nd -order CD scheme, respectively. The step of time-integration may be global or local, i.e., defined by a specified global CFL number (a free parameter) and minimum local grid spacing, ∆ min : δt = CFL · ∆ min . At each time step the solution is "under-relaxed", i.e. d n+1 = d n + σδ d, where σ value is typically set to 0.8. The system of linear discrete equations equation (4) is solved with use of the ILU preconditioned (ILU-p) BICGSTAB solver being a part of the Library of Iterative Solvers (LIS, http://www.netlib.org/misc/lis/) until achieving 10 5 times drop of the tolerance level. The solution is considered as converged when the L 2 norm of the right hand side of equation (4) is less than 10 −6 .

Variable CFL number
Clearly, having an algorithm which converges independently on the initial conditions and CFL number is very desirable. Several ways to achieve this had been tried, and one of them, namely, the use of the CFL depending on the number of time step n turned out to be successful. The specific function CFL = ψ(n, CFL max ) is as follows: with the default values of the constants CFL min = 0.5 , N min = 3 , N max = 6 and some CFL max value. Example of thus defined CFL = ψ(n, CFL max ) is shown in figure (3). CFL max = 100 was found to be adequate value and is set fixed for all the considered configurations. Robustness of this approach is confirmed by results of computations presented in the next section.

Results
Both the Poisson-and Eikonal-based approaches outlined above were applied to the computation of wall-distance functions for three 2D test cases and two 3D test cases: NACA4412 and three-element 30P30N airfoils, backward facing step, Stanford diffuser and CRM configuration (https://commonresearchmodel.larc.nasa.gov/).
As far as the Poisson-based methods are concerned, they are shown to be efficient and robust (probably exactly for this reason they are used in many commercial CFD codes). However, the wall-distance functions d p1 , equation (1), and d p2 , equation (2), computed with these methods have two serious deficiencies illustrated by figure (1), as an example.
The first one consists in the singularity of the computed effective wall-distance function for the multi-body configurations, and the second flaw found in the present study shows up as nonsmoothness of the d p1 and d p2 fields in the regions with highly skewed grid cells, see figure (1), which presumably occurs because of the use of the CD scheme on such grids.
In contrast to this, as seen in the figure, for the Eikonal-based method no such problems have been found. However it is more demanding in terms of numerics. So the present study is

Effect of Variable CFL number
When zero initial conditions are used with some constant CFL number the convergence of equation (4) has been achieved only for the Backward Facing Step (BFS) and Stanford Diffuser (SD) configurations, whereas for the NACA4412 airfoil and 30P30N 3-element airfoils the solution does not converge in a substantial range of the CFL number (see figure (2(a)) and figure (2(b))).  Example of CF L(n) for CF L max = 100 In contrast to constant CFL number, the Variable CFL approach in equation (5), ensures convergence of equation (4) in the entire range of CF L max parameter independently on initial condition for all the considered configurations (see, e.g. figure (2)). As far as an optimal value of the CF L max is concerned, based on the perfomed computations it was found to be about 100. This value was used to compute the Eikonal-based distance fields in all the RANS computations, which results are presented in the next section.    = [0, 1; 1, 00]. It turned out that within the range of α = [0.1, 0.5] the corresponding RANS results are very close to those based on the geometric distance fields, see figure (4(c)) and figure (5).
Efficiency measurements performed in this work show that α = 0.2 is an adequate choice resulting in both accurate and efficient procedure for finding d in the wall-distance involving RANS models. Finally, using Variable CFL approach d field is successfully obtained around complex CRM configuration, the results obtained with SAQCR model based on d and d w are presented in figure (5).

Conclusions
Numerical aspects of the wall distance computations using Eikonal equation were considered. Contrary to the Poisson-based method, which is shown to have some solution deficiencies, the method permits to compute the distance fields physically meaningful for turbulence modeling. The Eikonal-based method typically sensitive to numerics and dependent on a diffusion coefficient α was considered. The method was deliberately tested on a series of RANS computations and an optimal value for the coefficient α = 0.2 was found. A Variable CFL approach ensuring convergence and robustness of the method independently of initial condition was presented. The robustness of the approach was demonstrated on a set of 2D geometries (NACA4412 and 30P30N 3-element airfoils, backward-facing step) and more complex 3D configurations (Stanford diffuser and Common Research Model of commercial aircraft). The results obtained show high efficiency of the approach and its potential for RANS computations of industrial flows.