1 Introduction

Natural convection is a fluid phenomenon driven by temperature-dependent buoyancy force. This phenomenon is widely known as a heat transfer mechanism that does not require cooling fans and plays a vital role in designing high-performance cooling devices such as heat sinks in electronic systems. Since natural convection is often beyond the extent of human intuition when considering complex systems, research on mathematical optimization concerning natural convection has been studied for more than a half-century. Elenbaas (1942) discussed a maximum diffusion problem of natural convection in vertical plates. Bahadur and Bar-Cohen (2005) summarized various performance indices of pin fin heat sinks. Yu et al. (2011) proposed a surrogate-based optimization method for designing radial heat sinks. Although these traditional methods—the so-called sizing optimization—can provide improvements compared with existing devices, the obtained results are strongly dependent on the initial guesses in general and, therefore, limited in terms of the degree of design freedom.

Topology optimization (Bendsøe and Kikuchi 1988) is one of the methodologies in structural optimization to generate novel solutions under a high degree of design freedom. One of the most attractive features of topology optimization is that an optimized configuration can be generated from a fixed design domain even if the initial guess is quite far from an optimum. So far, topology optimization has been applied to various structural optimization problems and demonstrated its applicability on multiphysics, multiscale, practical engineering applications, and so on (Bendsøe and Sigmund 2003). Borrvall and Petersson (2003) pioneered the methodology of topology optimization for fluid problems, in which dissipation energy minimization problems are formulated under the Stokes flow assumption. After that, this has been applied to optimization problems concerning various fluid regimes, such as Navier–Stokes laminar flow (Gersborg-Hansen et al. 2005; Olesen et al. 2006), forced convection (Yoon 2010; Matsumori et al. 2013), chemical transport systems (Okkels and Bruus 2007; Chen et al. 2019), turbulence (Kontoleontos et al. 2013; Dilgen et al. 2018). Additionally, machine learning-based frameworks have been recently proposed for solving complex flow optimization problems (Yaji et al. 2022; Hammond et al. 2022)

As mentioned in a recent review paper (Alexandersen and Andreasen 2020), the application to natural convection problems has been limited in the research community of topology optimization. One of the representative difficulties is that natural convection requires dealing with the two-way coupling; fluid and temperature fields interfere, whereas forced convection is the one-way coupling. This fact implies that the numerical simulation of natural convection is relatively more challenging and requires higher computational cost under the same degree of freedom as a case of forced convection. Alexandersen et al. (2014) pioneered topology optimization for 2D natural convection problems. After that, more detailed investigation on parameters of the 2D natural convection problems (Li et al. 2022b), large-scale 3D problems (Alexandersen et al. 2016), simplified models (Asmussen et al. 2019; Pollini et al. 2020), multiobjective problems (Ramalingom et al. 2019), and a combination with an adaptive mesh refinement scheme (Li et al. 2022a) have been reported. However, it should be noted that most previous works focus on steady-state natural convection. At the same time, the unsteady state is more practical in considering the natural convection phenomena. Furthermore, it may have applicability for designing practical and interesting optimization problems such as rapid cooling system design.

Coffin and Maute (2016) proposed topology optimization concerning unsteady natural convection and discussed the specific feature of the optimized design in the unsteady case comparing with the steady one. Besides, topology optimization of unsteady natural convection has been successfully applied to designing energy storage systems (Pizzolato et al. 2017; Vogel and Johnson 2019; Xie et al. 2019; Zhao et al. 2020). These previous works have been limited in 2D problems due to the massive computational cost for sensitivity analysis, as mentioned in Coffin and Maute (2016). Such a full-scale 3D topology optimization may be realized by using a large-scale parallel computer. However, since the previous works mainly use implicit schemes such as the finite element method (FEM), it is challenging to exploit its parallel performance compared to explicit schemes that do not require matrix operations. On the other hand, since an explicit scheme generally requires a lot of time steps compared to an implicit scheme, the memory requirement may be strict because the adjoint method for time-dependent problems requires preserving the state variable field for each time step. Hence, it cannot be concluded that an explicit scheme is more efficient than an implicit scheme, but we believe that a topology optimization approach based on an explicit scheme is a promising option for solving unsteady natural convection problems if a parallel computer could be used.

Among the many explicit schemes, the lattice Boltzmann method (LBM) (Chen and Doolen 1998; Aidun and Clausen 2010; Krüger et al. 2017) is one of the representative schemes of the computational fluid dynamics (CFD). The LBM is inspired by the analogy of molecular fluid mechanics and can compute fluid regimes from fluid particles’ so-called velocity distribution functions governed by the Boltzmann equation. In general, the LBM does not require solving the Poisson equation that is the majority of the computational cost in the other standard CFD methods based on a segregated approach in terms of the fluid velocity and pressure. Hence, the LBM can be coded as a simple numerical algorithm that realizes high-performance parallel computing. Besides, many researchers have reported the applicability of the LBM for computing natural convection fields (Dixit and Babu 2006; Mohamad and Kuzmin 2010; Li et al. 2016).

Pingen et al. (2007) have opened the door of topology optimization using the LBM and first indicated that the optimized configurations are similar to those of the case using the FEM in pressure drop minimization problems. After that, their method has been applied to Tesla valve design (Pingen et al. 2008), scalar transport problems (Makhija et al. 2012) and so on. However, since these previous works use the traditional discrete adjoint sensitivity analysis, large-scale and asymmetric matrix needs to be treated due to the feature of velocity distribution functions.

Yaji et al. (2014) proposed a topology optimization method based on the adjoint lattice Boltzmann method (ALBM) (Krause et al. 2013), in which not only the forward problem but the adjoint problem are solved using the LBM. The basic idea of the ALBM is that the adjoint equation is derived in the continuous fashion from the continuous Boltzmann equation. Then the adjoint equation is discretized using the LBM. Hence, the adjoint problem can be solved by a completely explicit scheme without any matrix operations. This method has been applied to pressure drop minimization problems (Yaji et al. 2014; Xie et al. 2021), convection problems (Yaji et al. 2016; Dugast et al. 2018; Luo et al. 2022), chemical transport problems (Dugast et al. 2020), and unsteady flow problems (Chen et al. 2017; Yaji et al. 2018; Nguyen et al. 2020). Besides, there is another way to formulate the adjoint problem using the LBM, in which the original discrete equation—lattice Boltzmann equation—is used for deriving the discrete adjoint equation (Tekitek et al. 2006). This method has also been applied to steady-state problems (Liu et al. 2014; Łaniewski-Wołłk and Rokicki 2016) and unsteady problems (Nørgaard et al. 2016, 2017). Yonekura and Kanno (2015) proposed a radical method based on a one-shot approach, in which solving the adjoint problem can be avoided under a low Reynolds number condition. Notably, these LBM-based topology optimization methods are suitable for large-scale parallel computing as the adjoint problem has the feature of the explicit scheme in the LBM. In addition, except Yonekura and Kanno (2015), these methods can be naturally applied to unsteady problems by a slight change from the steady-state case, since the LBM is originally a numerical scheme for solving time-dependent flows.

In this study, based on Yaji et al. (2014, 2016), we propose a topology optimization method for unsteady natural convection problems. We derive the adjoint problem in a general formulation, in which the ALBM based on discrete velocity Boltzmann equations is employed for reflecting the LBM boundary conditions to the adjoint problem (Yaji et al. 2016). It should be noted that the ALBM in this study is a semi-continuous adjoint method concerning continuous time and space and discrete particle velocities. Then, we provide the concrete optimization algorithm as the numerical implementation. In numerical examples, we validate the developed code by solving a steady-state case (Alexandersen et al. 2014) as a benchmark. We then tackle two cases of unsteady natural convection problems. The objective function of the first example is a time-averaged temperature at a heated boundary, and that of the second is a weighted sum of time-averaged flow rate and the deviation for designing a natural convection-driven pump. As a large-scale problem, we tackle a 3D unsteady natural convection problem on a parallel supercomputer. Lastly, we summarize what we found in this study as the conclusion.

2 Formulation

2.1 Topology optimization

Here, we briefly review the basic concept of topology optimization in a general expression. Let us consider a structural optimization problem to determine the boundary of a design domain \(\Omega\). The basic concept of topology optimization is the introduction of a fixed design domain \(D\subset {\mathbb {R}}^d\) (d: spatial dimension) that includes the original domain, i.e., \(\Omega \subseteq D\). Then, a characteristic function \(\chi _{\Omega }:D\rightarrow \{0,1\}\) is introduced to replace the original optimization problem with a material distribution problem in D. Herein, the characteristic function is defined as:

