Next Article in Journal
A Lie Group-Based Iterative Algorithm Framework for Numerically Solving Forward Kinematics of Gough–Stewart Platform
Previous Article in Journal
Strong Time-Consistent Solution for Cooperative Differential Games with Network Structure
Previous Article in Special Issue
Surface Diffusion by Means of Stochastic Wave Functions. The Ballistic Regime
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Code for Simulating Heat Transfer in Turbulent Channel Flow

by
Federico Lluesma-Rodríguez
,
Francisco Álcantara-Ávila
,
María Jezabel Pérez-Quiles
and
Sergio Hoyas
*
Instituto Universitario de Matemática Pura y Aplicada, Universitat Politècnica de València, 46022 València, Spain
*
Author to whom correspondence should be addressed.
Mathematics 2021, 9(7), 756; https://doi.org/10.3390/math9070756
Submission received: 28 February 2021 / Revised: 28 March 2021 / Accepted: 30 March 2021 / Published: 1 April 2021

Abstract

:
One numerical method was designed to solve the time-dependent, three-dimensional, incompressible Navier–Stokes equations in turbulent thermal channel flows. Its originality lies in the use of several well-known methods to discretize the problem and its parallel nature. Vorticy-Laplacian of velocity formulation has been used, so pressure has been removed from the system. Heat is modeled as a passive scalar. Any other quantity modeled as passive scalar can be very easily studied, including several of them at the same time. These methods have been successfully used for extensive direct numerical simulations of passive thermal flow for several boundary conditions.
Keywords:
DNS; CFD; turbulence

1. Introduction

Turbulence is probably the open problem in physics with most applications in daily life. Turbulent flows are intrinsic to almost any flow in engineering, but they are also extremely important in meteorology or the dispersion of contaminants. It is well known that we still even lack an existence and uniqueness theorem about the solution of the governing equations of turbulent flows, the Navier–Stokes equations. Moreover, these equations cannot be solved analytically apart from some trivial examples. It is generally admitted that the simulation can be considered at three levels of detail, Reynolds Average Navier Stokes (RANS), Large Eddy Simulation (LES), and Direct Numerical Simulations (DNS) [1] which also corresponds to different levels of precision. Both RANS and LES models can simulate typical industrial flows with the necessary accuracy and in practical computation times [2,3,4,5], but DNS is until now the only trustworthy method to investigate physical properties of flows which are little understood.
However, DNS are extremely expensive as every scale of turbulence, both temporal and spatial ones, has to be properly resolved. This implies very fine grids and small temporal steps. Moreover, and as a consequence of Kolmogorov’s scales, [6,7], the number of points needed to carry out the simulation grows extremely fast, as R e 9 / 4 , where R e is the Reynolds number. Thus, to use DNS to understand turbulent flows, very simple geometries are employed, allowing very precise and fast numerical tools that will be described in this paper. Canonical wall-bounded flows are pipes, channel flows, and the flat-plate boundary layer. These flows are in essence theoretical abstractions and do not appear as such in reality. However, they constitute the basic blocks of more complete real flows and have been studied for 80 years. For isothermal flows, experiments of these canonical flows have been instrumental in the development of the theory since the birth of boundary layer research. In particular, they remain important for the study of very high Reynolds numbers, as DNS is still not able to reach Reynolds numbers as high as those of experiments. High Reynolds numbers are needed to obtain a clear separation of scales related to the near-wall turbulence cycle. The main control parameter is the friction Reynolds Number R e τ = h u τ / ν , where ν is the viscosity, h is a characteristic length and u τ is the friction velocity at the wall. The largest experiment ever done has been published in 2018 for a friction Reynolds number of 2e4 [8], a value that is absolutely out of reach for DNS. That said, simulations of wall-bounded turbulence are particularly helpful in identifying physical processes occurring in near-wall turbulence as the whole velocity field (and its derivatives) is available. Moreover, experiments showing the 3D thermal field of a turbulent flow are almost impossible to do. For thermal flows, DNS can give insight where experimental flows are impossible.
The first wall-bounded simulation was run by Kim, Moin, and Moser in 1987 [9] for channel flows and in 1988 by Spalart [10] for Turbulent Boundary Layers. Since then, the friction Reynolds number simulated has been continuously growing [11,12,13,14,15,16,17,18,19]. Some of these simulations, Refs. [12,16,18,19] were made with an earlier version of this code. The history is similar for thermal passive flows, but the Reynolds number reached grew up at a slower pace. The first DNS of a thermal flow was carried out by Kim and Moin in 1987 [20]. Kim and Moin obtained first-order turbulence statistics for R e τ = 180 and several Prandtl numbers, P r = 0.1 , 1 and 2. The Prandtl number is the ratio between momentum diffusivity to thermal diffusivity. They also computed a very important number for modeling, the turbulent Prandtl number. In addition, for the Prandtl number of air, P r = 0.71 , correlations between the velocity and the temperature were also calculated. A somewhat artificial boundary condition was imposed in which heat was generated internally and removed from both cold isothermal walls. This condition for the thermal field plays an analogous role to that of the pressure gradient does for the velocity field. Later, Lyons et al. [21] performed a simulation for R e τ = 150 and P r = 1 . The boundary condition used in this later work consisted of both walls kept at different temperatures. Finally, Kasagi et al. [22] performed a DNS for R e τ = 150 and P r = 0.71 with a more realistic boundary condition, the Mixed Boundary Condition (MBC from now on). For this condition, the average heat flux over both heating walls is constant and the temperature increases linearly in the streamwise direction. The instantaneous heat flux may vary with respect to time and position. In the work done by Piller [23], it was shown that the MBC acts as an ideal isothermal boundary condition in the inner layer and as an ideal isoflux boundary condition (fixed heat flux) in the outer layer.
After these simulations were made, the trend has been to increase the friction Reynolds number for different molecular Prandtl numbers. However, values of R e τ and P r are limited by the computational cost. Yano and Kasagi [24] stated that the computational cost can be approximated as L x 2 L y R e τ 4 P r 3 / 2 . Moreover, even if only one equation has to be added to the system, this equation is also nonlinear. Typically, the cost of accurately computing the nonlinear term accounts for 80 to 90 % of the total time of the simulation. Thus, to add the energy equation we need to double the computational time, and the Reynolds number achieved is still low for the majority of Prandtl numbers.
In this paper, we will restrict ourselves to explain the numerical code and its implementation. Since 2018, several works have been published using this algorithm, which was written in Fortran90. In Lluesma et al. [25], the authors validated the code and found the optimal size of the computational box for Reynolds numbers up to R e τ = 2000 . The range of Prandtl numbers, below P r = 0.7 , was increased in Alcántara-Ávila [26]. Later, in [27], the large structures of Couette flow were analyzed. In [28,29], the authors were able to increase the study for P r > 0.7 , reaching P r = 10 , and R e τ = 5000 for P r = 0.7 . Finally, this code has been used to study the large structures found in stratification problems, cite [30].
The structure of the paper is as follows. In the next section, the numerical problem is described. The third section is devoted to explain the numerical techniques used for discretization both in time and space. The fourth section describes the parallelization techniques used. Finally, conclusions and future works are outlined.

