Topology optimization of thermal fluid flows with an adjoint Lattice Boltzmann Method

HAL is a multi-disciplinary open access archive for the deposit and dissemination of scientific research documents, whether they are published or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers. L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d’enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.


Introduction
The determination of optimal designs is an important objective in many engineering problems. Basically, three categories of optimization are classified [1,2]: size, shape or topology optimization. In size optimization, only the dimension of geometric parameters can be modified, while in shape optimization the boundary of the geometry can evolve. Topology optimization goes one step further, permitting the modification of the connectivity between different parts of the geometry, i.e. the creation of holes or more complex structures. As a result, it has the highest number of degrees of freedom, but it is also the most complicated.
The basic idea of topology optimization is to optimize a material allocation problem in which the material can have different properties. One of the first applications concerns the structural mechanical optimization, with compliance minimization [3,4]. Bendsøe [3]u s e d the density approach for the material distribution: 0 for void and 1 for solid elements. To solve the discontinuities at the interface of the two materials, some homogenization methods have been employed including the well known Solid Isotropic Material with Penalization (SIMP) method [5].
Borrvall and Petersson [6] pioneered in fluid topology optimization problems by following the same approach as Bendsøe [3], with a geometry composed of solid or fluid nodes. This approach has then been applied by many researchers for topology optimization of fluid flow without heat transfer [7][8][9][10][11][12], or for coupled heat transfer and fluid flow (thermal fluid flow) problems [13][14][15][16][17]. The flow field (forward problem) can be found by solving the Navier-Stokes equations via finite volume or finite element methods, but the computational cost is important for large domains. The computation time of the forward problem is particularly essential in topology optimization because it must be solved at each optimization iteration. Recently, Lattice Boltzmann Method (LBM) has become an interesting alternative for solving fluid flow problems [18,19]. This method works at a mesoscopic scale where the displacement and collision of particles are solved via the Boltzmann equation. The moments of the distribution function associated with the Boltzmann equation can give access to the macroscopic variables (density, velocity and pressure) of the fluid. It can also be applied to thermal flows by computing a second distribution function for the heat transfer [20][21][22]. Owing to its high parallel computing performance, LBM can be implemented efficiently on GPU cards [23][24][25], providing less computation time. Moreover, the boundary conditions are easy to handle and well suited for topology optimization problems, in which the boundaries can be complex.
Once the forward problem is solved, the geometry (fluid/solid repartition) is to be updated at each optimization iteration. Local criteria-based methods like evolutionary algorithms or cellular automaton [26][27][28]a r e easy to implement because they are gradient-free. But the connection between the local criteria and the cost function to be minimized can be hard to find, and the improvement of the cost function at each optimization iteration is not ensured. Contrary to local criteria-based methods, the meta-heuristic methods, like Genetic Algorithm, are based on the cost function only, and are well suited to find a global optimum. But, in topology optimization, the number of design variables is large, and the computational time using these methods would be too prohibitive for real problems. To cope with such difficulties, the alternative is to use a gradient-type method because it requires only one forward problem solution and one gradient computation for each optimization iteration [29]. This gradient can sometimes be difficult to compute, so an adjoint-state method is usually used to overcome this obstacle. The adjoint-state method avoids the calculation of the derivative of the state variable with respect to all design variables by direct differentiation, which would be too expensive to compute for a large number of design variables [30,31]. An additional equation for the adjoint state is then necessary, but its solution has the same computational cost as that for the forward problem.
Tekitek [32]fi r s t proposed an adjoint-state Lattice Boltzmann equation limited to a parameter identification problem. In a pioneering work for LBM topology optimization, Pingen [2]f o u n d similar optimal configurations with LBM and adjointstate method compared to the work of Borrvall and Petersson [6], using a finite element method. Also, a thermal flow LBM topology optimization method has been proposed by Pingen [15]. In [2] and [15], the adjoint state is calculated after discretization of the Lattice Boltzmann equation via a large sparse matrix. This is a time and memory consuming operation which goes against the simplicity of LBM. Following the approach of Pingen, Kirk [33]i m p l e m e n t e d a LBM topology optimization method for a transient flow. Yonekura [34] and Nørgaard [35]a l s o worked on LBM transient flows. In these works, it was required to store the state variables of the forward problem in all time iterations for the adjoint-state calculation, which constituted a bottleneck. Then, Krause [36]p r e s e n t e d in a fluid flow control problem a continuous adjoint-state LBM to avoid dealing with the matrix operations, as it was required in [2]. Yaji formulated a LBM fluid flow topology optimization method [37]w i t h velocity discrete Boltzmann equation to derive the adjoint states, and Liu [38]u s e d discrete adjoint-state LBM, but with the Multiple Relaxation Time (MRT) collision operator. In both works, the LBM boundary conditions were very simple (bounce-back or periodic), while commonly-used velocity and pressure boundary conditions [19] were not treated. Then, Yaji [39]p r o p o s e d a topology optimization method for thermal fluid flows where the velocity directions were discretized in the adjoint-state LBM to introduce commonly-used boundary conditions (prescribed velocity or pressure for the fluid flow, prescribed temperature or heat flux for the thermal problem). In [39], the optimization problem was solved with the SIMP method. This approach allows intermediate densities between the two material densities, resulting in a smoother transition on the fluid/solid interface. Even if the intermediate densities are penalized such that 0-1 solutions are encouraged, some regions (called grayscales) can still subsist, and the optimal design is not clearly defined. Some filtering techniques have been proposed to cope with such an issue, but they add some random parameters which are not convenient to use. To address this issue, the Level-Set Method (LSM) [40][41][42]c a n be employed to define the material distribution. LSM also provides a smooth transition between fluid and solid for the gradient calculation but the interface between the two materials is clearly defined by the zero contour of a Level-Set Function (LSF), and the target structure is modified by updating the LSF only. The evolution of the LSF is usually calculated by an Hamilton Jacobi equation with the topological derivatives obtained by a sensitivity analysis. During the optimization process, the LSF can become too flat or too steep, resulting in numerical instabilities. To prevent this problem, the LSF should be close to a signed distance function , respecting |∇ | = 1. This requirement cannot always be ensured by the Hamilton Jacobi equation. Therefore, classical LSM usually require re-initializations during the optimization process. An additional partial differential equation, given by [43], needs to be solved for the LSF re-initialization, and this process can cause inconsistencies like interface shifting [44,45]. Diffusive terms have been introduced in LSF by the Allen-Cahn equation [46,47]t o avoid reinitialization [48][49][50], allowing a smooth transition at the interface between the two materials. With this feature, LSM is very close to the phase field method, as noticed in [51]. More details on the LSM can be found in the review study of Van Dijk [51].
In this paper, we present an adjoint-state LBM for the topology optimization of thermal fluid flows. Different from the work of Yaji [39], LSM is used instead of SIMP, to obtain a clearer fluid/solid interface and so to avoid grayscales. For convective problems, it is therefore possible to easily implement fluid and solid parts with very different thermal properties (for example water and steel). This is more difficult with the SIMP method where intermediate material properties would not have any physical meaning. We have restricted the range of the LSF to the interval [−1; 1] in order to avoid re-initializations during the optimization process, as suggested by [50]. It should be noted that contrary to the LSF used in [37,50,52,53], our method does not need any regularization term in order to obtain optimal solutions. Concerning the adjoint-state formulation, the discrete boundary conditions are included at the beginning of the adjoint-state method as the LBM residuals, so that the adjoint-state boundary conditions can appear directly during the adjoint-state equation formulation. Keeping the boundary conditions in terms of residuals allows us to make the derivation of the boundary conditions in a general way, so that it could be simple to modify the adjoint-state calculations if the boundary conditions of the forward problem are to be modified. Expressing boundary conditions as residuals has already been made in [29], but, to the authors knowledge, for periodic and bounce-back conditions only, and not for prescribed velocity, or pressure boundary conditions, which are more complex to deal with. Furthermore, the incompressible LBM model [54,55]i s used to improve the accuracy of the LBM forward problem, which also simplifies the calculation of the adjoint equilibrium distribution function for the adjoint state. It also improves the stability of the adjoint states at higher Reynolds numbers (up to 50).
To sum up, the major novelty of this paper lies in: (1) the solution of thermal fluid flow topology optimization problems using an adjoint-state LBM coupled with the LSM, (2) the new introduction of the LBM boundary conditions in the adjoint-state formulation, and (3) the use of the LBM incompressible model that improves the forward problem accuracy, and simplifies the adjoint-state calculations.
This paper is organized as follows. Section 2 presents the forward LBM problem for thermal fluid flows. Section 3 presents the formulation of adjoint states, and the calculation of the related boundary conditions. In section 4, the proposed method is tested with 3 numerical examples concerning thermal fluid flows, with different objectives: minimization of the mean temperature in a domain for the first case, and maximization of the heat exchange for the second and the third case. For the second case, the hot temperature is prescribed on top and bottom walls while for the third case, the heat source is generated by solid parts. This latter example, already presented in several articles [17,39,53], serves as a comparison to validate our method. In these optimization problems, a limitation of the maximal pressure drop and of the porosity (void volume of fluid) is also applied. The effectiveness of the optimization method is evaluated through a systematic parametric study for the two first cases. Section 5 provides a detailed discussion on various interesting issues. Finally, in section 6, major conclusions achieved and perspectives of the study are presented.