$$\begin{aligned} \chi _{\Omega }({{\varvec{x}}}) =\left\{ \begin{array}{cl} 1 &{} \hbox { if}\ {{\varvec{x}}} \in \Omega \\ 0 &{} \hbox { if}\ {{\varvec{x}}} \in D\backslash \Omega , \\ \end{array} \right. \end{aligned}$$
(1)

where \({{\varvec{x}}}\) represents a position in D. Since the discrete nature of \(\chi _{\Omega }\) makes it hard to solve such a 0–1 optimization problem directly, relaxation or regularization techniques are typically essential. One of the most popular methods is the so-called density approach (Bendsøe and Sigmund 2003), whose basic concept is to replace \(\chi _{\Omega }\) with a continuous function, i.e., \(\gamma :D\rightarrow [0,1]\), where \(\gamma\) is termed a design variable field. Using \(\gamma\), a general form of the topology optimization problem based on the density approach can be expressed as follows:

$$\begin{aligned} \begin{array}{ll} \underset{\gamma }{\text {minimize }}\ &{} J(\gamma , {\varvec{U}}(\gamma )) \\ \text {subject to }\ &{} G(\gamma , {\varvec{U}}(\gamma ))\leqslant 0, \\ &{} 0\leqslant \gamma ({\varvec{x}})\leqslant 1,\ \forall {\varvec{x}}\in D, \end{array} \end{aligned}$$
(2)

where J is an objective functional, and G is a constraint functional. Besides, \({\varvec{U}}\) represents the state variable field that is typically given as the solution of partial differential equations for physical fields. In this study, \({\varvec{U}}\) corresponds to the fluid velocity, pressure and temperature in natural convection systems. After some discretization treatments, such as the FEM for each field, the optimization problem (2) can be solved using a gradient-based optimizer.

2.2 Governing equations

In this study, the state variable field \({\varvec{U}}\) in (2) is given as the solution of an unsteady natural convection system. The time interval is defined as \({\mathcal {I}}=[t_0,t_1]\) where \(t_0\) and \(t_1\) are the initial and final times, respectively. We consider an analysis domain \({\mathcal {O}}=D\cup \Omega _\text {non}\) with \(D\cap \Omega _\text {non}=\emptyset\) in which \(\Omega _\text {non}\) represents the non-design domain. We assume that the analysis domain is composed of the fluid domain \(\Omega _\text {f}\) and the solid domain \(\Omega _\text {s}\). In addition, let us consider that the design variable field is defined as \(\gamma =0\) for \(\Omega _\text {s}\) and \(\gamma =1\) for \(\Omega _\text {f}\), respectively. Note that the grayscale region, \(0<\gamma <1\), is regarded as a porous medium based on the density approach.

Consider the following natural convection system based on the Boussinesq approximation for the fluid velocity \({\varvec{u}}:\Omega _\text {f}\times {\mathcal {I}}\rightarrow {\mathbb {R}}^d\), pressure (divided by the fluid density), \(p:\Omega _\text {f}\times {\mathcal {I}}\rightarrow {\mathbb {R}}\) and temperature \(T:{\mathcal {O}}\times {\mathcal {I}}\rightarrow {\mathbb {R}}\) in the fluid domain:

$$\begin{aligned}&\nabla \cdot {{\varvec{u}}}=0, \end{aligned}$$
(3)
$$\begin{aligned}&\frac{\partial {{\varvec{u}}}}{\partial t}+ \left( {{\varvec{u}}}\cdot \nabla \right) {{\varvec{u}}} = -\nabla p+\nu \nabla ^2{{\varvec{u}}} +{\varvec{e}}g\beta \left( T-T_\text {ref}\right) , \end{aligned}$$
(4)
$$\begin{aligned}&\frac{\partial T}{\partial t}+ {{\varvec{u}}}\cdot \nabla T=K_\text {f}\nabla ^2T, \end{aligned}$$
(5)

where \(\nu\) is the kinematic viscosity, \({\varvec{e}}\) is the unit vector of the gravitational direction, g is the gravitational acceleration, \(\beta\) is the volumetric expansion coefficient, \(T_\text {ref}\) is a reference temperature which depends on the analysis problem, and \(K_\text {f}\) is the thermal diffusivity of the fluid. Additionally, the temperature T satisfies the following equation in the solid domain:

$$\begin{aligned} \frac{\partial T}{\partial t}=K_\text {s}\nabla ^2T, \end{aligned}$$
(6)

where \(K_\text {s}\) is the thermal diffusivity of the solid.

Since our concern is to determine the distribution of \(\Omega _\text {f}\) and \(\Omega _\text {s}\) in D, the governing equations in (36) need to be expanded so that the state variable fields belong to both domains using the design variable field \(\gamma\). For this, we employ a Brinkman approach (Borrvall and Petersson 2003), in which \({\varvec{u}}\) belongs to not only the fluid domain but the solid domain, by replacing (4) with

$$\begin{aligned}&\frac{\partial {{\varvec{u}}}}{\partial t}+ \left( {{\varvec{u}}}\cdot \nabla \right) {{\varvec{u}}} \nonumber \\&\quad = -\nabla p+\nu \nabla ^2{{\varvec{u}}} -\alpha _{\gamma }{\varvec{u}}+{\varvec{e}}g\beta \left( T-T_\text {ref}\right) . \end{aligned}$$
(7)

Herein, \(\alpha _{\gamma }\) is a design-dependent parameter expressed using \(\gamma\), as follows:

$$\begin{aligned} \alpha _\gamma ={\bar{\alpha }}\frac{q_\alpha \left( 1-\gamma \right) }{q_\alpha +\gamma }, \end{aligned}$$
(8)

where the parameter \({\bar{\alpha }}\) has a sufficiently large positive number for expressing the solid domain in D, and \(q_\alpha >0\) is a tuning parameter to control the convexity of \(\alpha _\gamma\). As the similar way in (8), the governing equations for T in (5) and (6) are combined for expressing the temperature field by a single equation in D, as follows:

$$\begin{aligned} \frac{\partial T}{\partial t}+ {{\varvec{u}}}\cdot \nabla T=\nabla\cdot\left( K_{\gamma}\nabla T \right), \end{aligned}$$
(9)

where the design-dependent thermal diffusivity \(K_{\gamma }\) is defined as

$$\begin{aligned} K_\gamma =K_\text {f}+\left( K_\text {s}-K_\text {f}\right) \frac{q_K\left( 1-\gamma \right) }{q_K+\gamma }. \end{aligned}$$
(10)

Herein, \(q_K>0\) is a parameter for controlling the convexity of \(K_\gamma\). Note that these governing equations can be solved under appropriate boundary conditions.

2.3 Lattice Boltzmann method (LBM)

In this study, the lattice Boltzmann method (LBM) is used to obtain the macroscopic variable fields discussed in Sect. 2.2. The basic idea of LBM is that the fluid regime is represented as an aggregation of fictitious particles, which makes it possible to obtain macroscopic variable fields such as the fluid velocity, pressure and temperature from the moments of the velocity distribution functions.

Based on the basic idea of the LBM (Krüger et al. 2017), we consider a modeled thermal fluid composed of identical particles whose velocities are restricted to a finite set of Q vectors, \({{\varvec{c}}}_0, {{\varvec{c}}}_1, \cdots , {{\varvec{c}}}_{Q-1}\in {\mathbb {R}}^d\), where the number of Q depends on the lattice model discussed later.

Let us now discuss how to solve the governing equations in (3, 7 and 9) by the LBM. We assume that the fluid pressure and velocity are given by the moments of the velocity distribution functions \(f_i:{\mathcal {O}}\times {\mathcal {I}}\rightarrow {\mathbb {R}}\) with \(i=0,1,\cdots ,Q-1\), as follows:

$$\begin{aligned}&p=\frac{\rho }{3}=\frac{1}{3}\sum _{i=0}^{Q-1}f_i, \end{aligned}$$
(11)
$$\begin{aligned}&{{\varvec{u}}}=\displaystyle \frac{1}{\rho }\sum _{i=0}^{Q-1}{{\varvec{c}}}_if_i, \end{aligned}$$
(12)

where \(\rho\) is the fluid density. Similarly, the temperature is given by using another velocity distribution function \(g_i:{\mathcal {O}}\times {\mathcal {I}}\rightarrow {\mathbb {R}}\):

$$\begin{aligned} T=\sum _{i=0}^{Q-1}g_i, \end{aligned}$$
(13)

Note that although (13) needs not to be defined using the same Q with (11 and 12), we use the same value in this study for brevity. From the Bhatnagar-Gross-Krook (BGK) model in the kinetic theory, \(f_i\) and \(g_i\) respectively satisfy the following discrete velocity Boltzmann equations:

$$\begin{aligned}Sh\displaystyle \frac{\partial f_i}{\partial t}+{{\varvec{c}}}_i\cdot \nabla f_i&=-\displaystyle \frac{1}{\varepsilon _f}\left( f_i-f^\text {eq}_i\right) \nonumber \\&\quad -3w_i{{\varvec{c}}}_i\cdot \alpha _\gamma {{\varvec{u}}}+3w_i{{\varvec{c}}}_i\cdot {\varvec{e}}g\beta \left( T-T_\text {ref}\right) , \end{aligned}$$
(14)
$$\begin{aligned}&Sh\displaystyle \frac{\partial g_i}{\partial t}+{{\varvec{c}}}_i\cdot \nabla g_i= -\displaystyle \frac{1}{\varepsilon _{g}}\left( g_i-g^\text {eq}_i\right) . \end{aligned}$$
(15)

Here, both equations are nondimensionalized as with the previous work (Yaji et al. 2016), and Sh is the Strouhal number given by the ratio of reference values of the flow speed and the particle speed. Besides, \(\varepsilon _f\) and \(\varepsilon _g\) are dimensionless parameters of the same order as the Knudsen number. Note that the design-dependent terms in (14 and 15) are equal to zero in \(\Omega _\text {non}\). In addition, \(f^\text {eq}_i\) and \(g^\text {eq}_i\) represent the local equilibrium distribution functions given by

$$\begin{aligned}&f^\text {eq}_i=w_i\rho \left\{ 1+3{{\varvec{c}}}_i\cdot {{\varvec{u}}}+\displaystyle \frac{9}{2}\left( {{\varvec{c}}}_i\cdot {{\varvec{u}}}\right) ^2-\displaystyle \frac{3}{2} \vert {{\varvec{u}}}\vert ^2\right\} , \end{aligned}$$
(16)
$$\begin{aligned}&g^\text {eq}_i=w_iT\left( 1+3{{\varvec{c}}_i}\cdot {{\varvec{u}}}\right) . \end{aligned}$$
(17)

The parameter \(w_i\) in (14, 16 and (17) denotes a weight in each lattice grid and its value is given in each lattice model. In this study, two kinds of lattice models are used with the nine-velocity (D2Q9) model for 2D problems and the fifteen-velocity (D3Q15) model for 3D problems. Figure 1 shows the schematic of the lattice models and the exact values of the weights \(w_i\) are given by

$$w_{i} = \left\{ {\begin{array}{*{20}l} {4/9\,\left( {i = 0} \right)} \hfill \\ {1/9\,\left( {i = 1,2,3,4} \right)} \hfill \\ {1/36\,\left( {i = 5,6,7,8} \right)} \hfill \\ \end{array} } \right.,$$
(18)

for D2Q9 model, and

$$\begin{aligned} w_i= \left\{ \begin{array}{ll} 2/9 & \quad \left( i=0\right) \\ 1/9 &\quad \left( i=1,2,3,4,5,6\right) \\ 1/72 &\quad \left( i=7,8,9,10,11,12,13,14\right) \end{array} \right. \end{aligned}$$
(19)

for D3Q15 model.

Fig. 1
figure 1

Lattice models. The particle velocity vectors \({\varvec{c}}_i\) are represented by arrows starting from the center of square/cube. Note that \({\varvec{c}}_0\) is defined as the zero vector in both cases

Consider a discretized equations for (14 and 15), in terms of the position \({\varvec{x}}\) and the time t using a lattice spacing \(\Delta x\) and a time step \(\Delta t\). In the following, we assume \(\Delta x=\Delta t=1\). Based on the discretization way in (Inamuro et al. 2002), we obtain the so-called lattice Boltzmann equations for \(f_i\) and \(g_i\) as follows:

$$\begin{aligned}f_i\left( {{\varvec{x}}}+{{\varvec{c}}}_i\Delta x,t+\Delta t\right) &= f_i\left( {{\varvec{x}}},t\right) \nonumber \\&\quad -\frac{1}{\tau _f}\left\{ f_i\left( {{\varvec{x}}},t\right) -f^\text {eq}_i\left( {{\varvec{x}}},t\right) \right\} \nonumber \\&\quad -3\Delta xw_i{{\varvec{c}}}_i\cdot \alpha _\gamma \left( {{\varvec{x}}}\right) {{\varvec{u}}}\left( {{\varvec{x}}},t\right) \nonumber \\&\quad +3\Delta xw_i{{\varvec{c}}}_i\cdot {\varvec{e}}g\beta \left\{ T\left( {{\varvec{x}}},t\right) -T_\text {ref}\right\} , \end{aligned}$$
(20)
$$\begin{aligned}g_i\left( {{\varvec{x}}}+{{\varvec{c}}}_i\Delta x,t+\Delta t\right) &= g_i\left( {{\varvec{x}}},t\right) \nonumber \\&\quad -\frac{1}{\tau _{g}\left( {{\varvec{x}}},t\right) }\left\{ g_i\left( {{\varvec{x}}},t\right) -g^\text {eq}_i\left( {{\varvec{x}}},t\right) \right\} . \end{aligned}$$
(21)

Besides, \(\tau _f=\varepsilon _f/\Delta x\) and \(\tau _g=\varepsilon _g/\Delta x\) are the dimensionless relaxation time.

From the asymptotic expansion theory in the LBM, the dynamic viscosity \(\nu\) and the thermal diffusivity \(K_{\gamma }\) in the LBM can be given as follows:

$$\begin{aligned} \nu&=\frac{1}{3}\left( \tau _f-\frac{1}{2}\right) \Delta x, \end{aligned}$$
(22)
$$\begin{aligned} K_\gamma&=\frac{1}{3}\left( \tau _{g}-\frac{1}{2}\right) \Delta x. \end{aligned}$$
(23)

Herein, the relaxation times \(\tau _f\) and \(\tau _{g}\) in (20 and 21) are determined so that (22 and 23) are satisfied. Besides, \(\tau _{g}\) is the function of \(\gamma\) from the definition of \(K_{\gamma }\) in (10).

2.4 Initial and boundary conditions

In order to solve the lattice Boltzmann equations in (20 and 21), appropriate initial and boundary conditions are needed for the thermal-fluid problem.

As for the initial condition, we assume that the initial values of \(f_i\) and \(g_i\) are equal to those of \(f_i^\text {eq}\) and \(g_i^\text {eq}\), as follows:

$$\begin{aligned}&f_i\left( {{\varvec{x}}},t_0\right) =f^\text {eq}_i\left( {{\varvec{x}}},t_0\right) , \end{aligned}$$
(24)
$$\begin{aligned}&g_i\left( {{\varvec{x}}},t_0\right) =g^\text {eq}_i\left( {{\varvec{x}}},t_0\right) . \end{aligned}$$
(25)

On the other hand, as for the boundary condition, many equations are proposed for thermal-fluid problems. Let us consider how to determine the boundary condition in the D2Q9 model in Fig. 1a as an example, in which \(f_i\) and \(g_i\) (\(i=2,5,6\)) are unknown at the lower boundary in the y-direction. As for the no-slip condition, we apply the so-called bounce-back condition:

$$\begin{aligned} f_2=f_4,\ f_5=f_7,\ f_6=f_8. \end{aligned}$$
(26)

In addition, as for the free-slip condition, we apply the mirror-reflection condition:

$$\begin{aligned} f_2=f_4,\ f_5=f_8,\ f_6=f_7. \end{aligned}$$
(27)

As for the prescribed temperature and heat flux conditions, we use the following equations (Inamuro et al. 2002; Yoshino and Inamuro 2003):

$$\begin{aligned} f_i=w_i\left( 1+3{{\varvec{c}}}_i\cdot {{\varvec{u}}}\right) T^\prime , \end{aligned}$$
(28)

where \(T^\prime\) is given by

$$\begin{aligned} T^\prime =\frac{6\left\{ T_\text {w}-\left( g_0+g_1+g_3+g_4+g_7+g_8\right) \right\} }{1+3u_y}, \end{aligned}$$
(29)

for the constant temperature condition and

$$\begin{aligned} T^\prime =\frac{6\left( \frac{q_y\tau _{g}}{2\tau _{g}-1}+g_4+g_7+g_8\right) }{1-3u_y}, \end{aligned}$$
(30)

for the constant heat flux condition. Herein, \(T_\text {w}\) is the prescribed temperature at the intended boundary, and \(u_y\) and \(q_y\) are the velocity and heat flux in the y-direction, respectively. Herein, the heat flux \({\varvec{q}}\) can be calculated by

$$\begin{aligned} {{\varvec{q}}}=\left( 1-\displaystyle \frac{1}{2\tau _{g}}\right) \sum _{i=0}^{Q-1}\left( {{\varvec{c}}}_i-{{\varvec{u}}}\right) g_i. \end{aligned}$$
(31)

Note that the boundary conditions for the other boundaries and the case of the D3Q15 model in Fig. 1b can be treated as the similar way discussed above.

2.5 Adjoint lattice Boltzmann method

Here, we discucss a strategy based on the adjoint lattice Boltzmann method (ALBM) (Krause et al. 2013) to derive design sensitivities for our topology optimization problems. The basic idea of the ALBM is that the adjoint equation is derived in the continuous fashion from the continuous Boltzmann equation and then is discretized using the LBM. Hence, the discretized adjoint equation can be solved in an explicit manner without any matrix operations. Although the original ALBM is supposed to use a fully continuous Boltzmann equation for the adjoint analysis, we use the discrete velocity Boltzmann equation for reflecting the practical LBM boundary conditions to the adjoint equation (Yaji et al. 2016). In the following, we discuss the derivation procedures for the adjoint equation based on the ALBM in the natural convection system described in Sects. 2.22.4.

Assuming that the objective functional J is given by the following multiple integrals with respect to the analysis domain \({\mathcal {O}}\) or its boundary \(\partial {\mathcal {O}}\) and time interval \({\mathcal {I}}\):

$$\begin{aligned} J=\int _{{\mathcal {I}}}\int _{{\mathcal {O}}}j_{{\mathcal {O}}}\text {d}\Omega \text {d}t+\int _{{\mathcal {I}}}\int _{\partial {\mathcal {O}}} j_{\partial {\mathcal {O}}} \text {d}\Gamma \text {d}t, \end{aligned}$$
(32)

where \(j_{{\mathcal {O}}}:{\mathcal {O}}\times {\mathcal {I}}\rightarrow {\mathbb {R}}\) and \(j_{\partial {\mathcal {O}}}:\partial {\mathcal {O}}\times {\mathcal {I}}\rightarrow {\mathbb {R}}\) represent the general expressions of the functions to be integrated. Let \(j_{{\mathcal {O}}}\) and \(j_{\partial {\mathcal {O}}}\) be functions of \((f_i, g_i)\) in this study.

Following the ALBM procedure, the Lagrangian L given by J and the governing equations in (14) and (15) can be expressed as

$$\begin{aligned}L&=J+\int _{{\mathcal {I}}}\int _{{\mathcal {O}}}\sum _{i=0}^{Q-1}{\tilde{f}}_i\left\{ Sh\frac{\partial f_i}{\partial t}+{{\varvec{c}}}_i\cdot \nabla f_i+\frac{1}{\varepsilon _f}\left( f_i-f^\text {eq}_i\right) \right. \nonumber \\&\quad \left. +3w_i{{\varvec{c}}}_i\cdot \alpha _\gamma {{\varvec{u}}}-3w_i{{\varvec{c}}}_i\cdot {\varvec{e}}g\beta \left( T-T_\text {ref}\right) \right\} \text {d}\Omega \text {d}t \nonumber \\&\quad +\int _{{\mathcal {I}}}\int _{\partial {\mathcal {O}}}\sum _{i=0}^{Q-1}{\tilde{g}}_i\left\{ Sh\frac{\partial g_i}{\partial t}+{{\varvec{c}}}_i\cdot \nabla g_i\right. \nonumber \\&\quad \left. +\frac{1}{\varepsilon _{g}}\left( g_i-g^\text {eq}_i\right) \right\} \text {d}\Omega \text {d}t. \end{aligned}$$
(33)

where \({\tilde{f}}_i:{\mathcal {O}}\times {\mathcal {I}}\rightarrow {\mathbb {R}}\) and \({\tilde{g}}_i:{\mathcal {O}}\times {\mathcal {I}}\rightarrow {\mathbb {R}}\) with \(i=0,1,\cdots ,Q-1\) are the Lagrange multipliers corresponding to the adjoint variable fields in the ALBM.

The sensitivity of L with respect to the design variable field \(\gamma\) is identical to that of J since the governing equations must be zero in the analysis domain. The functional derivative of L with respect to \(\gamma\) is given by

$$\begin{aligned}\langle L^\prime , \delta \gamma \rangle& = \nonumber \\&\int _{{\mathcal {I}}}\int _{{\mathcal {O}}}\sum _{i=0}^{Q-1}\frac{\partial j_{{\mathcal {O}}}}{\partial f_i}\delta f_i\text {d}\Omega \text {d}t+\int _{{\mathcal {I}}}\int _{\partial {\mathcal {O}}}\sum _{i=0}^{Q-1}\frac{\partial j_{\partial {\mathcal {O}}}}{\partial f_i}\delta f_i\text {d}\Gamma \text {d}t \nonumber \\&+\int _{{\mathcal {I}}}\int _{{\mathcal {O}}}\sum _{i=0}^{Q-1}\frac{\partial j_{{\mathcal {O}}}}{\partial g_i}\delta g_i\text {d}\Omega \text {d}t+\int _{{\mathcal {I}}}\int _{\partial {\mathcal {O}}}\sum _{i=0}^{Q-1}\frac{\partial j_{\partial {\mathcal {O}}}}{\partial g_i}\delta g_i\text {d}\Gamma \text {d}t \nonumber \\&+\int _{{\mathcal {O}}}\left. \sum _{i=0}^{Q-1}{\tilde{f}}_i\delta f_i\right| _{t_1}\text {d}\Omega +\int _{{\mathcal {I}}}\int _{\partial {\mathcal {O}}}\sum _{i=0}^{Q-1}{{\varvec{c}}}_i\cdot {{\varvec{n}}}{\tilde{f}}_i\delta f_i\text {d}\Gamma \text {d}t \nonumber \\&+\int _{{\mathcal {I}}}\int _{{\mathcal {O}}}\sum _{i=0}^{Q-1}\left\{ -Sh\frac{\partial {\tilde{f}}_i}{\partial t}-{{\varvec{c}}}_i\cdot \nabla {\tilde{f}}_i+\frac{1}{\varepsilon _f}\left( {\tilde{f}}_i-{\tilde{f}}^\text {eq}_i\right) \right. \nonumber \\&\left. +3\left( \alpha _\gamma \tilde{{{\varvec{m}}}}-\frac{T}{\varepsilon _{g}}\tilde{{{\varvec{q}}}}\right) \cdot \left( \frac{{{\varvec{c}}}_i-{{\varvec{u}}}}{\rho }\right) \right\} \delta f_i\text {d}\Omega \text {d}t \nonumber \\&+\int _{{\mathcal {O}}}\left. \sum _{i=0}^{Q-1}{\tilde{g}}_i\delta g_i\right| _{t_1}\text {d}\Omega +\int _{{\mathcal {I}}}\int _{\partial {\mathcal {O}}}\sum _{i=0}^{Q-1}{{\varvec{c}}}_i\cdot {{\varvec{n}}}{\tilde{g}}_i\delta g_i\text {d}\Gamma \text {d}t \nonumber \\&+\int _{{\mathcal {I}}}\int _{{\mathcal {O}}}\sum _{i=0}^{Q-1}\left\{ -Sh\frac{\partial {\tilde{g}}_i}{\partial t}-{{\varvec{c}}}_i\cdot \nabla {\tilde{g}}_i+\frac{1}{\varepsilon _{g}}\left( {\tilde{g}}_i-{\tilde{g}}^\text {eq}_i\right) \right. \nonumber \\&\left. -3{\varvec{e}}g\beta \cdot \tilde{{{\varvec{m}}}}\right\} \delta g_i\text {d}\Omega \text {d}t+\int _{{\mathcal {I}}}\int _{D}3\frac{\partial \alpha _\gamma }{\partial \gamma }{{\varvec{u}}}\cdot \tilde{{{\varvec{m}}}}\delta \gamma \text {d}\Omega \text {d}t \nonumber \\&-\int _{{\mathcal {I}}}\int _{D}\frac{3}{{\varepsilon _{g}}^2}\left\{ \sum _{i=0}^{Q-1}{\tilde{g}}_i\left( g_i-g^\text {eq}_i\right) \right\} \frac{\partial K_\gamma }{\partial \gamma }\delta \gamma \text {d}\Omega \text {d}t, \end{aligned}$$
(34)

where \(\delta f_i=(\partial f_i/\partial \gamma )\delta \gamma\) and \(\delta g_i=(\partial g_i/\partial \gamma )\delta \gamma\). Besides, \({{\varvec{n}}}\) represents the outward normal vector on the boundary, and \(\tilde{{\varvec{m}}}=\sum _{i=0}^{Q-1}w_i{{\varvec{c}}}_i{\tilde{f}}_i\). Let us now define the macroscopic adjoint variable fields using \({\tilde{f}}_i\) and \({\tilde{g}}_i\):

$$\begin{aligned} {\tilde{\rho }}&=\sum _{i=0}^{Q-1}w_i{\tilde{f}}_i\left\{ 1+3{{\varvec{c}}}_i\cdot {{\varvec{u}}}+\displaystyle \frac{9}{2}\left( {{\varvec{c}}}_i\cdot {{\varvec{u}}}\right) ^2-\displaystyle \frac{3}{2}\vert {{\varvec{u}}}\vert ^2\right\} , \end{aligned}$$
(35)
$$\begin{aligned} \tilde{{{\varvec{j}}}}&=\sum _{i=0}^{Q-1}w_i{\tilde{f}}_i\left\{ {{\varvec{c}}}_i+3\left( {{\varvec{c}}}_i\cdot {{\varvec{u}}} \right) {{\varvec{c}}}_i-{{\varvec{u}}}\right\} , \end{aligned}$$
(36)
$$\begin{aligned} {\tilde{T}}&=\sum _{i=0}^{Q-1}w_i{\tilde{g}}_i, \end{aligned}$$
(37)
$$\begin{aligned} \tilde{{{\varvec{q}}}}&=\sum _{i=0}^{Q-1}w_i{{\varvec{c}}}_i{\tilde{g}}_i. \end{aligned}$$
(38)

Using (35)–(38), \({\tilde{f}}^\text {eq}_i\) and \({\tilde{g}}^\text {eq}_i\) in (34) that correspond to the local equilibrium distribution functions can be written as

$$\begin{aligned}&{\tilde{f}}^\text {eq}_i={\tilde{\rho }}+3\left( {{\varvec{c}}}_i-{{\varvec{u}}}\right) \cdot \tilde{{\varvec{j}}}, \end{aligned}$$
(39)
$$\begin{aligned}&{\tilde{g}}^\text {eq}_i={\tilde{T}}+3{{\varvec{u}}}\cdot \tilde{{\varvec{q}}}, \end{aligned}$$
(40)

It should be noted that although the derivation of the Lagrangian L contains its partial derivative with respect to \(\gamma\) in general, we drop it for simplicity because J does not explicitly contain \(\gamma\) in this paper. In addition, boundary condition terms should be included to L, but it becomes complicated and depends on the lattice model. Hence, we also drop the boundary condition terms for simplicity.

To determine \({\tilde{f}}_i\) and \({\tilde{g}}_i\) as the adjoint variable field from (34), we consider the following equations:

$$\begin{aligned}-Sh\frac{\partial {\tilde{f}}_i}{\partial t}-{{\varvec{c}}}_i\cdot \nabla {\tilde{f}}_i&=-\frac{1}{\varepsilon _f}\left( {\tilde{f}}_i-{\tilde{f}}^\text {eq}_i\right) \nonumber \\&\quad -3\left( \alpha _\gamma \tilde{{{\varvec{m}}}}-\frac{T}{\varepsilon _{g}}\tilde{{{\varvec{q}}}}\right) \cdot \left( \frac{{{\varvec{c}}}_i-{{\varvec{u}}}}{\rho }\right) -\frac{\partial j_{{\mathcal {O}}}}{\partial f_i}, \end{aligned}$$
(41)
$$\begin{aligned}-Sh\frac{\partial {\tilde{g}}_i}{\partial t}-{{\varvec{c}}}_i\cdot \nabla {\tilde{g}}_i&=-\frac{1}{\varepsilon _{g}}\left( {\tilde{g}}_i-{\tilde{g}}^\text {eq}_i\right) \nonumber \\&\quad +3{\varvec{e}}g\beta \cdot \tilde{{{\varvec{m}}}}-\frac{\partial j_{{\mathcal {O}}}}{\partial g_i}. \end{aligned}$$
(42)

Note that the adjoint equations closely resemble the original discrete velocity Boltzmann equations in (14) and (15) and therefore can be solved using the LBM, as follows:

$$\begin{aligned}&{\tilde{f}}_i\left( {\varvec{x}}-\Delta x,t-\Delta t\right) ={\tilde{f}}_i\left( {\varvec{x}},t\right) -\frac{1}{\tau _f}\left\{ {\tilde{f}}_i\left( {\varvec{x}},t\right) -{\tilde{f}}^\text {eq}_i\left( {\varvec{x}},t\right) \right\} \nonumber \\&\quad -3\Delta x\alpha _\gamma \left( {\varvec{x}}\right) \left\{ \frac{{{\varvec{c}}}_i-{{\varvec{u}}}\left( {\varvec{x}},t\right) }{\rho \left( {\varvec{x}},t\right) }\right\} \cdot \tilde{{{\varvec{m}}}}\left( {\varvec{x}},t\right) \nonumber \\&\quad +\frac{3\Delta xT}{\tau _{g}\left( {{\varvec{x}}},t\right) }\left\{ \frac{{{\varvec{c}}}_i-{{\varvec{u}}}\left( {\varvec{x}},t\right) }{\rho \left( {\varvec{x}},t\right) }\right\} \cdot \tilde{{{\varvec{q}}}}\left( {\varvec{x}},t\right) -\Delta x\frac{\partial j_{{\mathcal {O}}}}{\partial f_i}\left( {\varvec{x}},t\right) , \end{aligned}$$
(43)
$$\begin{aligned}{\tilde{g}}_i\left( {\varvec{x}}-\Delta x,t-\Delta t\right)& ={\tilde{g}}_i\left( {\varvec{x}},t\right) -\frac{1}{\tau _{g}\left( {{\varvec{x}}},t\right) }\left\{ {\tilde{g}}_i\left( {\varvec{x}},t\right) -{\tilde{g}}^\text {eq}_i\left( {\varvec{x}},t\right) \right\} \nonumber \\&\quad +3\Delta x{\varvec{e}}g\beta \cdot \tilde{{{\varvec{m}}}}\left( {\varvec{x}},t\right) -\Delta x\frac{\partial j_{{\mathcal {O}}}}{\partial g_i}\left( {\varvec{x}},t\right) . \end{aligned}$$
(44)

Similar to treating the lattice Boltzmann equation, the initial and the boundary conditions are needed for solving (43 and 44). Due to the nature of the time-dependent optimization problem, the above adjoint equations need to be solved backward in time from the final time \(t_1\) to the initial time \(t_0\) in the original time interval \({\mathcal {I}}\). These terminal conditions can be derived from the fifth and eighth terms of the right-hand side in (34), as follows:

$$\begin{aligned}&{\tilde{f}}_i\left( {\varvec{x}},t_1\right) =0, \end{aligned}$$
(45)
$$\begin{aligned}&{\tilde{g}}_i\left( {\varvec{x}},t_1\right) =0. \end{aligned}$$
(46)

Besides, the boundary conditions can be determined from the second, fourth, sixth and nineth terms of the right-hand side in (34). Here, we notice that the velocity distribution functions for particles flowing outside on the prescribed boundary must be applied since the direction of the fictitious particles for the ALBM is opposite to those for the LBM. In the following, we will discuss briefly how to determine the boundary conditions for the 2D problem by using the D2Q9 model as an example. Assuming that the boundary is located at the lower side in the y-direction, which is the same manner to solve the lattice Boltzmann equation. For the case of the no-slip condition, the following equation can be derived by applying the bounce-back condition to (34) as

$$\begin{aligned} {\tilde{f}}_4={\tilde{f}}_2,\ {\tilde{f}}_7={\tilde{f}}_5,\ {\tilde{f}}_8={\tilde{f}}_6. \end{aligned}$$
(47)

For the case of free-slip condition, the following equation can be derived by considering the mirror-reflect condition as

$$\begin{aligned} {\tilde{f}}_4={\tilde{f}}_2,\ {\tilde{f}}_7={\tilde{f}}_6,\ {\tilde{f}}_8={\tilde{f}}_5. \end{aligned}$$
(48)

In addition, as for the constant temperature condition, the following equations can be derived by substituting (28) with (29) into (34) as

$$\begin{aligned}&{\tilde{g}}_4={\tilde{g}}_7={\tilde{g}}_8\nonumber \\&\quad =-\frac{1}{6}\left( 4{\tilde{g}}_2+{\tilde{g}}_5+{\tilde{g}}_6\right) -\frac{u_x}{1+3u_y}\left( {\tilde{g}}_5-{\tilde{g}}_6\right) . \end{aligned}$$
(49)

As for the constant heat flux condition, the following equations can be derived by substituting (28) with (30) into (34) as

$$\begin{aligned} {\tilde{g}}_2=&{\tilde{g}}_5={\tilde{g}}_6\nonumber \\ =&\frac{1+3u_y}{6\left( 1-3u_y\right) }\left( 4{\tilde{g}}_2+{\tilde{g}}_5+{\tilde{g}}_6\right) \nonumber \\&+\frac{u_x}{2\left( 1-3u_y\right) }\left( {\tilde{g}}_5-{\tilde{g}}_6\right) . \end{aligned}$$
(50)

Consequently, the sensitivity \(L^\prime =J^\prime\) can be obtained from

$$\begin{aligned}\langle L^\prime , \delta \gamma \rangle& = \int _{{\mathcal {I}}}\int _D\left\{ 3\frac{\partial \alpha _\gamma }{\partial \gamma }{{\varvec{u}}}\cdot \tilde{{{\varvec{m}}}}\right. \nonumber \\&\quad \left. -\frac{3}{{\varepsilon _{g}}^2}\sum _{i=0}^{Q-1}{\tilde{g}}_i\left( g_i-g^\text {eq}_i\right) \frac{\partial K_\gamma }{\partial \gamma }\right\} \delta \gamma \text {d}\Omega \text {d}t. \end{aligned}$$
(51)

Note that the sensitivity for a constraint, \(G^\prime\), can also be obtained from the same way by replacing J with G, where \(j_{\mathcal {O}}\) and \(g_{\mathcal {O}}\) are respectively replaced by \(j_{\partial {\mathcal {O}}}\) and \(g_{\partial {\mathcal {O}}}\) in (32). Besides, when setting a prescribed heat flux condition, the gradient of the thermal diffusivity \(K_\gamma\) must be considered in the sensitivity equation. Hence, when the value of the prescribed heat flux on the boundary is not equal to zero, the following term must be added into (51).

$$\begin{aligned}&\langle S_q^\prime ,\delta \gamma \rangle = \int _{{\mathcal {I}}}\int _{\Gamma _q}\frac{q_\text {n}}{36\left( 1-3u_y\right) K_\gamma ^2}\frac{\partial K_\gamma }{\partial \gamma }\nonumber \\&\quad \left\{ \left( 1+3u_y\right) \left( 4{\tilde{g}}_2+{\tilde{g}}_5+{\tilde{g}}_6\right) +3u_y\left( {\tilde{g}}_5-{\tilde{g}}_8\right) \right\} \delta \gamma \text {d}\Gamma \text {d}t, \end{aligned}$$
(52)

where \(\Gamma _q\) is the boundary at which the heat flux \(q_\text {n}={\varvec{q}}\cdot {\varvec{n}}\) is applied.

2.6 Dimensionless parameters

The previous study (Alexandersen et al. 2014) reported that the balance between the convection-dominated heat transfer and the diffusion-based heat transfer would affect the optimized shape significantly in topology optimization for natural convection problems.

In this study, the Rayleigh number and the Prandtl number are introduced to describe the thermal-flow state. The definitions of these dimensionless parameters are given as follows:

$$\begin{aligned} Ra=\frac{g\beta \Delta TL^3}{\nu K_\text {f}} \end{aligned}$$
(53)

for the Rayleigh number which describes the ratio between the buoyancy force and the thermal diffusivity, and

$$\begin{aligned} Pr=\frac{\nu }{K_\text {f}} \end{aligned}$$
(54)

for the Prandtl number which describes the relative spreading of viscous and thermal effects. In the above, \(\Delta T\) is the reference temperature difference, L is the reference length scale, and \(\nu\) is the kinematic viscosity of the fluid.

3 Numerical implementation

3.1 Optimization algorithm

The numerical procedure of our proposed method is described as follows:

\({ Step\; 1}\):

The design variable field \(\gamma\) is initialized on the analysis domain discretized using square lattice mesh.

\({ Step\; 2}\):

The state variable fields \(\rho\), \({\varvec{u}}\), T, \({\varvec{q}}\) are computed using the LBM.

\({ Step\; 3}\):

The values of the objective functional J and the constraint functional G are computed.

\({ Step\; 4}\):

The adjoint variable fields \({\tilde{\rho }}\), \(\tilde{{\varvec{j}}}\), \({\tilde{T}}\), \(\tilde{{\varvec{q}}}\) are computed using the ALBM.

\({ Step\; 5}\):

The design sensitivities \(J^\prime\) and \(G^\prime\) are computed from the state and adjoint variable fields.

\({ Step\; 6}\):

The design variable field \(\gamma\) is updated using the method of moving asymptotes (MMA) (Svanberg 1987).

\({ Step\; 7}\):

The procedure returns to the Step 2 of the iteration loop until the following criterion is met:

$$\begin{aligned} \left\| \gamma ^{k+1}-\gamma ^k\right\| _{L^\infty (D)}\leqslant \varepsilon _\text {opt}, \end{aligned}$$
(55)

where superscript k represents the number of iterations carried out during the process. In this study, the criterion is set to \(\varepsilon _\text {opt}=0.01\) for all numerical examples in Sect. 4.

As for the MMA, it is widely known that the algorithm is suited for nonlinear optimization problems with a large number of design variables and few constraints. In this study, the move limit is set to 0.2, and the otherwise, the default values are set in our calculation.

3.2 Approximate procedure for a steady-state problem

Although the main focus of this study is unsteady natural convection problems, we will solve a steady-state natural convection problem for the verification of the proposed framework in Sect. 4.1. It is known that the computational cost can be reduced in LBM-based topology optimization for steady-state problems (Yaji et al. 2014; Liu et al. 2014). The basic idea of this reduction technique is that the converged state and adjoint variable fields at each optimization step are used as an initial value for solving the time evolution equations in the next optimization step.

As for the state variable field, we use the following convergence criteria for the steady-state condition:

$$\begin{aligned} \frac{\left\| {{\varvec{u}}}({\varvec{x}},t+\Delta t)-{{\varvec{u}}}({\varvec{x}},t)\right\| _{L^2(D)}}{\left\| {{\varvec{u}}}({\varvec{x}},t)\right\| _{L^2(D)}}&\leqslant \epsilon _u , \end{aligned}$$
(56)
$$\begin{aligned} \frac{\left\| {{\varvec{q}}}({\varvec{x}},t+\Delta t)-{{\varvec{q}}}({\varvec{x}},t)\right\| _{L^2(D)}}{\left\| {{\varvec{q}}}({\varvec{x}},t)\right\| _{L^2(D)}}&\leqslant \epsilon _q, \end{aligned}$$
(57)

where \(\epsilon _u\) and \(\epsilon _q\) represent the criteria for the steady-state condition of fluid velocity and heat flux, respectively. Hereinafter, the state variable fields for the density, velocity, temperature and heat flux under the steady-state condition are denoted as \(\rho ^*\), \({\varvec{u}}^*\), \(T^*\), \({\varvec{q}}^*\), respectively. At the first optimization step (\(k=0\)), (24) and (25) are used as initial conditions, and the second step onwards, the converged values of \(\rho ^*\), \({\varvec{u}}^*\), \(T^*\), \({\varvec{q}}^*\) at the former step are used as the initial conditions for the current step. In other words, we use the following equations as the initial conditions:

$$\begin{aligned} f_i\left( {\varvec{x}},t_0\right)&=f^\text {eq}_i\left( {\varvec{x}},\rho ^*,{\varvec{u}}^*\right) , \end{aligned}$$
(58)
$$\begin{aligned} g_i\left( {\varvec{x}},t_0\right)&=g^\text {eq}_i\left( {\varvec{x}},T^*,{\varvec{u}}^*\right) . \end{aligned}$$
(59)

As for the adjoint variable fields, \(\rho ^*\), \({\varvec{u}}^*\), \(T^*\), \({\varvec{q}}^*\) are used for (41) and (42), and the adjoint variable fields are calculated until they converge. The convergence criteria for the steady-state condition of the adjoint variable fields are defined as follows:

$$\begin{aligned} \frac{\left\| \tilde{{\varvec{j}}}({\varvec{x}},t-\Delta t)-\tilde{{\varvec{j}}}({\varvec{x}},t)\right\| _{L^2(D)}}{\left\| \tilde{{\varvec{j}}}({\varvec{x}},t)\right\| _{L^2(D)}}&\leqslant \epsilon _{{\tilde{j}}}, \end{aligned}$$
(60)
$$\begin{aligned} \frac{\left\| \tilde{{\varvec{q}}}({\varvec{x}},t-\Delta t)-\tilde{{\varvec{q}}}({\varvec{x}},t)\right\| _{L^2(D)}}{\left\| \tilde{{\varvec{q}}}({\varvec{x}},t)\right\| _{L^2(D)}}&\leqslant \epsilon _{{\tilde{q}}}, \end{aligned}$$
(61)

where \(\epsilon _{{\tilde{j}}}\) and \(\epsilon _{{\tilde{q}}}\) represent the criteria for the steady-state condition of \(\tilde{{\varvec{j}}}\) and \(\tilde{{\varvec{q}}}\), respectively. Note that since the direction of the time evolution of the ALBM is opposite with the LBM, the convergence criteria in (60) and (61) are different from (56) and (57), in terms of the time step. Using the similar notation with the state variable fields, the adjoint variable fields under the steady-state condition are denoted by \({\tilde{\rho }}^*\), \(\tilde{{\varvec{j}}}^*\), \({\tilde{T}}^*\), \(\tilde{{\varvec{q}}}^*\), respectively. Besides, at the second step onwards in the optimization process, \({\tilde{\rho }}^*\), \(\tilde{{\varvec{u}}}^*\), \({\tilde{T}}^*\), \(\tilde{{\varvec{q}}}^*\) calculated at the former step are used as the final time values that corresponds to the initial condition for the adjoint equations. Hence, we employ the following equations for \({\tilde{f}}_i\) and \({\tilde{g}}_i\) at \(t=t_1\):

$$\begin{aligned} {\tilde{f}}_i\left( {\varvec{x}},t_1\right)&={\tilde{f}}^\text {eq}_i\left( {\varvec{x}},{\varvec{u}}^*,{\tilde{\rho }}^*,\tilde{{\varvec{j}}}^*\right) , \end{aligned}$$
(62)
$$\begin{aligned} {\tilde{g}}_i\left( {\varvec{x}},t_1\right)&={\tilde{g}}^\text {eq}_i\left( {\varvec{x}},{\varvec{u}}^*,{\tilde{T}}^*,\tilde{{\varvec{q}}}^*\right) . \end{aligned}$$
(63)

Finally, the sensitivities for the steady-state problem can be expressed as

$$\begin{aligned}\langle L^\prime , \delta \gamma \rangle& = \int _D\left\{ 3\frac{\partial \alpha _\gamma }{\partial \gamma }{{\varvec{u}}}^*\cdot \tilde{{{\varvec{m}}}}^*\right. \nonumber \\&\quad \left. -\frac{3}{{\varepsilon _{g}}^2}\sum _{i=0}^{Q-1}{\tilde{g}}_i^*\left( g_i^*-g^\text {eq}_i(T^*,{\varvec{u}}^*)\right) \frac{\partial K_\gamma }{\partial \gamma }\right\} \delta \gamma \text {d}\Omega . \end{aligned}$$
(64)

3.3 Approximate procedure for a periodic problem

In Sect. 4.3, we will investigate an unsteady natural convection problem, in which the state variable fields are periodically steady-state. Ideally, the state variable fields must be recorded for all time steps, including the developing phase that does not achieve the periodically steady-state, and the adjoint equations are then solved using the results of the state variable fields. However, it results in prohibitive memory requirements in large-scale problems.

To suppress the amount of required memory, we divide \({\mathcal {I}}\) into two intervals, namely, the developing interval \({\mathcal {I}}_0=[t_0,t^\dagger )\) and the periodically steady-state interval \({\mathcal {I}}_1=[t^\dagger , t_1]\). In \({\mathcal {I}}_0\), the state variable fields are stored at the final time step only, as our interest is periodically steady-state. On the other hand, all the state variable fields are stored for solving the adjoint equations in \({\mathcal {I}}_1\). In practice, we skip to calculate the state variable fields in \({\mathcal {I}}_0\) and their initial conditions at \((k+1)\)-optimization step are defined as those of the final time at k-optimization step. That is, each initial condition for the state variable fields are given by

$$\begin{aligned}&f^{k+1}_i\left( {\varvec{x}},t^\dagger \right) =f^k_i\left( {\varvec{x}},t_1\right) , \end{aligned}$$
(65)
$$\begin{aligned}&g^{k+1}_i\left( {\varvec{x}},t^\dagger \right) =g^k_i\left( {\varvec{x}},t_1\right) . \end{aligned}$$
(66)

The advantage of using (65) and (66) is that the state variable fields are expected to rapidly achieve periodically steady-state, as long as drastically topological changes are disallowed, in comparison with the case in which the state variable fields are initialized every optimization step. Note that \({\mathcal {I}}_0\) with \(t^\dagger =t_1\) is used for computing the state variable field at the initial optimization step (\(k=0\)). Additionally, the adjoint variable fields are computed in the same manner discussed above, and their initial conditions can be given by

$$\begin{aligned}&{\tilde{f}}^{k+1}_i\left( {\varvec{x}},t_1\right) ={\tilde{f}}^k_i\left( {\varvec{x}},t^\dagger \right) , \end{aligned}$$
(67)
$$\begin{aligned}&{\tilde{g}}^{k+1}_i\left( {\varvec{x}},t_1\right) ={\tilde{g}}^k_i\left( {\varvec{x}},t^\dagger \right) . \end{aligned}$$
(68)

Herein, (67) and (68) are used in Sect. 4.3 and are given under the assumption that drastically topological changes are disallowed. In addition, we define \(t^\dagger\) as a reasonable value for each optimization problem by preliminary computation.

4 Numerical examples

4.1 2D steady-state problem

We first conduct a verification check of the proposed method through comparison with results of the previous research on a 2D heat sink design problem concerning steady-state natural convection (Alexandersen et al. 2014). Fig. 2 shows the dimensions and boundary conditions for the analysis domain. Herein, the reference length is defined as the height of the analysis domain, namely, \(L=160\Delta x\). Since the proposed method is developed for unsteady flow problems, we suppose that the natural convection is driven by a heat source and finally converges to the steady-state flow.

Fig. 2
figure 2

Design settings of the 2D heat sink. The gray region represents the fixed design domain D

Fig. 3
figure 3

Optimized configurations of the 2D steady-state heat sink

Fig. 4
figure 4

Distribution of \(\Vert {\varvec{u}}\Vert\) \(\left( \times 10^{-3}\right)\) and T on optimized configurations in the 2D steady-state heat sink

Fig. 5
figure 5

Optimized configurations of the 2D transient heat sink

Fig. 6
figure 6

Distribution of \(\Vert {\varvec{u}}\Vert\) \(\left( \times 10^{-3}\right)\) and T on optimized configurations in the 2D transient heat sink

Fig. 7
figure 7

Optimized configurations of the transient 2D heat sink

The objective functional is defined as the average temperature at the heated boundary \(\Gamma _\text {SC}\):

$$\begin{aligned} J=\frac{\int _{\Gamma _\text {SC}}T\text {d}\Gamma }{\int _{\Gamma _\text {SC}}\text {d}\Gamma }. \end{aligned}$$
(69)

Besides, we consider a volume constraint in terms of the solid region, given by

$$\begin{aligned} G=\frac{\int _D\left( 1-\gamma \right) \text {d}\Omega }{v_\text {s}\int _D\text {d}\Omega }-1 , \end{aligned}$$
(70)

where we set \(v_\text {s}=0.5\) that corresponds to impose the \(50\%\) allowable solid volume as a constraint.

The heat flux at \(\Gamma _\text {SC}\) is set to \(q_0=1.0\times 10^{-2}\). The Prandtl number Pr and the reference temperature \(T_\text {ref}\) are set to 6.0 and 0, respectively. The thermal conductivity of the solid is set to \(K_\text {s}=10K_\text {f}\), where that of the fluid is given by \(K_\text {f}=\nu /Pr\) from (54). The kinematic viscosity is set to \(\nu =0.1\) for all numerical examples in this study. The initial configuration is defined as a uniform distribution, \(\gamma =0.5\). In addition, the parameters \(\epsilon _u\), \(\epsilon _q\), \(\epsilon _{{\tilde{u}}}\), \(\epsilon _{{\tilde{q}}}\) relating the convergence criteria are all set to \(1.0\times 10^{-6}\). It should be noted that the parameters mentioned above are different from the previous work (Alexandersen et al. 2014) since the LBM used in this study is difficult to realize the same \(\nu\), \(K_\text {f}\) and \(K_\text {s}\) settings due to the limitation of the BGK model. Other riched LBM models, such as the multi-relaxation time (MRT)-LBM (Li et al. 2016), may achieve those, but it is beyond the scope of this paper.

To avoid generating the checkerboard pattern, we employ the density filter (Bourdin 2001), in which the filter radius is set to \(2.4\Delta x\) in this study. Furthermore, we use a Heaviside projection (Wang et al. 2011) to remove the grayscale generated by the density filter, where the threshold parameter \(\eta\) is set to 0.5 and the sharpness parameter \(\beta\) is doubled every 100 optimization steps from 1 to 16.

Let us now discuss the dependency of the optimized shapes with respect to the Rayleigh number Ra. Figure 3 shows the optimized designs for \(Ra=2.0\times 10^3\), \(1.0\times 10^4\) and \(5.0\times 10^4\), respectively. The iteration numbers to achieve each optimized design are 893 (Fig. 3a), 565 (Fig. 3b), and 449 (Fig. 3c), respectively.

As mentioned in the previous work (Alexandersen et al. 2014), a branched tree-like structure is obtained as the optimized design under a small Ra setting; on the other hand, a simple structure composed of smaller and shorter branches is obtained under a larger Ra setting. This is because that conduction and convection are respectively dominant when low and high Ra settings. In fact, as shown in Fig. 4, it can be confirmed that the effect of natural convection in terms of the magnitude of the fluid velocity is stronger when setting larger Ra.

Table 1 shows the objective functional values of the optimized designs under different Ra settings for a crosscheck. The result indicates that each optimized design is reasonable as they perform better than the others for its particular Ra settings. Consequently, it can be confirmed that the proposed framework can provide appropriate solutions under the investigated steady-state condition.

Table 1 Crosscheck of objective functional values for the 2D steady-state heat sink shown in Fig. 3

4.2 2D transient problem

As the second numerical example, we tackle a 2D heat sink design problem concerning transient natural convection, which is regarded as an expansion of the steady-state case discussed in Sect. 4.1. In Sect. 4.2, we demonstrate that the optimized designs considering the undeveloped phase of natural convection achieve different shapes in comparison with those of the steady-state case.

We consider that the objective functional for the transient problem is defined as the time-averaged one of (69):

$$\begin{aligned} J=\frac{\int _{{\mathcal {I}}}\int _{\Gamma _\text {SC}}T\text {d}\Gamma \text {d}t}{\int _{{\mathcal {I}}}\text {d}t\int _{\Gamma _\text {SC}}\text {d}\Gamma }, \end{aligned}$$
(71)

where, the time interval is set to \({\mathcal {I}}=\left[ 0,t_1\right]\), in which we investigate the effect of the optimized results with respect to \(t_1\). Otherwise, the dimensions and parameter settings are same with those of the steady-state problem in Sect. 4.1. Note that, for forced convection problems, Zeng et al. (2020) demonstrated a transient formulation is effective for instantaneous chip cooling problems rather than a steady-state formulation.

Figure 5 shows the optimized configurations, and Fig. 6 shows the velocity magnitude and temperature for three cases of \(t_1\). Here, the Rayleigh number is set to \(Ra=2.0\times 10^5\). It can be confirmed that the temperature field concentrically propagates along with the undeveloped velocity field when a small \(t_1\) setting. On the other hand, when a large \(t_1\) setting, the temperature field propagates to the upper region with the developed velocity field. Notably, although \(Ra=2.0\times 10^5\) in Fig. 5 is a convection-dominant setting for the steady-state case disucussed in Sect. 4.1, conduction-dominant structure that has many needle-like structure is obtained under a small \(t_1\) setting. This is because the objective functional in this optimization problem is defined as the time integral in terms of \(\left[ 0,t_1\right]\). Therefore, the undeveloped phase occupies the majority of the interval if a small \(t_1\) setting.

Table 2 shows the objective functional values of the optimized configuration under different \(t_1\) settings for a crosscheck. As can be confirmed in Table 2, each optimized configuration is reasonable as they perform better than the others for its particular \(t_1\) settings.

Table 2 Crosscheck of objective functional values for the transient 2D heat sink shown in Fig. 5

Figure 7 shows the optimized configurations for three cases of the Rayleigh number \(Ra=5.0\times 10^4\), \(1.0\times 10^5\) and \(2.0\times 10^5\), respectively. Here, \(t_1\) is set to \(1.5\times 10^5\) for both cases. Similar to the case in the steady-state problem, the optimized configuration in the transient problem appears to have large convection cells when setting the larger Ra.

Let us discuss the dependency of the optimized configuration with respect to \(t_1\) and Ra from the perspective of the dominant heat transfer mechanism for the transient problems. For this, we introduce the cumulative norm of flow velocity, \(U_\text {cn}\), given by

$$\begin{aligned} U_\text {cn}=\int _{0}^{t_1}\left\| {{\varvec{u}}}({\varvec{x}}, t)\right\| _{L^2(D)}\text {d}t. \end{aligned}$$
(72)

We use \(U_\text {cn}\) to evaluate the magnitude of convection in terms of the accumulation of the velocity norm at each optimized configuration.

Figure 8 shows the relationship between \(t_1\) and \(U_\text {cn}\) for three Ra settings, including the optimized shapes at each \(t_1\) setting. As discussed in Sect. 4.1, since convection plays a significant role in the heat transfer when larger \(t_1\) and Ra settings that correspond to a larger \(U_\text {cn}\), it can be confirmed that the optimized shapes tend to be simpler. Interestingly, around \(U_\text {cn}=100\) in Fig. 8, it can be confirmed that both optimized configurations look similar, as can be also seen in Figs. 5b and 7b. This result indicates that \(U_\text {cn}\) can be a dominant factor to determine the optimized shape for any \(t_1\) and Ra settings.

It should be noted that the optimized designs in Figs. 5c and 7c contain small grayscale islands. Their effect on performance is negligible since the relative error between the optimized design and its binarized one is 0.45%.

Fig. 8
figure 8

Cumulative norm of flow velocity, \(U_\text {cn}\), with respect to the ending time \(t_1\), calculated on an initial configuration in the 2D transient heat sink. Each optimized shape is displayed on the graph

To further investigate the obtained result on a different perspective, we conduct a high-fidelity analysis using the body-fitted mesh on the boundary of the optimized designs. Figure 9 shows comparison results on fluid velocity and temperature between the high-fidelity and the original analyses at the final time step in the case of \(t_1=1.0\times 10^5\). It can be observed that the distributions are similar to each other. On the other hand, the relative infinity norms based on each original result, in terms of fluid velocity and temperature, are 16.3% and 5.56%, respectively. Table 3 shows the crosscheck of the objective functional values of the high-fidelity analysis for Fig. 5. The maximum relative error, based on Table 2, is 6.02% between the high-fidelity and the original results.

Table 3 Crosschek of objective functional values for the transient 2D heat sink shown in Fig. 5 using the body-fitted mesh
Fig. 9
figure 9

Velocity(\(\times 10^{-3}\)) (left) and temperature (right) distributions on original and body-fitted analyses

Since the exact boundary is given in the body-fitted model, the heat transfer coefficient h can be precisely obtained from the high-fidelity analysis. As a useful dimensionless number using h, let us now check the Biot number:

$$\begin{aligned} Bi=\frac{hL}{k}, \end{aligned}$$
(73)

where k is the thermal conductivity of the solid, and h is calculated as its average in terms of time between 0 and \(1.5\times 10^5\). According to the previous work on the optimal shape of a fin in natural convection (Alexandersen and Sigmund 2021), the length of the optimal fin at smaller Bi is longer. The Biot numbers of the optimized design for Fig. 5 are \(Bi=0.2903, 0.3351, 0.7550\), respectively. Hence, it can be confirmed that our results also have the relationship between Bi and the fin length corresponding to the perimeter of the solid.

4.3 2D periodic problem

As the third example, we treat a 2D micropump design problem. Figure 10 shows the layout and boundary conditions of the micropump design problem, in which the fluid motion is driven by the heated boundary condition on the lower left side. A similar design setting has already been investigated by Alexandersen et al. (2014) for a steady-state problem; on the other hand, we consider an unsteady problem in which the temperature is periodically changed as

$$\begin{aligned} T\left( t\right) =\left( T_\text {h}-T_\text {l}\right) \left\{ 1-\cos {\left( \frac{2\pi t}{t_\text {p}}\right) }\right\} +T_\text {l}, \end{aligned}$$
(74)

where, \(T_\text {l}\) represents the temperature on the lower right side, and \(T_\text {h}\) \((>T_\text {l})\) represents the amplitude of the temperature variation. Besides, \(t_\text {p}\) denotes a time for the one cycle. In this study, \(T_\text {l}\) and \(T_\text {h}\) are set to 0 and 1, respectively. Note that the reference temperate difference is defined as \(\Delta T=T_\text {h}-T_\text {l}=1\) for calculating Ra. The reference temperature \(T_\text {ref}\) in (7) is given by \(\left( T_\text {h}+T_\text {l}\right) /2=1/2\). In addition, the values of Prandtl number and Rayleigh number are set to \(Pr=1.0\) and \(Ra=1.0\times 10^3\), respectively.

Fig. 10
figure 10

Design settings of the 2D periodic micropump. The gray region represents the fixed design domain D

Let us introduce the following objective functional for designing an unsteady micropump under the periodically steady-state interval \({\mathcal {I}}_1=[t^\dagger ,t_1]\) discussed in Sect. 3.3, as follows:

$$\begin{aligned} J=\zeta \frac{1}{t_1-t^\dagger }\int _{{\mathcal {I}}_1} j_t\left( t\right) \text {d}t +\left( 1-\zeta \right) \sqrt{V\left[ j_t\left( t\right) \right] }, \end{aligned}$$
(75)

where,

$$\begin{aligned} j_t\left( t\right)= & {} -\int _{\Gamma _\text {MF}}{\varvec{u}}\left( t\right) \cdot {\varvec{n}}\text {d}\Gamma , \end{aligned}$$
(76)
$$\begin{aligned} V\left[ x\right]= & {} \frac{1}{t_1-t^\dagger }\int ^{t_1}_{t^\dagger }{x\left( t\right) }^2\text {d}t-\left( \frac{1}{t_1-t^\dagger }\int ^{t_1}_{t^\dagger }x\left( t\right) \text {d}t\right) ^2, \end{aligned}$$
(77)

and \(\zeta\) represents a weight parameter varying from 0 to 1. Note that (76, 77) has the negative sign to replace the maximization problem with the minimization one. Here, the first term on the right-hand side in (75) represents the time-averaged mass flow through the boundary \(\Gamma _\text {MF}\), and the second term represents the standard deviation of the mass flow. Therefore, minimizing (75) intends to enhance the mass flow as well as to reduce its fluctuation.

Since it is difficult to identify a periodic steady-state condition, we used a fixed \(t^\dagger =1.0\times 10^6\) determined by our preliminary investigation for this numerical example. As shown in Fig. 11, it can be confirmed that the mass flow \(j_t\) achieves the periodic steady-state.

As a constraint, we introduce

$$\begin{aligned} G=\frac{\int _D\gamma \text {d}\Omega }{v_\text {f}\int _D\text {d}\Omega }-1, \end{aligned}$$
(78)

where the upper bound of the fluid volume rate is set to \(v_\text {f}=0.5\). Besides, the initial configuration is set to \(\gamma =0.5\).

In contrast to the heat sink design problem discussed in Sects. 4.1 and 4.2, we do not use the filter and projection scheme to the miropump design problem, as there is no chance to occur checkerboard pattern in the obtained designs. On the other hand, to reduce the intermediate relative densities, the parameter \(q_\alpha\) in (8) is initially set to \(1.0\times 10^{-6}\) and multiplied by 10 at every 100 optimization steps or until the convergence criterion in (55) is satisfied. This procedure is repeated until \(q_\alpha =1.0\times 10^{-2}\) and (55) are met.

Figure 12 shows the comparison result of the optimized configurations for three cases of the weight parameter, i.e., \(\zeta =0.25, 0.50, 0.75\). Here, the time of the one cycle is set to \(t_\text {p}=5.0\times 10^4\). The influence of \(\zeta\) on the obtained configurations can be interpreted as follows. When the parameter \(\zeta\) is a relatively small value, J in (75) tends to emphasize the standard deviation of the mass flow across \(\Gamma _\text {MF}\). Therefore, more solid parts should be located around the heated boundary to reduce the fluctuation of the mass flow through \(\Gamma _\text {MF}\). On the other hand, when the parameter \(\zeta\) is a relatively large value, J in (75) tends to emphasize the amount of the mass flow across \(\Gamma _\text {MF}\). In this situation, the flow channel must be heated quickly to boost the upwind flow by natural convection to enhance the amount of the mass flow through \(\Gamma _\text {MF}\). Consequently, the optimized shape of the flow channel becomes symmetrical about the vertical midplane.

Fig. 11
figure 11

The behavior of mass flow \(j_t\) overall time in the 2D periodic micropump at ζ = 0.25

Fig. 12
figure 12

Effect of \(\zeta\) settings on optimized configurations in the 2D periodic micropump

Figure 13 represents the variation of the mass flow \(j_t\left( \tau \right)\), in which \(\tau =t-t^\dagger\) is defined, observed at the cross-section \(\Gamma _\text {MF}\) in the optimized configuration for the one cycle \(t_\text {p}\). In addition, the dashed lines in Fig. 13 represent the time-average value of \(j_t\left( \tau \right)\) for the three cases and are given by

$$\begin{aligned} \overline{j_t} = \frac{\int _{0}^{t_\text {p}} j_t\left( \tau \right) \text {d}\tau }{t_\text {p}}. \end{aligned}$$
(79)

As shown in Fig. 13, the oscillation \(j_t\left( \tau \right)\) and each average value \(\overline{j_t}\) increase as the weight parameter \(\zeta\) increases.

Fig. 13
figure 13

Variation of the mass flow \(j_t\) with respect to \(\tau =t-t^\dagger\) observed at the cross-section \(\Gamma _\text {MF}\) in Fig. 10b

Fig. 14
figure 14

Temperature distribution along with flow velocity vectors on an optimized configuration for \(\zeta =0.25\)

Fig. 15
figure 15

Temperature distribution along with flow velocity vectors on an optimized configuration for \(\zeta =0.75\)

Figures 14 and 15 show variations of the temperature distribution with the velocity vectors in the optimized configurations for two cases of weight parameter \(\zeta =0.25\) and 0.75, respectively. For the case of the lower weight \(\zeta =0.25\), the flow channel is located to circumvent the heated boundary. This is because the main purpose of the case of \(\zeta =0.25\) is to reduce the variation of \(j_t\), which corresponds to avoiding the region of the large fluctuated T. Consequently, almost a uniform norm of the flow velocity can be observed throughout the channel, as shown in Fig. 14. On the other hand, for the case of the higher weight \(\zeta =0.75\), the fluid passing through the channel is heated effectively, and a large amount of mass flow is transformed to the observation line \(\Gamma _\text {MF}\). It should be noted that the biases on the temperature are observed in Figs. 14 and 15, since the distribution of the design variable field slightly contains grayscale at the lower left region shown in Fig. 12.

Table 4 shows the crosscheck for Fig. 12, and it can be confirmed that the optimized configurations for the periodic problem perform better than other for its particular values of \(\zeta\).

Table 4 Crosscheck of objective functional values (\(\times 10^{-5}\)) for the 2D unsteady micropump shown in Fig. 12
Fig. 16
figure 16

Effect of \(t_\text {p}\) settings on optimized configurations in the 2D periodic micropump

Figure 16 shows the comparison result of the optimized configurations for three cases of time of the one cycle, i.e., \(t_\text {p} =1.0\times 10^5, 2.5\times 10^4, 5.0\times 10^3\). Here, the weight parameter is set to \(\zeta =0.5\). As shown in Fig. 16, the obtained configuration becomes symmetry about the vertical midplane as \(t_\text {p}\) decreases, which is close to the configuration for the higher case of \(\zeta\) as seen in Fig. 12c. This result indicates that \(t_\text {p}\) would affect the ratio of the standard deviation of the mass flow \(j_t\left( t\right)\) to the time-average of \(j_t\left( t\right)\). In fact, the ratio of the second term to the first term in (75) for the three cases of \(t_\text {p}\), i.e., \(1.0\times 10^5, 2.5\times 10^4\) and \(5.0\times 10^3\) are 0.238, 0.0867 and 0.0135, respectively. Such a response can be understood from the physical point of view as follows. As \(t_\text {p}\) decreases, the boundary condition applied on the lower left side is close to the constant temperature condition, which corresponds to a steady-state problem. As a result, the standard deviation of the mass flow decreases. On the other hand, as \(t_\text {p}\) increases, much time is given for developing convection, so the standard deviation of the mass flow increases. Table 5 shows the crosscheck for Fig. 16, and it can be confirmed that the optimized configurations for the periodic problem perform better than other for its particular values of \(t_\text {p}\).

Table 5 Crosscheck of objective functional values (\(\times 10^{-5}\)) for the 2D unsteady micropump shown in Fig. 16

4.4 3D transient problem

As the last example, we investigate the applicability of the proposed method for a 3D heat sink design problem concerning transient natural convention, while the 2D case has already been discussed in Sect. 4.2. In addition, we demonstrate that our transient formulation is effective for rapid cooling concerning natural convection, as discussed in the previous work on forced convection (Zeng et al. 2020). The objective functional J and the related parameter settings are similar to those of the 2D problem. The volume constraint in (70) is imposed using \(v_\text {s}=0.05\), and the initial configuration is set to \(\gamma =0\) that corresponds to the fulfilled solid in D and is effective in quickly spreading the temperature distribution to the entire analysis domain. Herein, the heat flux applied to \(\Gamma _\text {SC}\) is set to \(q_0=1.5\times 10^{-2}\). Figure 17 shows the problem layout with dimensions and boundary conditions for the analysis domain. Note that a similar problem has already been investigated by Alexandersen et al. (2016) for steady-state problems. The different setting of our study compared with that of the previous work is the design domain in contact with the bottom boundary. This is because we suppose that the 3D problem is a natural expansion from the 2D problem setting shown in Fig. 2.

Fig. 17
figure 17

Design settings of the 3D heat sink. The gray region represents the fixed design domain D

Fig. 18
figure 18

Optimized configurations of the 3D transient heat sink

Fig. 19
figure 19

Temperature distribution on streamlines in optimized configurations

Fig. 20
figure 20

Temperature distribution on the solid domain of optimized configurations

For effectively solving the 3D problem concerning unsteady natural convection, we use a supercomputer, SQUID (Supercomputer for Quest to Unsolved Interdisciplinary Datascience), owned by Osaka University. This study uses 128 CPU nodes with 64 cores per 1 node, and the LBM and the ALBM are implemented using the message passing interface (MPI) for parallel computing. For reference regarding the computational time in the following numerical examples, one optimization step takes about 35 s for \(t_1=5.0\times 10^4\) case and 90 s for \(t_1=1.0\times 10^5\) case. In this 3D problem, the maximum memory requirement for deriving the sensitivity is approximately 16TB, under about \(1.1\times 10^6\) lattice points. Due to the usable computational resources, the maximum number of optimization iterations is set to 500. In addition, the calculation domain is given as the quarter block of the analysis domain in Fig. 17, using the symmetrical boundary condition.

Figure 18 shows the optimized configurations with the temperature distribution on a x-y plane for different Ra and \(t_1\) settings. Besides, Fig. 19 shows the temperature distribution along with the streamlines developed around the optimized heat sink, and Fig. 20 is top views of the temperature distribution on each optimized configuration. From these results, it can be confirmed that the optimized shape changes significantly with increasing Ra and \(t_1\). In fact, when the observation time \(t_1\) is large or the number Ra increases, the number of branches decreases, which can be found by comparing Figs. 20a and b, and the optimized shape forms higher vertical plates with a larger surface area standing along with the upwind flow. In other words, a leaf-like shape can be obtained as the optimized design under the larger Ra and \(t_1\) settings.

Figure 21 shows the relationship between \(t_1\) and \(U_\text {cn}\) determined by (72) for two Ra settings, including the optimized shapes at each \(t_1\) setting. Similar to the 2D problem discussed in Sect. 4.2, the optimized designs depend on the magnitude of the heat convection effect. That is, the branched tree-like structure is obtained for the smaller settings of Ra and \(t_1\) that correspond to a situation on the heat conduction dominant. On the other hand, for the larger settings of them, the leaf-like structure is obtained owing to the heat convection dominant.

Fig. 21
figure 21

Cumulative norm of flow velocity, \(U_\text {cn}\), with respect to the ending time \(t_1\), calculated on an initial configuration in the 3D transient heat sink. Each optimized shape is displayed on the graph

Next, let us compare with the result of a steady-state case. Figure 22 shows the result of steady-state case for \(Ra=1.0\times 10^5\) setting. Herein, the common parameters with the transient case are identical, and the specific ones for the steady-state problem are similar to the 2D problem in Sect. 4.2. The volume of both the optimized designs is almost the same since the volume constraint is active.

Fig. 22
figure 22

Optimized configurations of the 3D steady-state heat sink

Figures 23 and 24 show the time-variation of the average temperature on the heated boundary \(\Gamma _\text {SC}\) located at the centre bottom of the heat sink. Here, “Steady” represents the result for the optimized design obtained on the steady-state condition, and “Unsteady” is the transient problem under the same Ra settings with the steady-state case.

Fig. 23
figure 23

Average temperature at the heat source boundary of optimized configurations for \(Ra=1.0\times 10^5\) in the 3D steady-state and unsteady heat sinks. The ending time of the unsteady case is set to \(t_1=5.0\times 10^4\)

Fig. 24
figure 24

Average temperature at the heat source boundary of optimized configurations for \(Ra=1.0\times 10^5\) in the 3D steady-state and unsteady heat sinks. The ending time of the unsteady case is set to \(t_1=1.0\times 10^5\)

Figure 23 and 24 show that the average temperature is converged around 50,000–75,000, namely, 50–75% of the maximum time steps in the transient problem. From these results, it can be found that the average temperature T for the transient case is always smaller than that for the steady-state case up to \(t=t_1\). On the other hand, these results are close to each other when \(t>t_1\), and the magnitude relationship is finally reversed. This result implies that if one wants to lessen the temperature on a heated plate quickly, a heat sink composed of slender trees with branches is effective to enhance the heat transfer via conduction; on the other hand, if one wants to lessen the temperature gradually but sufficiently, a heat sink composed of wider leaves is effective to enhance the heat transfer by convection.

5 Conclusion

In this study, we proposed a topology optimization method using the LBM for unsteady natural convection problems. We introduced the ALBM, in which the discrete velocity Boltzmann equations are employed to derive the design sensitivities. In addition, we presented detailed numerical implementation strategies, including approximate procedures to solve efficiently. As a verification check for our proposed method, we solved a steady-state problem and confirmed characteristics of the result being as same as those in previous works using the FEM. To demonstrate the efficacy of the proposed method, we tackled several examples concerning unsteady natural convection and achieved the following:

  1. (1)

    In a 2D transient problem, we showed that the cumulative norm of flow velocity could be used to explain the dominant heat transfer mechanism on each optimized configuration. That is, the larger the Rayleigh number or the longer the observation time is considered, the more dominant mechanisms change from conduction to convection in optimized configurations.

  2. (2)

    We proposed an objective functional defined as a weighted sum of the time-averaged flow rate and the deviation to solve a 2D periodic problem. Under using the proposed objective functional, we revealed that the weight parameter affects the optimized configurations, whose shapes can be explained from the physical viewpoint.

  3. (3)

    We demonstrated the applicability of the proposed method in a 3D transient problem, in which the analysis domain is discretized using about one million grid points with up to one hundred thousand time steps. Furthermore, we showed that the proposed method could lead to better results than the steady-state case in terms of the cooling speed.