2. Methods

The flow considered in this work is a turbulent channel flow driven by a pressure gradient (Poiseuille flow). The flow is treated as incompressible. The thermal field is treated as a passive scalar. As mentioned before, the boundary condition used for the thermal field is the MBC. For this boundary condition, an uniform heat flux is heating both walls, which introduces the heat into the flow. The temperature of these walls increases linearly in the streamwise direction and does not depend on time.
In Figure 1, a schematic representation of the lower half of the computational box used can be observed. In this plot, contours of an instantaneous snapshot of the streamwise velocity are represented, colored by the magnitude of the velocity. The flow moves from left to right. Periodic conditions are imposed in the streamwise and spanwise boundaries.
As it was said above, the computational box was optimized in [25]. The dimensions of the box are L x = 2 π h , L y = 2 h , and L z = π h in the streamwise, wall-normal, and spanwise directions, respectively. Coordinates in these directions are denoted by x, y , and z. The corresponding velocities are U, V , and W, or, using index notation, U i . This is also the case for vorticity, Ω = × U = Ω 1 , Ω 2 , Ω 3 = Ω x , Ω y , Ω z and helicity H = U × Ω = H 1 , H 2 , H 3 = H x , H y , H z . Temperature is represented by T. However, the transformed temperature, Θ (defined below), will be used during the entire paper. Uppercase letters denote instantaneous flow magnitudes. Using the Reynolds decomposition, one can obtain the averaged value, denoted by an overbar, and the fluctuating part, denoted by a lowercase letter, of the flow magnitudes, i.e., U = U ¯ + u . The superscript + indicates normalization in wall units, using ν and u τ = τ w / ρ , where τ w is the mean shear stress and ρ is the fluid density.
The behavior of turbulent flows is described by the Navier–Stokes equations, which are composed by the continuity and momentum equations,
j U j + = 0 ,
t U i + + U j + j U i + = i P + + 1 R e τ j j U i + ,
and the energy equation,
t Θ + + U j + j Θ + = 1 R e τ P r j j Θ + + U + / U + x y z ,
where U + x y z is the average of U + in time and in the three spatial directions, i.e., U + x y z = U b + , where U b + is the bulk velocity. In the energy equation, the transformed temperature, Θ = T w T is used. Since the MBC is used, the temperature in the channel increases linearly in the streamwise direction and periodic conditions cannot be used for T. T w contains the nonperiodic part of the temperature, which makes Θ periodic in the streamwise direction. Notice that the method described below is also useful for any other passive scalar, as it could be NOx concentration. It is also important to point out that for clarity, only the system with one energy equation will be explained here. However, as heat transfer is treated as a passive scalar, several different Prandtl numbers can be run simultaneously. In what follows and to facilitate the discussion, + superscripts will be omitted.
Using some algebra, which involves taking the rotational of Equations (1) and (2) twice, these equations can be written in velocity-vorticity form obtaining a fourth-order equation for V
t 2 V = h v + 1 R e τ 4 V ,
and a second-order equation for Ω y
t Ω y = h g + 1 R e τ 2 Ω y ,
where h v and h g collect the nonlinear part of the Equations (4) and (5), and are given by
h v = y x H 1 + z H 3 + x x + z z H 2 , h g = z H 1 x H 3 ,
The main advantage of this system is that pressure is not present, simplifying the problem. Notice that one can easily recover velocities and vorticities from the continuity equation and the definition of Ω y ,
x U + z W = y V ,
z U x W = Ω y ,
Taking derivatives,
x x U + z W + z z U x W = x y V + z Ω y ,
z x U + z W x z U x W = z y V + x Ω y ,
and reorganizing the terms, we get
( x x + z z ) U = y x V + z Ω y ,
( x x + z z ) W = y z V x Ω y .
As the flow is periodic in both x and z , it is natural to use Fourier methods in these directions. The Fourier transform of any field φ x , y , z is defined as
φ x , y , z = k x k z φ ^ k x k z y e i k x x + k z z ,
where the hat indicates the Fourier coefficient, and k x and k z are the wavenumbers in x and z , respectively. Equations (10) and (11) can be trivially solved as they become
U ^ k x k z = i k x y V ^ k x k z + i k z Ω ^ y ( k x 2 + k z 2 ) ,
W ^ k x k z = i k z y V ^ k x k z i k x Ω ^ y k x k z ( k x 2 + k z 2 ) .
Notice that this technique cannot be used for the 0 , 0 -modes of U and W . Using the Navier–Stokes equations, one can write
t U ^ 00 = x P ^ + H ^ 1 , 00 + 1 R e τ y y U ^ 00 , t W ^ 00 = z P ^ + H ^ 3 , 00 + 1 R e τ y y W ^ 00 ,
and solve these equations instead. The pressure gradient in the spanwise direction is negligible. However, the pressure gradient in the streamwise component can be used to keep the flow mass constant. Using Fourier transforms, Equations (3)–(5) are transformed into Fourier space in x and z, obtaining three decoupled problems,
t ϕ ^ k x k z = h ^ v , k x k z + 1 R e τ 2 ϕ ^ k x k z ,
2 V ^ k x k z = ϕ ^ k x k z ,
V ^ k x k z ± 1 = 0 , y V ^ k x k z ± 1 = 0 ,
t Ω ^ y , k x k z = h ^ g , k x k z + 1 R e τ 2 Ω ^ y , k x k z ,
Ω ^ y k x k z ( ± 1 ) = 0 ,
t Θ ^ k x k z = h ^ t , k x k z + 1 R e τ P r 2 Θ ^ k x k z ,
Θ ^ k x k z ( ± 1 ) = 0 ,
where h ^ t , k x k z is the Fourier transform of the energy equation nonlinear term.
Problem (14)–(16) is usually solved splitting V ^ k x k z in three parts, (wavenumbers are omitted)
V ^ = V ^ p + a V ^ a + b V ^ b ,
where a and b are chosen in order to fulfill the homogeneous Neumann condition:
t ϕ ^ p = h ^ v R e τ 1 k x 2 + k z 2 y y ϕ ^ p , ϕ ^ p ± 1 = 0 , k x 2 + k z 2 y y V ^ p = ϕ ^ p , V ^ p ± 1 = 0 ,
t ϕ ^ a = R e τ 1 k x 2 + k z 2 y y ϕ ^ a , ϕ ^ a ± 1 = 0 , k x 2 + k z 2 y y V ^ a = ϕ ^ a , V ^ a 1 = 1 , V ^ a 1 = 0 ,
t ϕ ^ b = R e τ 1 k x 2 + k z 2 y y ϕ ^ b , ϕ ^ b ± 1 = 0 , k x 2 + k z 2 y y V ^ b = ϕ ^ b , V ^ b 1 = 0 , V ^ b 1 = 1 ,
and
t Ω ^ y , k x k z = h ^ g R e τ 1 k x 2 + k z 2 y y Ω ^ y , k x k z , Ω ^ y ± 1 = 0 ,
t Θ ^ k x k z = h ^ t ( R e τ P r ) 1 k x 2 + k z 2 y y Θ ^ k x k z , Θ ^ k x k z ± 1 = 0 ,
although, due to the symmetry of the problem, V ^ b y = V ^ a y , so only Equations (21), (22), (24) and (25) have to be solved. Notice that 3D PDE have been transformed into N x × N z independent problems.