Lattice Boltzmann Equation for fluid flow
The concept of LBM is based on a kinetic model describing the flow field at a mesoscopic scale. In this method, the fluid flow is not considered as a continuous matter but as an aggregation of particles moving and interacting with each other in the computational domain. The Boltzmann equation is used to describe the macroscopic behavior of the fluid by a distribution function f = f (x, t, c) such as [56,57]: in which f represents the probability for a particle to be at the position x, at time t, and with velocity c. The operator deals with collisions between particles. Since it is difficult to take collisions into account, a simple operator has been introduced by Bhatnagar-Gross-Krook (BGK) [58,59] (2) It means that collisions allow the relaxation of the distribution function f towards an equilibrium state f eq . τ represents the mean time between two collisions, which is related to the fluid viscosity: In (1), c represents a velocity that needs to be expressed in discrete directions. For 2D problems, 9 velocity directions are necessary for calculating the flow field, this yields the so-called D2Q9 scheme [60,61], as shown on Fig. 1. These directions will be represented by i and, for readability considerations, the following notation is introduced: In kinetic theory, when a gas is in thermodynamic equilibrium, it is modeled with an equilibrium distribution function called the maxwellian distribution. In LBM, this equilibrium function is obtained by a second-order Taylor expansion of the maxwellian distribution.