3. Numerical Method

3.1. CFD Techniques

As it is said above, Fourier method in x and z is the best option to solve this problem. This, in fact, decouples the problems (21)–(25) in a large amount of problems in y. The numerical technique used for y is thus critical to obtain an accurate and fast algorithm. This kind of problem had been addressed mostly by spectral methods [9,31]. A typical technique used in channels is Chebyshev polynomials [11,32]. This has also been applied to thermoconvective problems [33,34,35]. However, in this case, it is more efficient the use of Compact Finite Differences, CFD. The CFD method was introduced in a groundbreaking article by SK Lele in 1992 [36]. Lele’s idea was to use finite differences to solve problems presenting a range of spatial scales, generalizing some Padé schemes that had been used early [37,38]. Lele’s CFD main advantage is that maintaining the freedom in choosing the mesh points of typical finite difference methods (FD), offering very high precision, comparable to spectral methods. This is critical in turbulent problems, as one typically needs many more points close to the wall than in the outer regions of the flow.
Throughout this part of this work, the following notation is going to be used. Let u ( y ) be a real evaluated function. Supposing that u is differentiable enough, the first and second derivative of u at the point y i will be denoted by u i = u ( y i ) and u i = u ( y i ) . In the case of a derivative of grade n, we will use u i n ) = d n d y n u ( y i ) . Here, y i is a point belonging to a certain discretization of the interval [ a , b ] , where a and b are finite and y 0 = a , y n = b . Without loss of generality, we will focus on schemes for the second derivative. FD schemes aim to compute an approximation of u i trough a linear combination of the values of the function close to y i . CFD, instead, relates a linear combination of the second derivatives with the values of the function. To explain the practical use of CFD schemes, we are going to work with one specific example, the scheme used in [29]. In that work, the authors used a stencil of seven points in the function and five in the second derivative. Let us assume that the following relation holds
α i 2 u i 2 + α i 1 u i 1 + α 0 u i + α i + 1 u i + 1 + α i + 2 u i + 2
= a i 3 u i 3 + a i 2 u i 2 + a i 1 u i 1 + a 0 u i + a i + 1 u i + 1 + a i + 2 u i + 2 + a i + 3 u i + 3 ,
for some unknowns coefficients, α j and a j . Without loss of generality, it is possible to assume that one of these coefficients is one, so from now on, α 0 = 1 . Defining h j = ( y i y i + j ) , Taylor’s Theorem states that
u i 3 = u i + h 3 1 ! u i + h 3 2 2 ! u i + + h 3 n n ! u i n ) + O h 3 n + 1 , u i 2 = u i + h 2 1 ! u i + h 2 2 2 ! u i + + h 2 n n ! u i n ) + O h 2 n + 1 , u i 1 = u i + h 1 1 ! u i + h 1 2 2 ! u i + + h 1 n n ! u i n ) + O h 1 n + 1 , u i = u i , u i + 1 = u i + h 1 1 ! u i + h 1 2 2 ! u i + + h 1 n n ! u i n ) + O h 1 n + 1 , u i + 2 = u i + h 2 1 ! u i + h 2 2 2 ! u i + + h 2 n n ! u i n ) + O h 2 n + 1 , u i + 3 = u i + h 3 1 ! u i + h 3 2 2 ! u i + + h 3 n n ! u i n ) + O h 3 n + 1 ,
and
u i 2 = u i + h 2 1 ! u i 3 ) + h 2 2 2 ! u i 4 ) + + h 2 n n ! u i n + 2 ) + O h 2 n + 1 , u i 1 = u i + h 1 1 ! u i 3 ) + h 1 2 2 ! u i 4 ) + + h 1 n n ! u i n + 2 ) + O h 1 n + 1 , u i = u i , u i + 1 = u i + h 1 1 ! u i 3 ) + h 1 2 2 ! u i 4 ) + + h 1 n n ! u i n + 2 ) + O h 1 n + 1 , u i + 2 = u i + h 2 1 ! u i 3 ) + h 2 2 2 ! u i 4 ) + + h 2 n n ! u i n + 2 ) + O h 2 n + 1 .
The relations between the coefficients a i and α i are derived by matching the Taylor series coefficients. In this case, the formal truncation error of the approximation is tenth order. Translating this information into an algebraic equation leads to the system
0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 h 3 h 2 h 1 0 h 1 h 2 h 3 1 1 1 1 h 3 2 2 ! h 2 2 2 ! 1 h 1 2 2 ! 0 h 1 2 2 ! h 2 2 2 ! h 2 2 2 ! h 2 h 1 h 1 h 2 h 3 3 3 ! h 2 3 3 ! h 1 3 3 ! 0 h 1 3 3 ! h 2 3 3 ! h 3 3 3 ! h 2 2 h 1 2 h 1 2 h 2 2 h 3 4 4 · 3 h 2 4 4 × 3 h 1 4 4 × 3 0 h 1 4 4 × 3 h 2 4 4 × 3 h 3 4 4 × 3 h 2 3 h 1 3 h 1 3 h 2 3 h 3 5 5 × 4 h 2 5 5 × 4 h 1 5 5 × 4 0 h 1 5 5 × 4 h 2 5 5 × 4 h 3 5 5 × 4 h 2 4 h 1 4 h 1 4 h 2 4 h 3 6 6 × 5 h 2 6 6 × 5 h 1 6 6 × 5 0 h 1 6 6 × 5 h 2 6 6 × 5 h 3 6 6 × 5 h 2 5 h 1 5 h 1 5 h 2 5 h 3 7 7 × 6 h 2 7 7 × 6 h 1 7 7 × 6 0 h 1 7 7 × 6 h 2 7 7 × 6 h 3 7 7 × 6 h 2 6 h 1 6 h 1 6 h 2 6 h 3 8 8 × 7 h 2 8 8 × 7 h 1 8 8 × 7 0 h 1 8 8 × 7 h 2 8 8 × 7 h 3 8 8 × 7 h 2 7 h 1 7 h 1 7 h 2 7 h 3 9 9 × 8 h 2 9 9 × 8 h 1 9 9 × 8 0 h 1 9 9 × 8 h 2 9 9 × 8 h 3 9 9 × 8 h 2 8 h 1 8 h 1 8 h 2 8 h 3 10 10 × 9 h 2 10 10 × 9 h 1 10 10 × 9 0 h 1 10 10 × 9 h 2 10 10 × 9 h 3 10 10 × 9 α i 2 α i 1 α i + 1 α i + 2 a i 3 a i 2 a i 1 a i a i + 1 a i + 2 a i + 3 = 0 0 1 0 0 0 0 0 0 0 0 .
Please note that this is the direct matrix coming from matching Taylor’s expansions. Usually, this matrix is ill-conditioned, so results can be very inaccurate. A typical procedure to overcome this problem consists of normalizing each row by its absolute value maximum.
As the mesh can be nonuniform, it is necessary to solve this system for each point in the mesh. When approaching the boundaries, no ghost points are used but the stencils are adapted, removing the points which lay outside the interval. This reduces the formal truncation error of the system. Once the coefficients for every point have been computed, we obtain two sparse matrices, one containing the a i coefficients, A y y , and another one made by the α i coefficients, B y y , such that
B y y ( u 0 , . . . , u n ) t = A y y ( u 0 , . . . , u n ) t ,
where the superscript ( ) t denotes the transpose. Note that (28) can be used in both ways, to derive a function or to integrate it.