Incompressible D2Q9 model
The equilibrium distribution function f eq is usually written as: with ρ and u the density and the fluid velocity, respectively. These quantities can be obtained by the moments of f [62]: For each direction, the weight ω i is defined as follows [63]: for i =0 1 9 for i =1-4 1 36 for i =5-8 In this model, a compressibility effect is introduced in the Lattice Boltzmann method. If the density fluctuations are small, the incompressible equations can be recovered. Nevertheless, a LBM incompressible model has been proposed by He and Luo [54]i n order to deal directly with incompressible fluids. In this model, the density ρ is equal to ρ 0 + δρ. With ρ 0 = 1, the equilibrium distribution function becomes [55,64]: The pressure is also defined with the moments of f such as: with c s = 1/ √ 3, the lattice speed of sound. The fluid velocity needs to be very low compared to c s for the LBM to be valid. The streaming step consists in the propagation of the information to the neighbor nodes. Some populations on the boundaries will be therefore unknown after this step. The calculation of these populations is performed by applying boundary conditions. A schematic representation of such boundary conditions will be given later on, in section 4 (see Fig. 2).
The following boundary conditions for LBM are now expressed for the fluid flow. Let us introduce the partition ∂ X = ∂ X 1 ∪ ∂ X 2 ∪ ∂ X 3 . ∂ X 1 represents the inlet with a prescribed velocity, ∂ X 2 stands for the outlet with a prescribed pressure, and ∂ X 3 corresponds to no-slip walls.
As shown in Fig. 1, and later in Fig. 2, the unknown distribution functions at the inlet are f 1 , f 5 and f 8 (in the directions such as c i · n < 0, with n the outward unit normal vector). We can then impose a prescribed velocity (u in , v in ), by rewriting Eqs. (5) and (9): To solve this system, an additional equation is necessary because the density ρ is also unknown. Following [19], the bounceback rule is applied for the non-equilibrium part of the distribution functions, normal to the boundary: After proper arrangements, with v in = 0, we finally obtain: The same procedure can be applied for the outlet, with ρ the prescribed density (i.e. pressure), and the velocity u to be determined. At the solid walls, the no-slip boundary condition is enforced with the bounce-back rule. The collision step is not applied for the distribution functions f in the solid nodes, because of the zero velocity for these nodes. This boundary condition (15) has been derived for the incompressible model. For the compressible model, the derivation gives: For solving the topology optimization problem later on, it will be necessary to differentiate these expressions with respect to f i . In (15), there is a linear relationship between the velocity and f i . Contrarily, in (16), ρ being linear in f i , there is no more linear relationship between u in and f i . This constitutes one reason why the derivation of the boundary conditions in adjoint states will be later on simplified using the incompressible model over the compressible model. A comparison between the compressible and the incompressible LBM models will be presented in section 4.

Lattice Boltzmann Equation for the heat transfer
For the computation of the temperature field within the domain, a second distribution function g is introduced. This function appears similar to f (used for the flow field) in form, except for the equilibrium distribution function g eq i : The temperature T and the heat flux q are given by: Differing from the relaxation time τ used for the fluid flow, τ g is related to the diffusivity κ of the medium: Similarly, we introduce the partition ∂ X : ∂ X 1 ∪ ∂ X 2 ∪ ∂ X 4 ∪ ∂ X 5 characterizing the thermal aspects of the boundary conditions. ∂ X 1 represents the fluid inlet with a prescribed temperature, ∂ X 2 stands for the outlet with an outflow boundary condition, ∂ X 4 corresponds to adiabatic solid walls, and ∂ X 5 accounts for another prescribed temperature.
Following [65], the unknown distribution functions are assumed to be equilibrium distribution functions with the temperature T ′ to be determined. For instance, the boundary conditions on ∂ X 1 are: For the prescribed inlet temperature, T ′ is calculated by (18)w i t h T = T in . For the outlet boundary condition, T ′ is calculated by (19)w i t h q = 0. For adiabatic solid walls, the outlet boundary condition can be used with u = 0.
It is important to note that the LBM is a time evolution scheme that computes transient flows. It requires a sufficient number of iterations to reach the steady-state regime. Each iteration consists in one collision step, one streaming step, and the application of boundary conditions.