3.2. Time Discretization

To get good accuracy in reasonable computation times, a third-order Runge–Kutta method has been chosen, derived in [39]. For any problem with the form
t φ = L φ + N φ ,
where L is a linear operator and N is nonlinear, the equation is discretized as follows:
I β 1 Δ t L φ 1 = I + Δ t α 1 L φ 0 + Δ t γ 1 N 0 ,
I β 2 Δ t L φ 2 = I + Δ t α 2 L φ 1 + Δ t γ 2 N 1 + ξ 1 N 0 ,
I β 3 Δ t L φ 3 = I + Δ t α 3 L φ 2 + Δ t γ 3 N 2 + ξ 2 N 1 ,
with φ i = φ t i , for t n = t 0 , t 1 , t 2 , t 3 = t n + 1 . This method presents two problems. The first one is a problem of memory, due to the necessity of saving two nonlinear terms in steps two and three. The second problem is a possible loss of accuracy near the wall, due to the explicit computation of the linear operator in the right hand,
L i t φ 0 = I + Δ t α i L φ 0 .
Both problems are solved in the algorithm, using a little bit of algebra. Suppose that (30) is solved, and φ 2 is to be computed. Let us denote
R h 1 = I + Δ t α 1 L φ 0 + Δ t γ 1 N 0 ,
then
L φ 1 = φ 1 R h 1 β 1 Δ t ,
and we can compute and store in a single buffer of memory the right hand side of (31) except the nonlinear term N 1 . This tactic can be also applied in the computation of φ 1 but only in the cases where Δ t does not change. If the time step changes, the derivative of φ 0 has to be computed explicitly. To avoid this loss of accuracy, it is a good idea to recompute the maximum Δ t every few steps, using the Courant–Friedichs–Lewy condition
max U Δ t Δ x , V Δ t Δ y , W Δ t Δ z C F L .
The simulations made with this code ran with a CFL of 0.7 , showing remarkable stability.
Equations (30)–(32) are solved for ϕ , Ω y and Θ using CFD. In what follows we will work with the energy equation, given that the linear operator is L = R e τ 1 2 for ϕ and Ω y , and L = P r R e τ 1 2 for Θ . The operator L in Fourier space can be written as
L = ( R e τ P r ) 1 ( x x + y y + z z ) L ^ k x k z = ( R e τ P r ) 1 ( ( i k x ) 2 + ( i k z ) 2 + y y ) .
Denoting by R H S i the right-hand side of (30)–(32), this system becomes
I β i Δ t L φ i = R H S i .
In Fourier space, one gets
I β i Δ t k x 2 k z 2 + y y R e τ P r φ i = R H S i ,
I + β i Δ t k x 2 + k z 2 R e τ P r φ i β i Δ t R e τ P r y y φ i = R H S i ,
Now using the two matrix described in the CFD section (28), and defining η as the first constant of the previous equation,
η = I + β i Δ t k x 2 + k z 2 R e τ P r ,
we get
η φ i β i Δ t R e τ P r y y φ i = R H S ,
η B y y φ i β i Δ t R e τ P r B y y y y φ i = B y y R H S ,
η B y y φ i β i Δ t R e τ P r A y y φ i = B y y R H S .
Defining a new matrix M , as
M = η B y y β i Δ t R e τ P r A y y ,
the final problem to solve is
M φ i = B y y R H S .
Notice that this matrix is banded, which allows low-storage schemes and the use of very efficient LAPACK routines.