Forward problem
To summarize, the solution of the forward problem is computed by two state variables, f and g, which correspond to the LBM distribution functions, for the fluid flow problem, and the heat transfer problem, respectively. The computation of f and g is realized by solving the forward model that is composed of: 8, which stand for the residuals of the LBM fluid flow problem. These residuals read, ∀i: 8, which stand for the residuals of the LBM fluid flow boundary conditions. One has to make the distinction between the different parts on the boundary: on the inlet ∂ X 1 : 8, which stand for the residuals of the LBM heat transfer problem. These residuals read, ∀i: 8, which stand for the residuals of the LBM heat transfer boundary conditions. One has to make the distinction between the different parts on the boundary: on the inlet ∂ X 1 : on the outlet ∂ X 2 and Adiabatic walls (with 3. Adjoint-state Lattice Boltzmann Method (ALBM) for topology optimization of convective fluid flows

General process
Before deriving the full adjoint-state model, we give first the general process, adopting the methodology and the notations of Gunzburger [66], which are commonly used in the scientific community of optimal control and optimization of fluid flows. A general optimization problem is composed of different elements: • the state φ -in the following derivation, this global state gathers all previously defined states, i.e., f i and g i , ∀i = 0, ..., 8; • the control variables (or design parameters) α; • the cost function J (φ) to be minimized; • the constraint equations F (φ, α) = 0-in the following derivation, this global constraint gathers all the residuals previously defined in section 2.4, i.e. equations (22)-(31).
Following Gunzburger [66], the definition of the optimization problem reads: "find the controls α and the state φ such that J (φ) is minimized, subject to the constraint F (φ, α) = 0". To enforce the constraints, a convenient way is to use the Lagrange multiplier method [67]. With ξ the Lagrange multiplier (or adjoint state), the Lagrange function is defined as: with ·, · an appropriate inner product. At this stage, with (32), the optimization problem can be considered as unconstrained. It can be solved by searching α, φ, and ξ such that L(φ, α, ξ) is a stationary point. This particular point satisfies the condition: where δL, δξ, δφ and δα stand for arbitrary variations [68]. Three terms appear in the right hand side of (33): • the first term, i.e., the differential with respect to the adjoint-state variable, ∂L/∂ξ , which gives back the constraint equations F (φ, α), which means that the equations of the forward model are to be satisfied; • the second term, i.e., the differential with respect to the state, ∂L/∂φ, which gives the adjoint-state equation; • the third term, i.e., the differential with respect to the control variables (optimization parameters), ∂L/∂α, which gives the optimality conditions.
The different steps of the optimization algorithm are [66]: 1. solve the forward model, i.e., the constraint equation, in order to find the state φ; 2. solve the adjoint-state model, in order to determine the adjoint state ξ ; 3. solve the optimality conditions in order to find the derivative of the cost function with respect to the design parameters, i.e. the cost function gradient; 4. update the design parameters via a gradient-type algorithm.
The first step being presented in details in the previous section, we now focus on the derivation of the adjoint-state model before expressing the cost function gradient.
Note that, theoretically, the derivative of the cost function with respect to the design parameters could be performed thanks to a finite difference approximation. However, this would require to solve as many equations as the number of design parameters. It is not usable in topology optimization problems which usually involve thousands of parameters. In fact, the strength of the adjoint-state method is that only a single adjoint-state model has to be solved (added to the forward model) in order to determine completely the cost function gradient, regardless of the number of design parameters.

Optimization settings
The general framework presented in the previous paragraph will be applied to the thermo-fluid topology optimization problem. The different elements of the proposed optimization problem become: • the set of state variables f and g, i.e., the LBM distribution functions for the fluid flow problem, and the heat transfer problem, respectively. These state variables were denoted compactly as φ in the previous subsection; • the set of adjoint-state variables f * and g * , denoted generically ξ in the previous subsection. Similarly to f and g, f * and g * are composed of 9 elements f * i and g * i ; • the set of control variables (or design parameters) α. This set represents the material distribution. The spatial domain is discretized into N elements and there is one design parameter per element: This definition of α implies a crisp description of the fluid and solid domains. This also allows the use of the bounceback boundary rule on all no-slip walls (interfaces).
• the cost function J . In order to set-up the full derivation of the adjoint-state model, and of the cost function gradient, we start from a given objective for the optimization problem. It consists in the minimization of the mean temperature within a heated domain, while a cooling fluid is passing through it. The cost function J is evaluated after convergence of the forward model, i.e., at t = t f . The cost function being the mean temperature, it is expressed as: g j dX (35) in which X stands for the spatial domain of integration. Two additional terms, J 1 and J 2 are introduced in the cost function in order to control the maximal pressure drop allowed, and the porosity: and λ 1 ∈ R + , λ 2 ∈ R + are user-defined values used for controlling the relative importance of the different contributions J , J 1 , and J 2 . The pressure is given by (10) and p out = 1/3i s the reference pressure, so the pressure drop function is calculated only at the inlet of the domain.
The three terms J , J 1 , and J 2 are gathered in the augmented cost function J + such as: Incorporating all previously defined residuals into the Lagrangian functional, while taking care of their domain of definition, gives:

Derivation of the adjoint-state problem
In this section, we derive the adjoint-state problem. Only the fluid flow adjoint-state is derived carefully, the derivation of the heat transfer adjoint-state being similar. Three mathematical properties are useful for the derivation: Property 1. Integration by parts for the time derivative operator, taking into account that the differential at initial time is zero, i.e., δ f (t = 0) = 0, with δ fa n arbitrary variation: Green theorem for the spatial gradient operator, ∀i = 0, ..., 8: Differentiating the Lagrangian functional with respect to the states f i gives, applying the chain-rule: The terms (II) and (IV) will be used for the definition of the fluid flow adjoint-state variables within the domain (this derivation is given in section 3.4), while the terms (I), (III) and (V) will be used for the definition of the fluid flow adjointstate variables on the borders (this derivation is given in section 3.5).

Fluid flow adjoint-state equations within the domain
Let us firstly expand the second term, i.e., (II), using the properties (P1), (P2), and (P3), taking also into account that 9 Let us expand the fourth term, i.e., (IV): The combination of the two contributions, i.e., the terms (II) and (IV), gives the adjoint-state equations within the whole spatial domain (∀x ∈ X ), and within the whole time domain (∀t ∈[0, t f ]): The initial condition, which applies at the final time, and within the whole spatial domain (∀x ∈ X ), is given by the term (IIc) involved in (43): The term (IIb), which involves an integration over the border, and which has not been used yet, will be integrated in the derivation of the adjoint-state boundary conditions, see next section.

Inlet boundary conditions of f * i
The derivation of the boundary conditions to be applied on the adjoint-state variables is detailed only for the inlet, i.e. ∀x ∈ ∂ X 1 , the derivation being similar for other conditions. On the inlet, the unknown adjoint-state distributions are f * 3 , f * 6 and f * 7 (in the opposite directions than that of the forward model). The boundary conditions are obtained combining the three terms (I), (III) and (V) involved in (42), with also the term (IIb) involved in (43). As being a specific case for the inlet boundary condition, P g i does not depend on f j , so the term (V) involved in (42)v a n i s h e s , and, consequently, the inlet boundary condition is written as, ∀i: The inlet boundary conditions for the fluid flow model, given by (23), are to be differentiated to derive the term (III) of (48). Note that for the adjoint state, the unknown directions are the ones that satisfy (c i · n > 0). For these directions this scalar product equals one, so (48)i s rewritten to: Finally, the boundary conditions to be applied for the fluid flow adjoint-state problem, on the inlet (∂ X 1 ), read, for ∀t: A similar derivation would give the boundary conditions, for the fluid flow adjoint-state problem, on the outlet (∂ X 2 ): as well as on other boundaries, i.e., on (∂ X\(∂ X 1 ∪ ∂ X 2 )): It is seen that the use of the incompressible model is interesting to get a simple calculation of the equilibrium distribution function for the adjoint state f * . In fact, when we use the LBM incompressible model for the forward problem, the modification in the equilibrium distribution function in the forward problem implies a modification of the adjoint-state formulation, in the equilibrium distribution function, and in the boundary conditions. Numerical simulations have shown that this modification also improves the stability of the adjoint-state calculation, until Re=50, while it was limited to Re=25 with the compressible LBM model. However, it should be noted that both the incompressible and the compressible models give the same solution for the forward problem and the backward adjoint-state problem, so the optimized geometries are the same.
with g eq, * i The initial condition, given at final time, reads: The boundary condition corresponding to a prescribed temperature, on ∂ X 1 , is: The adjoint-state associated to an outflow boundary condition, (adiabatic if u = 0) on ∂ X 2 , is:

Gradient calculation and update of the geometry
Once the adjoint states f * and g * are known, the gradient of the augmented cost function with respect to the design variables is given by the differentiated Lagrangian functional with respect to these parameters, i.e., ∂L/∂α. Noticing that the control parameters are not involved in boundary condition equations, but only in the other two residuals of the forward model, one has: In the residuals of the forward problem, the three expressions depending explicitly on α are: with τ f and τ s the relaxation times for the distribution function g for the fluid, and the solid, respectively. In consequence, we have: Next, the first term in (57)i s : The augmented cost function gradient, which is a function of the space, is then identified to: Following [37] and [52], the weight λ 2 ∈ R + , which is in the third part of the augmented cost function in (40)i s redimensioned at each iteration such as: Let us point that, for a solid part, i.e. with u = 0, it is seen from (61) (62), is also zero. In this specific case only, the gradient ∇J + on solid parts cannot be different from zero; a solid will always remain a solid part. A trick which makes possible the evolution from solid to fluid is to slightly modify the gradient, at location x, taking account of the gradient in the vicinity of x, i.e. neighboring nodes. This allows the possible evolution from solid to fluid in cases where The material distribution α is represented by a level-set function (LSF) (x). The zero contour of this LSF delimits the interface between the solid and the fluid, such that: The update of the solid/fluid distribution α is performed via the evolution of the LSF , such as: with K the step size in the gradient direction. This expression is the same as used in Yamada [50], but without the regularization term. The regularization is supposed to smooth the LSF to avoid too complex designs, but it can also lead to an over simplification of optimal solutions. We decided not to use any regularization tool. We will show in our results that it is possible to reach optimized designs without adding any regularization term. During the optimization process, the LSF is maintained between [−1; 1], in order to avoid the reinitialization of the LSF, as suggested by [50].

Test cases and results
The geometry and the configuration of the test cases are shown on Fig. 2. The 2D square domain is enclosed by no-slip walls. The gray and white layers are fixed solid and fluid parts respectively. The fluid enters at the inlet on the left boundary, with a parabolic velocity profile, and exits at the right outlet, as outflow. For both top and bottom walls, a segment at the center is defined as a heat source, with a constant temperature of 100°C. The inlet fluid temperature is prescribed at 20°C.
The length of the heated segment at the bottom wall (40 elements) is longer than that at the top wall (20 elements), in order to introduce an asymmetric effect. Other segments of walls are defined as adiabatic, with no heat exchange. The bounce-back boundary condition is applied on interior walls on ∂ X 3 . The temperature for ∂ X 5 is prescribed only on exterior walls, and the heat is transfered to the fluid domain by conduction.
The different steps of the topology optimization method presented in the previous section are summarized in the flowchart on Fig. 3. The convergence criterion of the forward and adjoint-state LBM problems is: a n+10000 − a n a n < 10 −4 (68) with a the velocity and temperature fields for the LBM forward problem and the adjoint states f * and g * for the adjointstate problems. The convergence criterion of the optimization problem is: where J n is the cost function at iteration n. Calculations were performed on a NVIDIA Quadro K6000 GPU card for taking advantage of the LBM algorithm parallelism. For a domain with 100×100 elements, the computation time is about 20 × 10 3 LBM iterations per second while approximately 100 × 10 3 iterations are required to satisfy the convergence criterion for the forward problem. More iterations can be necessary for the adjoint-state problems, but at each optimization iteration, the final states of the LBM forward and adjoint-state problems are used for the initialization of the next LBM solution, in order to reduce the computation time.
Normally, for the adjoint-states calculation, one needs to store the macroscopic values of the forward problem, at each LBM iteration, which is prohibitive in terms of memory requirement. Here, we work with steady-state problems, so, as stated by [38], we can use the final iteration of the forward problem only, for all time iterations of the adjoint-states calculation.
In (67), the value of K (descent parameter of the LSF) has been chosen after multiple convergence tests. A value of 0.1 was found appropriate to reach an optimization convergence with a reasonable number of iterations.
Three numerical examples are presented in order to validate the optimization method. All cases treat thermal flow topology optimization problems, with different objectives: minimization of the mean temperature in a domain for the first case, maximization of the heat exchange for the second and the third case. For the second case, the hot temperature is prescribed on top and bottom walls. For the third case, the heat source is generated by solid parts. For the two first cases, the reference condition is based on the following parameters: The influence of these factors on optimization results will be tested and discussed in following sub-sections through a detailed parametric study. For the following results of optimized fluid/solid distributions, red streamlines represent the velocity vectors. The velocity field is given in Lattice Boltzmann units (LB), the pressure field is given in Pa and the temperature field is given in °C. For the third case, the parameters have been chosen to be close from the example given by Yaji [39], as a validation test case. They will be detailed in the section dedicated to this case.
For all the test cases related to the proposed topology optimization method, we use the LBM incompressible model, presented in sub-section 2.2, in the forward and adjoint-state problems, to simplify the adjoint-state calculations and improve the accuracy of the forward LBM problem. This latter point is now illustrated with a numerical example.
with N the number of nodes, and u th i the horizontal component of the velocity field given by the theoretical model. The evolution of this error with respect to LBM iterations is given in Fig. 4.
With the incompressible model, 2800 LBM iterations are required to reach an error of 10 −3 . In the compressible model, 5000 LBM iterations are required to reach the same error. The computational time has been shortened by using the incompressible model. It is essential as the LBM algorithm is used at each optimization iteration. Also, the convergence order for the error is almost multiplied by two, in favor of the incompressible model.

Case 1: minimization of the mean temperature
The convergence of the cost function and the pressure drop ratio is presented in Fig. 5 (left). For the pressure drop ratio, p/ p max is plotted on the y secondary axis. One can see that after about 150 optimization iterations, the cost function and the pressure drop ratio remain stable. One may observe that the mean temperature in the domain decreases with the introduction of the solid material. The evolution of the fluid/solid distribution as a function of optimization iterations is also shown on Fig. 5 (right). It can be noticed on Fig. 6 that the solid introduced in the domain divides the initial fluid path into two streams to guide the fluid flow towards the top and bottom parts of the domain, where the temperature is higher, and needs to be decreased. The solid material also induces an increase of the pressure, as shown in Fig. 6 (right). Note that the asymmetric setting of top and bottom heat sources results in a slight asymmetry of the solid part. The initial and final temperature fields are shown on Fig. 7. Though the maximum temperature in the domain is 100°C, the maximum value of the colorbar in Fig. 7 has been fixed to 60°C in order to obtain a better color contrast. From this figure, it is seen that  the mean temperature has been drastically decreased from the initial geometry to the optimized one. These results indicate that the proposed adjoint-state method is capable of solving such an optimization problem. In order to further evaluate the effectiveness and the robustness of the method, a systematic parametric study was also performed, with following results.

Spatial discretization
Firstly, the influence of the spatial discretization of the computational domain on the optimized geometry was studied. Three different spatial discretizations (with 60×60, 100×100 and 200×200 elements) were used. The corresponding optimized geometries are shown in Fig. 8. It can be observed that the optimized geometries have similar forms. When the spatial discretization is finer, the solid part becomes slenderer and occupies less space of the domain, with a mean temperature further reduced (see Table 1). This indicates that a finer spatial discretization is favorable for obtaining better results, but at the cost of a longer computational time. It can also be noticed that, for the case with 200×200 elements, there are two little solid parts in top and bottom of the domain in front of the main solid shape. One of the reasons might be that the spatial discretization with 200×200 elements permits, for this case, a more detailed description of the physical phenomena, which cannot be revealed with a coarser spatial discretization. Another reason could be the presence of local minima: several different geometries can give the same efficiency.

Geometry initialization
The influence of the initialization was tested by using different initial geometries of the solid material: full fluid, 2 big disks, and 9 small disks regularly located in the domain. The initial and obtained final shapes are shown in Fig. 9. The final geometries obtained with 2 and 9 disks initializations are not exactly the same as with the full fluid initialization. The number of optimization iterations is also more important. Nevertheless, the values of the cost function for the three config-    urations are in the same line (between 29.16 and 29.39°C), so that we may consider that the impact of these initialization patterns on the optimized geometry is acceptable (see Table 2). Based on the results of these tests, the following examples will use a spatial discretization with 100×100 elements and a full fluid initialization.

Pressure drop limitation
The pressure drop limitation is studied, which is an important factor to avoid impractical designs ( [69], [39]). It affects the quantity and repartition of solid material so that the final geometry obtained could be really different. The impact of the maximum pressure drop on the optimized shape was tested with C max = 20, 10, and 5. The results obtained are presented Fig. 10. Case 1 -influence of the pressure drop limitation on the optimized geometry: C max = 20 (left), C max = 10 (center) and C max = 5( r i g h t ) .  in Fig. 10, and Table 3. One can see that when C max decreases, the two branches going up and down are shorter, implying that the fluid paths are wider on the top and on the bottom of the domain. This makes sense, because the wider the fluid path, the lower the velocity magnitude and the total pressure drop. From Table 3, it is seen that the mean temperature of the domain increases while decreasing C max . This can be explained by the fact that the stronger limitation (smaller tolerable pressure drop) restricts the allowed quantity of solid material. This behavior is a typical Pareto front in a multi-objective optimization, where the two objectives would be the minimization of the mean temperature, and the minimization of the pressure drop. These objectives can be opposed so that a compromise is to be found.

Solid medium properties
In the previous studies, the solid medium was assumed to have the same thermal properties as water. Two other numerical examples were tested with different thermal properties of the solid medium: an insulating medium (k = 0.16 W/(m.K)) and a conductive medium (k = 44.5 W/(m.K)). Results obtained are reported on Fig. 11 and in Table 4.
The final temperature fields for the insulating and conductive media are shown on Fig. 12. The modification of the solid thermal properties is also applied to the solid layers surrounding the fluid channel, in gray in Fig. 11. For the conductive medium, it implies that the heat is diffused on a bigger length of top and bottom walls. This explains the large difference of the cost function values (given in Table 4). Concerning the solid introduced in the optimization domain, more solid elements are present for the case with conductive medium, and a solid bar is introduced at the outlet, increasing the velocity and decreasing the temperature in this area.

Reynolds number
The influence of the inlet Reynolds Number is presented in Fig. 13 and in Table 5. As indicated in Table 5, the mean temperature for the optimal geometries is lower when the Reynolds number is higher. In fact, the increase of the velocity helps to cool down the hot regions of the domain. For the three Reynolds numbers, the edges of the solid geometry at the top and at the bottom are at the same place. Nevertheless, the curvature of the solid geometry is more important when the Reynolds number is higher. For Re=50, a second solid part is introduced in front of the major solid part. In this configuration, the fluid flow is directed more efficiently towards the top and bottom regions of the domain.

Porosity limitation
Finally, the impact of the porosity limitation was studied. The objective is to prescribe the porosity of the domain, i.e. the quantity of fluid or solid elements. The results are presented in Fig. 14 and in Table 6.
The limitations on pressure drop and porosity can enter into conflict depending on the chosen maximal allowed pressure drop. For the presented cases, the value C max = 20 is large enough to have both pressure and porosity limitations satisfied.
The cost function value for the case with a fluid volume of 50 % is higher than for the other cases, because solid parts are added on optimization domain corners, to satisfy the porosity limitation. In this study, the solid has the same thermal properties as water, so a solid cell is equivalent to a fluid cell with a null velocity. But, in this convective problem, the velocity is very important in order to reduce the mean temperature, so it explains the poor efficiency of the configuration with a porosity of 50 %. Also, the cost function value for the porosity of 80 % is lower than without limitation. This issue will be discussed in section 5.

Case 2: maximization of the heat exchange with heated top and bottom walls
For this numerical example, the heat exchange efficiency will be characterized by the amount of heat evacuated by the fluid flow. This power is given by: with the flow-rate q f , the density ρ f , the heat capacity C p, f , and the mean inlet temperature T f ,in being all constant values. T f ,out is written as: For this purpose, the topology optimization problem concerns the maximization of the cost function, defined by the mean of the square of the product u × T at the fluid outlet ∂ X 2 , with u the horizontal component of the velocity. The cost function J previously defined in (35), is to be replaced by: With the change of cost function definition, some modifications are necessary in the calculation of the augmented cost function gradient, but these are quite simple and easy to implement (e.g., (52)), indicating the adaptability of the proposed method for topology optimization. The convergence plot of the cost function and pressure drop ratio and the evolution of fluid/solid distribution as a function of the optimization iterations are presented in Fig. 15. It can be seen that compared to the first case, much more optimization iterations are required to reach the final geometry. After iteration 200, some very  small solid elements are added in the right part of the computational domain in addition to the major solid part in front of the optimization domain. These elements could help to drive the flow toward the outlet.
At the beginning of the optimization process, the fluid flow is divided in two paths near the inlet to go towards the top and bottom walls of the domain, where hot temperatures are prescribed. In the meantime, a solid line obstructs a part of the fluid outlet. This phenomenon is not a numerical artifact, but a deduced result smartly achieved by the optimization algorithm. The partial solid bar serves to reduce the width of the fluid outlet, and contribute to the raise of the fluid velocity on the bottom part of the outlet, as seen in Fig. 18 and in Fig. 16 (left). The solid bar also modifies the temperature field, as shown in Fig. 17, which is to be compared to Fig. 16 (right). Even though the velocity is null behind the bar, the cost function is augmented compared to the no-bar configuration (see Table 7). Note that this comparison, while interesting, is limited by the fact that the pressure drop is increased by a factor of 3.6 due to the partial obstruction of the fluid outlet by the solid bar. Similar to the first case, a parametric study was performed to test the influence of some parameters on the optimized geometries.

Pressure drop limitation
Firstly, the impact of the pressure drop limitation was tested. Fig. 19 and Table 8 indicate the influence of the pressure drop limitation on the fluid/solid repartition, and on the cost function. It can be observed that the quantity of the solid part is reduced for C max = 10 and 5 compared to C max = 20, as it was already seen for the first case.
For C max = 5, the maximal allowed pressure drop has been reached by the partial obstruction of the fluid outlet. This also confirms the fact that the obstruction of the fluid outlet is considered as a priority to augment the cost function. It can be seen from Table 8 that a higher amount of heat power can be evacuated by a higher allowable pressure drop, a tendency that is also expected.

Porosity limitation
Concerning the influence of the porosity limitation, the configuration with a porosity of 80 % has a higher cost function value than that obtained with no porosity limitation. This phenomenon has already been observed for the first case, and will be discussed later in section 5.
From a physical point of view, one can see on Fig. 20 that, with a higher quantity of solid material for the 80 % porosity condition (center) than for the unconstrained configuration (left), the velocity magnitude is more important close to the top and bottom walls, where the temperature is high, so the heat evacuated by the fluid is also higher. On the same figure, 22 Fig. 19. Case 2 -influence of pressure drop ratio: C max = 20 (left), C max = 10 (center) and C max = 5( r i g h t ) .   the fluid/solid distribution for a porosity of 50 % is also presented. The cost function value is the lowest, as written in Table 9. The efficiency of this configuration is penalized by the fact that solid parts near the hot walls act as a resistance for transmitting the heat to the fluid. We can notice that the lower fluid channel is larger than the upper one, due to a hot temperature prescribed on a longer length on the bottom part of the domain.

Case 3: Maximization of the heat exchange with heated solid parts
This case has been used in several articles dealing with topology optimization of convective problems [17,39,53]. It thus constitutes a good test case to validate the method presented in this paper. In this case, an amount of heat is generated in the solid domain, such as:  with T max a reference temperature and β a heat flux coefficient, which controls the magnitude of the heat source (β = 0i n the fluid domain). The heat generated by a solid cell is therefore limited by T max . The cost function J is now defined as: The objective is to maximize this cost function J with a limitation on the maximal pressure drop allowed. From a physical point of view, solid parts have to be introduced inside the domain because β = 0f o r the fluid cells. But the fluid flow must be able to cool down some solid cells, otherwise all solid cells would be at T max . In this case, the cost function is also equal to zero. To be able to compare results, we will use the same input parameters as Yaji [39]: Re = 7( ν = 0.8), Pr = 6, β = 0.1 and C max = 10. The heat transfer problem is performed in both fluid and solid domains. The fluid and solid thermal properties are the same. The fluid enters with a cold inlet temperature (T = 0) and all solid walls are adiabatic. The reference temperature was not given in [39], but we found T max = 15 to give a similar cost function value for Yaji's configuration. The domain is a 200 × 200 elements square. The fluid enters with a parabolic velocity profile, and the inlet is composed of 64 nodes located at the middle of the square. All walls are adiabatic. The optimized geometry is presented in Fig. 21.
As expected, we observed an increase of the cost function value with respect to the iterations count. Several solid parts are introduced inside the domain in order to generate the heat. On Fig. 22, one can see the evolution of the LSF for several iteration counts during the optimization. The iteration counts are the same as for the fluid/solid distribution presented in Fig. 21 so it is possible to compare both plots. Initially, the LSF is equal to 1 everywhere (full fluid) and the introduction of solid shapes is due to the decrease of the LSF in some regions of the computational domain. Although the LSF is continuous for each iteration, one can obtain a crisp definition of the fluid/solid geometry by taking the zero contour of the LSF as fluid/solid interface. As mentioned above, the LSF is limited to the range [−1; 1] so, at the end of the optimization (iteration 200), we observe almost a binary pattern with −1f o r the solid and 1 for the fluid parts. The temperature field is shown on    Fig. 23. The cold fluid at the inlet is rapidly heated by the heat generating parts. As a consequence, the outlet temperature of the fluid is much higher than the inlet temperature. It demonstrates an important heat transfer between the solid and the fluid, which was the objective of this optimization problem. One can notice that the objective of the second case and the third case is similar. In the second case, the heat is coming from the top and bottom walls, as in this third case, it is coming from the solid parts. Nevertheless, in both cases, the idea is to increase the heat transfer, and so the fluid temperature increases when the fluid is going through the channel.
Next, the influence of the heat flux coefficient β is evaluated, whose results are presented in Fig. 24. One can see that the solid parts are bigger for β = 0.01 than for β = 0.3. It seems to be a good behavior because, for the same flow rate, it is easier to cool down a solid part with a lower heat source. As a result, it is possible to introduce bigger solid parts before reaching T max inside the solid. Table 10 shows the comparison between these results and Yaji's on the same configuration. It was difficult to obtain exactly the same case because of some unknown parameters (T max or the viscosity of the fluid). In fact, to get a good comparison, different geometries from Yaji [39]h a v e been extracted and re-computed with our LBM algorithm to get the cost function value from Yaji's cases. Nevertheless, one can see that the results are very close, despite the fact that the fluid/solid repartitions are clearly not the same (Yaji's geometries are represented in Fig. 25).

Comparison between the optimized shapes obtained for different objectives
One can notice some similarities between the optimal shapes obtained for the first two cases. Both shapes tend to divide the fluid flow into two streams, but not at the same location in the domain (2/3o f the length for the first case, and 1/3 for the second case). In the first case, one can see with the velocity streamlines for the final step on Fig. 26 that the fluid goes from the inlet towards the hot regions to cool down these areas. In the second case, the fluid passes also through the top and bottom walls but the heat is then diffused inside the domain, limiting the heat exchange between the fluid and the hot walls. For the first case, the cooling is focused on the upper-right and bottom-right corners of the domain next to the outlet, to keep a small mean temperature. Since the second case aims at maximizing the heat power evacuated, the local temperature is not a matter of concern, and some hot zones are present in these areas, as a consequence of the partial obstructing of the outlet.

Existence of local minima
Concerning the porosity limitation, the unconstrained condition was expected to give the best solid geometry with respect to the cost function. Nevertheless, we could observe that the geometry obtained with the fluid volume at 80 % was more efficient for both cases (see Tables 6 and 9). It means that the optimal configuration obtained with no limitation is at a local optimum of the cost function, which is an intrinsic property of gradient-type methods. This observation can also be linked to the initialization study. Even if the study of initialization did not reveal any other local minimum, as it has been observed in the reference case, it cannot be ensured that all initializations will lead to the same result. A possible solution for future work to avoid finding local minima would be to work with hybrid method coupling meta-heuristic and gradient algorithms.

Update of the fluid/solid distribution
The geometry is modified at each optimization step by updating the LSF, with a simple steepest descent step and a constant step size (K=0.1). In this study, the optimization method requires an important number of iterations to converge (about 250 iterations for the first case and 1000 for the second case) so more advanced schemes (Newton's method for example) and the use of a line-search algorithm [29,67] could be implemented to improve the convergence process.

Physical properties dependency with temperature
For simplification reasons, we used here an LBM with constant physical properties for both the fluid and the solid media. In reality, they could vary significantly with temperature and have a non negligible impact on the optimized geometry. The modification of the relaxation times depending on the temperature in the LBM could be a solution to improve the model.

Conclusion
A gradient-type method has been developed for topology optimization of thermal fluid flow problems. The forward problem is solved by LBM, and the calculation of the augmented cost function gradient is performed with an adjoint-state method in order to deal with a large number of design variables. The update of the geometry at each optimization iteration is realized by the LSM. This method implies a crisp definition of the fluid/solid interface at each optimization iteration, avoiding grayscales and problems which goes with it. Moreover, the evolution equation used for the LSF in this paper is very simple, because it does not involve any regularization term. Three thermal fluid flow optimization examples with different cost functions have been tested to illustrate the adaptiveness of the method. A comparison with the example used by Yaji was performed in order to validate the method. The results demonstrate that the proposed optimization method could be an effective approach for topology optimization of thermal fluid flows. As stated in the article, the comparison with other works was difficult to perform because of some unknown parameters. In this paper, all the necessary data is given. Based on that, the authors think it could be interesting, as a general perspective, to use one of the presented test cases as a benchmark for topology optimization of convective problems.
The LBM boundary conditions are introduced at the beginning of the adjoint-state method. In this way, the adjoint-state boundary conditions appear naturally during the calculation of adjoint states. It allows a flexibility of the algorithm for different problems with an easy modification of boundary conditions, and cost function. Then, the use of the incompressible LBM model, not only improves the accuracy of the forward problem, but also permits an easier adjoint-state calculation and a better stability of the adjoint state.
Some results have shown the existence of local optima of the cost function. In this paper, we use a simple steepest descent method with a constant step size. An improvement of the line search method is a possible way to obtain better results that will be addressed in future research. Finally, the presented method is limited to 2D and laminar flows. Another research direction is the extension of the optimization method to 3D domains, and with higher Reynolds numbers.