4. Parallelization Strategy

The most expensive part of the algorithm is the computation of the nonlinear terms h ^ v , h ^ g and h ^ t . This is because it is necessary to compute these terms in physical space, due to the aliasing problem [31]. Notice that there are two global operations:
  • Direct and inverse Fourier transforms in x and z, as the nonlinear term has to be computed in physical space.
  • Integration-derivation in y.
As the data is distributed throughout the supercomputer, it is necessary to perform several all-to-all communications, which are critical and extremely demanding of the fast network of the supercomputer. The code demands a total of c o m m = 3 × ( 9 + 3 h p ) global communications per step, where h p is the total number of heat transfer problems studied.
The number of points of the problem, and thus memory, depend on the Reynolds number studied. Another constraint is the efficiency of the fast Fourier transforms (FFT), so typically numbers made up of powers of 2 and 3 are chosen to increase the velocity of the FFT. Assuming a mesh with m x × m y × m z points, generally m x is the largest one. It is then natural to start each substep of the Runge–Kutta scheme with the data set distributed in yz planes. To avoid load imbalances, the number of nodes must be a divisor of the number of complex planes, which is m x / 2 after dealiasing. This number is also the maximum number of nodes that can be used. The maximum number of OpenMP processes at each node is m x / 2 / n p r o c s , where n p r o c s is the number of processors of the node.
The code to implement the algorithm described above, where Figure 2 can serve as roadmap, is as follows
  • Read data and configuration files: HDF5
  • Runge–Kutta, data: ϕ , Ω y and Θ , in Fourier Space, distributed through the supercomputer with a y , z , x shape.
    (a)
    Calculation of nonlinear terms (I). Time: 15% of total time
    • ϕ , Ω y U , Ω .
    • Compute statistical quantities of the flow if needed.
    • Change shape from y , z , x to z , y , x .
    • Perform inverse transforms in z of U and Ω .
    (b)
    Calculation on nonlinear terms (II). Time: 35% of total time
    • Global transposes: Data is moved trough all the machine, from yz planes into x-lines using MPI routines.
    (c)
    Calculation on nonlinear terms (III). Time:10% of total time
    • Perform inverse transforms in x of U and Ω .
    • Computes three technical buffers C i to compute later the nonlinear terms h ^ v and h ^ g . h t is computed here.
    • Perform direct transforms in x of U and Ω .
    (d)
    Calculation on nonlinear terms (IV). Time: 20% of total time
    • Global transposes: Data is moved trough all the machine, from x-lines into yz planes
    (e)
    Calculation on nonlinear terms (V). Time: 10% of total time
    • Perform direct transforms in z of C i and h t .
    • Change shape from z , y , x to y , z , x .
    (f)
    Solve viscous problem. This step requires 10% of total time.
    (g)
    Save data to disk if needed.
    (h)
    Move to the step 2a.
  • End of program.
The code spends 90% of the time and almost all communication time computing the nonlinear term and only 10% to actually solve the equations. A large share of this 90% is used to do global communications. This is a critical step and requires an in-deep study of the supercomputer where the simulation is going to run.
Finally, notice that while global communications uses MPI routines, the granularity of the code makes the use of OpenMP routines for the Fourier transforms, derivatives, and the viscous step. This is an important advantage due to the foreseen evolution of supercomputation.

5. Conclusions

The main goal of this work is to develop a code to perform direct numerical simulations of distinctive wall-bounded thermal canonical flows. This code has run for roughly 50 CPU-M hours in several supercomputers, already producing several articles. FFT and CFD techniques have been described—in particular, how to use a nonequispaced grid for CFD. In addition, the combination of the Runge–Kutta time-stepper and the previous techniques have been explained. Finally, the parallelization scheme has been outlined. Its main advantage is the granularity of the data, allowing a large amount of small problems in each step that can be solved efficiently using OpenMP techniques.
The raw data that support the findings of this study are available from the corresponding author upon reasonable request. One point statistics can be downloaded from the web page of our group: http://personales.upv.es/serhocal/ (accessed on 24 March 2021).

Author Contributions

Conceptualization, F.Á.-Á.; Data curation, M.J.P.-Q.; Formal analysis, F.L.-R., F.Á.-Á. and S.H.; Funding acquisition, S.H.; Investigation, S.H.; Methodology, F.L.-R.; Resources, M.J.P.-Q.; Software, F.L.-R., M.J.P.-Q. and S.H.; Validation, F.Á.-Á.; Visualization, F.Á.-Á.; Writing—original draft, S.H.; Writing—review & editing, F.Á.-Á. All authors have read and agreed to the published version of the manuscript.

Funding

This work was supported by RTI2018-102256-B-I00 of MINECO/FEDER. The computations of the new simulations were made possible by several generous grants of computing time from the Barcelona Supercomputing Centre, references FI-2018-1-0037, FI-2018-2-0021, FI-2018-3-0032, FI-2019-1-0025, IM-2019-2-2016, AECT-2020-1-0024, AECT-2020-2-0005.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Not applicable.

Acknowledgments

S.H. is deeply indebted and grateful to his students of the Master of Aerospace Engineering, Universitat Politècnica de València.

Conflicts of Interest

The authors declare no conflict of interest.

Abbreviations

The following abbreviations are used in this manuscript:
CFDCompact Finite Differences
DNSDirect Numerical Simulation
FDFinite Differences
FFTFast Fourier Transform
LESLarge Eddy Simulations
ODEOrdinary differential equation
PDEPartial differential equation
RANSReynolds Averaged Navier Stokes

References

  1. Pope, S.B. Turbulent Flows; Cambridge University Press: Cambridge, UK, 2000. [Google Scholar]
  2. Margot, X.; Hoyas, S.; Fajardo, P.; Patouna, S. A moving mesh generation strategy for solving an injector internal flow problem. Math. Comput. Model. 2010, 52, 1143–1150. [Google Scholar] [CrossRef] [Green Version]
  3. Margot, X.; Hoyas, S.; Fajardo, P.; Patouna, S. CFD study of needle motion influence on the exit flowconditions of single-hole injectors. At. Sprays 2011, 21, 31–40. [Google Scholar] [CrossRef]
  4. Escarti-Guillem, M.; Hoyas, S.; García-Raffi, L. Rocket plume URANS simulation using OpenFOAM. Results Eng. 2019, 4, 100056. [Google Scholar] [CrossRef]
  5. Lluesma-Rodríguez, F.; González, T.; Hoyas, S. CFD simulation of a hyperloop capsule inside a closed environment. Results Eng. 2021, 9, 100196. [Google Scholar] [CrossRef]
  6. Kolmogorov, A.N. Local structure of turbulence in an incompressible fluid at very high Reynolds numbers. Dokl. Akad. Nauk. 1941, 30, 9–13. [Google Scholar] [CrossRef]
  7. Kolmogorov, A.N. Dissipation of energy in isotropic turbulence. Dokl. Akad. Nauk. 1941, 32, 19–21. [Google Scholar]
  8. Samie, M.; Marusic, I.; Hutchins, N.; Fu, M.; Fan, Y.; Hultmark, M.; Smits, A. Fully resolved measurements of turbulent boundary layer flows up to Reτ = 20000. J. Fluid Mech. 2018, 851, 391–415. [Google Scholar] [CrossRef] [Green Version]
  9. Kim, J.; Moin, P.; Moser, R. Turbulence statistics in fully developed channels flows at low Reynolds numbers. J. Fluid Mech. 1987, 177, 133–166. [Google Scholar] [CrossRef] [Green Version]
  10. Spalart, P. Direct simulation of a turbulent boundary layer up to Rθ = 1410. J. Fluid Mech. 1988, 187, 61–98. [Google Scholar] [CrossRef]
  11. Moser, R.; Kim, J.; Mansour, N. Direct numerical simulation of turbulent channel flow up to Reτ = 590. Phys. Fluids 1999, 11, 943–945. [Google Scholar] [CrossRef]
  12. Hoyas, S.; Jiménez, J. Scaling of the velocity fluctuations in turbulent channels up to Reτ = 2003. Phys. Fluids 2006, 18, 011702. [Google Scholar] [CrossRef] [Green Version]
  13. Hoyas, S.; Jiménez, J. Reynolds number effects on the Reynolds-stress budgets in turbulent channels. Phys. Fluids 2008, 20, 101511. [Google Scholar] [CrossRef] [Green Version]
  14. Simens, M.P.; Jimenez, J.; Hoyas, S.; Mizuno, Y. A high-resolution code for turbulent boundary layers. J. Comput. Phys. 2009, 228, 4218–4231. [Google Scholar] [CrossRef]
  15. Lee, M.; Moser, R. Direct numerical simulation of turbulent channel flow up to Reτ ≈ 5200. J. Fluid Mech. 2015, 774, 395–415. [Google Scholar] [CrossRef]
  16. Lozano-Durán, A.; Jiménez, J. Effect of the computational domain on direct simulations of turbulent channels up to Reτ = 4200. Phys. Fluids 2014, 26, 011702. [Google Scholar] [CrossRef]
  17. Bernardini, M.; Pirozzoli, S.; Orlandi, P. Velocity statistics in turbulent channel flow up to Reτ = 4000. J. Fluid Mech. 2014, 758, 327–343. [Google Scholar]
  18. Avsarkisov, V.; Hoyas, S.; Oberlack, M.; García-Galache, J. Turbulent plane Couette flow at moderately high Reynolds number. J. Fluid Mech. 2014, 751, R1. [Google Scholar] [CrossRef]
  19. Kraheberger, S.; Hoyas, S.; Oberlack, M. DNS of a turbulent Couette flow at constant wall transpiration up to Reτ = 1000. J. Fluid Mech. 2018, 835, 421–443. [Google Scholar] [CrossRef]
  20. Kim, J.; Moin, P. Transport of Passive Scalars in a Turbulent Channel Flow; NASA: Ames Research Center: Moffett Field, CA, USA, 1987; Volume 1, pp. 1–14. [Google Scholar]
  21. Lyons, S.; Hanratty, T.; McLaughlin, J. Direct numerical simulation of passive heat transfer in a turbulent channel flow. Int. J. Heat Mass Transf. 1991, 34, 1149–1161. [Google Scholar] [CrossRef]
  22. Kasagi, N.; Tomita, Y.; Kuroda, A. Direct Numerical Simulation of Passive Scalar Field in a Turbulent Channel Flow. J. Heat Transf. 1992, 114, 598–606. [Google Scholar] [CrossRef]
  23. Piller, M. Direct numerical simulation of turbulent forced convection in a pipe. Int. J. Numer. Methods Fluids 2005, 49, 583–602. [Google Scholar] [CrossRef]
  24. Yano, T.; Kasagi, N. Direct numerical simulation of turbulent heat transport at high Prandtl numbers. JSME Int. J. Ser. B Fluids Therm. Eng. 1999, 42, 284–292. [Google Scholar] [CrossRef] [Green Version]
  25. Lluesma-Rodríguez, F.; Hoyas, S.; Peréz-Quiles, M. Influence of the computational domain on DNS of turbulent heat transfer up to Reτ = 2000 for Pr = 0.71. Int. J. Heat Mass Transf. 2018, 122, 983–992. [Google Scholar] [CrossRef]
  26. Alcántara-Ávila, F.; Hoyas, S.; Pérez-Quiles, M. DNS of thermal channel flow up to Reτ = 2000 for medium to low Prandtl numbers. Int. J. Heat Mass Transf. 2018, 127, 349–361. [Google Scholar] [CrossRef]
  27. Alcántara-Ávila, F.; Barberá, G.; Hoyas, S. Evidences of persisting thermal structures in Couette flows. Int. J. Heat Fluid Flow 2019, 76, 287–295. [Google Scholar] [CrossRef]
  28. Alcántara-Ávila, F.; Hoyas, S. Direct Numerical Simulation of thermal channel flow for medium–high Prandtl numbers up to Reτ = 2000. Int. J. Heat Mass Transf. 2021. submitted. [Google Scholar]
  29. Alcántara-Ávila, F.; Hoyas, S.; Pérez-Quiles, M. Direct Numerical Simulation of thermal channel fow for Reτ = 5000 and Pr = 0.71. Accept. J. Fluid Mech. 2021. [Google Scholar] [CrossRef]
  30. Gandía Barberá, S.; Alcántara-Ávila, F.; Hoyas, S.; Avsarkisov, V. Stratification effect on extreme-scale rolls in plane Couette flows. Phys. Rev. E 2021, 6, 034605. [Google Scholar] [CrossRef]
  31. Canuto, C.; Hussaini, M.Y.; Quarteroni, A.M.; Thomas, A., Jr. Spectral Methods in Fluid Dynamics; Springer Science & Business Media: Berlin/Heidelberg, Germany, 2012. [Google Scholar]
  32. Del Alamo, J.; Jiménez, J.; Zandonade, P.; Moser, R. Scaling of the energy spectra of turbulent channels. J. Fluid Mech. 2004, 500, 135–144. [Google Scholar] [CrossRef] [Green Version]
  33. Hoyas, S.; Herrero, H.; Mancho, A. Thermocapillar and thermogravitatory waves in a convection problem. Theor. Comput. Fluid Dyn. 2004, 18, 309–321. [Google Scholar] [CrossRef]
  34. Hoyas, S.; Gil, A.; Fajardo, P.; Pérez-Quiles, M. Codimension-three bifurcations in a Bénard-Marangoni problem. Phys. Rev. E Stat. Nonlinear Soft Matter Phys. 2013, 88, 015001. [Google Scholar] [CrossRef] [PubMed]
  35. Hoyas, S.; Fajardo, P.; Pérez-Quiles, M. Influence of geometrical parameters on the linear stability of a Bénard-Marangoni problem. Phys. Rev. E 2016, 93, 043105. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  36. Lele, S.K. Compact finite difference schemes with spectral-like resolution. J. Comput. Phys. 1992, 103, 16–42. [Google Scholar] [CrossRef]
  37. Orszag, S.A.; Israeli, M. Numerical Simulation of Viscous Incompressible Flows. Annu. Rev. Fluid Mech. 1974, 6, 281–318. [Google Scholar] [CrossRef]
  38. Rubin, S.; Khosla, P. Polynomial interpolation methods for viscous flow calculations. J. Comput. Phys. 1977, 24, 217–244. [Google Scholar] [CrossRef]
  39. Spalart, P.R.; Moser, R.D.; Rogers, M.M. Spectral methods for the Navier-Stokes equations with one infinite and two periodic directions. J. Comput. Phys. 1991, 96, 297–324. [Google Scholar] [CrossRef]
Figure 1. Geometry and instantaneous representation of the temperature field.
Figure 1. Geometry and instantaneous representation of the temperature field.
Mathematics 09 00756 g001
Figure 2. Parallelization scheme of the code.
Figure 2. Parallelization scheme of the code.
Mathematics 09 00756 g002
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Lluesma-Rodríguez, F.; Álcantara-Ávila, F.; Pérez-Quiles, M.J.; Hoyas, S. A Code for Simulating Heat Transfer in Turbulent Channel Flow. Mathematics 2021, 9, 756. https://doi.org/10.3390/math9070756

AMA Style

Lluesma-Rodríguez F, Álcantara-Ávila F, Pérez-Quiles MJ, Hoyas S. A Code for Simulating Heat Transfer in Turbulent Channel Flow. Mathematics. 2021; 9(7):756. https://doi.org/10.3390/math9070756

Chicago/Turabian Style

Lluesma-Rodríguez, Federico, Francisco Álcantara-Ávila, María Jezabel Pérez-Quiles, and Sergio Hoyas. 2021. "A Code for Simulating Heat Transfer in Turbulent Channel Flow" Mathematics 9, no. 7: 756. https://doi.org/10.3390/math9070756

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop