Keywords

1 Introduction

Topology optimization was originally developed for the optimal design in structural mechanics ([3, 4, 6]). Nowadays it has attracted much attention due to its wide application in the fields of industry problems such as optimization of transport vehicles, biomechanical structure, etc. So far, the density method [5, 31] has been well developed for implementation of topology optimization. It was originally developed for the design of stiffness and compliant mechanism [32, 33] and has been applied in various physical problems such as acoustics, electromagnetics, fluid flow, and thermal problems [7, 11, 15, 24, 34]. In fluid mechanics, the concept of density method was first developed by Borrvall and Petersson [7] for topology optimization for the Stokes flow. Then it was extended to the Darcy-Stokes flow [21, 43], the Navier–Stokes flow [12, 18, 20, 27, 36, 47], the non-Newtonian flow [30], the turbulent flow [13], and more complicated fluidic devices [1, 25, 26]. Approaches using the topological sensitivity analysis (providing an asymptotic expansion of a shape function with respect to the size of a small inclusion inserted inside the domain) can also be used for shape optimization for Stokes flows [22] and Navier–Stokes flows [2]. Generally, the discrete optimization problem for the topology optimization was solved by the method of moving asymptotes (MMA) [35], level set based methods [8, 36, 47] and phase field based methods [18].

The threshold dynamics method developed by Merriman, Bence and Osher (MBO) [23] is an efficient method for approximating the mean curvature flow. In this method, the interface is implicitly represented by the characteristic functions of the domains. It alternates two simple steps: convolution between the characteristic functions and a heat kernel and point-wise thresholding. Recently, Esedoglu and Otto generalized the original MBO method to multiphase problems with arbitrary surface tensions [17]. The method has attracted much attention and it has been extended to many other applications, such as image processing [16, 37, 39], wetting dynamics [38, 44, 45], and target-valued problems [28, 29, 40,41,42].

In this paper we extend the iterative thresholding method developed in [9] to topology optimization for the Navier–Stokes flow. The porous medium approach based on the density method is utilized in the algorithm, and a Darcy term is introduced into the Navier–Stokes equation to “interpolate” between the Navier–Stokes equation in the fluid region and the Darcy flow through a porous medium (a weakened solid region with low permeability) (i.e., Brinkman equation). Then the total energy consists of the potential power in the fluid, the perimeter regularization, and a Darcy term. The perimeter term is computed based on the convolution between the heat kernel and the characteristic functions of regions. There are two steps per iteration in the proposed algorithm. The first step is to solve the Brinkman equation and an adjoint system, which can both be efficiently solved using the mixed finite element method. The second step is to update the fluid-solid regions by a simple convolution and thresholding step. The convolution can be efficiently computed on a uniform grid by the fast Fourier transform (FFT) with the computational complexity \(O(N \log N)\). A variety of numerical experiments in both two and three dimensions are shown to verify the efficiency of the proposed algorithm. In addition, numerical results indicate that the total energy decays.

The paper is organized as follows. In Sect. 2, we introduce the mathematical model, the approximation to the model, and the derivation of the iterative thresholding method. The numerical implementation is discussed in Sect. 3. We verify the performance through extensive numerical experiments in Sect. 4. We draw some conclusions in Sect. 5.

2 Derivation of the Method

2.1 The Mathematical Model

In this section, we consider the mathematical model for topology optimization for the Navier–Stokes flow. Denote \(\Omega \in \mathbb {R}^d\) \((d=2,3)\) as the computational domain which is fixed throughout optimization and assume that \(\Omega \) is a bounded Lipschitz domain with an outer unit normal \(\mathbf{n}\) such that \(\mathbb {R}^d \setminus \overline{\Omega }\) is connected. Furthermore, we denote \(\Omega _0 \subset \Omega \) as the domain of the fluid which is a Caccioppoli set whose boundary is measurable and has a (at least locally) finite measure and \(\Omega \setminus \Omega _0 \) as the domain of solid. Our goal is to determine an optimal shape of \(\Omega _0\) that minimizes the following objective functional consisting of the total potential power and a perimeter regularization term,

$$\begin{aligned} \min _{(\Omega _0,\mathbf{u})} J_0(\Omega _0,\mathbf{u}) = \int \limits _{\Omega } \frac{\mu }{2}|\nabla \mathbf{u}|^2 d\mathbf{x}+ \gamma |\Gamma | \end{aligned}$$
(1)

subject to

$$\begin{aligned}&\nabla \cdot \mathbf{u}= 0, \ \ \text {in} \ \ \Omega _0, \end{aligned}$$
(2a)
$$\begin{aligned}&(\mathbf{u}\cdot \nabla ) \mathbf{u}+ \nabla p - \nabla \cdot (\mu \nabla \mathbf{u}) = 0, \ \ \text {in} \ \ \Omega _0, \end{aligned}$$
(2b)
$$\begin{aligned}&\mathbf{u}=0, \ \ \mathrm{in} \ \Omega \setminus \overline{\Omega }_0 \ \ {\text { and on }} \partial \Omega _0, \end{aligned}$$
(2c)
$$\begin{aligned}&\mathbf{u}|_{\partial \Omega } = \mathbf{u}_D, \ \ \text {on} \ \ \partial \Omega , \end{aligned}$$
(2d)
$$\begin{aligned}&|\Omega _0| = \ \beta |\Omega | \ \text {with a fixed parameter} \ \beta \in (0,1). \end{aligned}$$
(2e)

Here, \(\mathbf{u}: \Omega \rightarrow \mathbb {R}^d\), \(\mu \) is the viscosity of the fluid, p is the pressure, \(\mathbf{u}_D: \partial \Omega \rightarrow \mathbb {R}^d\) is a given function, \( |\Gamma | \) is the perimeter of the boundary (i.e., \(\Gamma =\partial \Omega _0\)), and \(\gamma >0\) is a weighting parameter.

2.2 The Relaxation and Approximation of the Problem

Since the goal is to minimize the objective functional (1) subject to several constraints (2) with respect to the fluid-solid interface, it is necessary to have a proper representation of the fluid-solid interface. Motivated by [9, 17, 37, 44], in this paper, we use the characteristic function \(\chi _1\) of the fluid domain (i.e., \(\Omega _0\)) to implicitly represent the fluid-solid interface, i.e.,

$$\chi _1(\mathbf{x}) := {\left\{ \begin{array}{ll} 1, &{} \textit{if} \ \ \mathbf{x}\in \Omega _0, \\ 0, &{} \textit{otherwise}. \end{array}\right. } $$

\(\chi _2(\mathbf{x}) = 1- \chi _1(\mathbf{x})\) is denoted as the characteristic function of \(\Omega \setminus \Omega _0\). Then, the interface \(\Gamma \) is implicitly represented by \(\chi _1\) and \(\chi _2\). Under this representation, \(|\Gamma |\) can be approximated by

$$\begin{aligned} |\Gamma | \approx \sqrt{\frac{\pi }{\tau }}\int \limits _{\Omega } \chi _1 G_\tau * \chi _2 d\mathbf{x}= \sqrt{\frac{\pi }{\tau }}\int \limits _{\Omega } \chi _1 G_\tau * (1-\chi _1) d\mathbf{x}, \end{aligned}$$
(3)

where \(G_\tau (\mathbf{x}) = \dfrac{1}{(4\pi \tau )^{\frac{d}{2}}} \exp \left( -\dfrac{|\mathbf{x}|^2}{4\tau }\right) \) \((d = 2,3)\) is the Gaussian kernel and \(*\) denotes the convolution [17].

Similar to [9], to avoid solving the Navier–Stokes equation in a changing domain at each iteration, the porous medium approach [18] is utilized to “interpolate” between the Navier–Stokes equation in the fluid region (i.e., \(\{\mathbf{x}| \ \chi _1(\mathbf{x}) =1\}\)) and \(\mathbf{u}= 0 \) in the solid region (i.e., \(\{\mathbf{x}| \ \chi _2(\mathbf{x}) =1\}\)) by introducing an additional penalization term, \(\alpha (\mathbf{x}) \mathbf{u}\), as follows:

$$\begin{aligned}&\nabla \cdot \mathbf{u}= 0, \ \ \text {in} \ \ \Omega , \end{aligned}$$
(4a)
$$\begin{aligned}&(\mathbf{u}\cdot \nabla )\mathbf{u}+ \nabla p - \nabla \cdot (\mu \nabla \mathbf{u}) + \alpha (\mathbf{x}) \mathbf{u}= 0, \ \ \text {in} \ \ \Omega , \end{aligned}$$
(4b)
$$\begin{aligned}&\mathbf{u}|_{\partial \Omega } = \mathbf{u}_D, \ \ \text {on} \ \ \partial \Omega , \end{aligned}$$
(4c)
$$\begin{aligned}&\int \limits _\Omega \chi _1 d\mathbf{x}= \beta |\Omega |. \end{aligned}$$
(4d)

Accordingly, the original objective functional (1) can be approximated by adding a Darcy penalty term as follows:

$$\begin{aligned} J^\tau (\chi ,\mathbf{u}) =&\int \limits _{\Omega }\left( \frac{\mu }{2} |\nabla \mathbf{u}|^2+ \frac{\alpha (\mathbf{x})}{2}|\mathbf{u}|^2 \right) d\mathbf{x}+ \gamma \sqrt{\frac{\pi }{\tau }}\int \limits _{\Omega } \chi G_\tau * (1-\chi ) d\mathbf{x}\end{aligned}$$
(5)

where \(\chi \) denotes the characteristic function of the solid domain, i.e., \(\chi = \chi _2\).

Now, we discuss the computation of \(\alpha \) in the current representation of the interface (i.e., using characteristic functions). Theoretically, \(\alpha \) should be large enough in the solid domain to penalize the condition \(\mathbf{u}=0\) and close to 0 in the fluid domain to make \(\mathbf{u}\) satisfy the Navier–Stokes equation. For numerical considerations, we relax \(\alpha \) to a smooth function which undergoes rapid changes through the interface. We use the 0.5 level set of \(\varphi =G_{\tau }* \chi \) to approximate the position of the interface \(\Gamma \) and such \(\varphi \) is a smooth function between [0, 1] and admits a change from 0 to 1 in an \(O(\sqrt{\tau })\) transition region. Thus, we compute \(\alpha \) by

$$\begin{aligned} \alpha (\mathbf{x}) = \bar{\alpha }\varphi =\bar{\alpha }G_{\tau }* \chi \end{aligned}$$
(6)

where \(\bar{\alpha }\) is a sufficiently large constant, and thus by the porous medium approach we can solve the system (4) in a fixed domain \(\Omega \).

Finally, using (6), we arrive in the following formulation of the problem:

$$\begin{aligned} \min _{\chi , \mathbf{u}} J^\tau (\chi ,\mathbf{u}) =&\int \limits _{\Omega }\left( \frac{\mu }{2} |\nabla \mathbf{u}|^2+ \frac{\bar{\alpha }}{2}(G_{\tau }* \chi ) |\mathbf{u}|^2+ \gamma \sqrt{\frac{\pi }{\tau }} \chi G_\tau * (1-\chi ) \right) d\mathbf{x}\end{aligned}$$
(7)

subject to

$$\begin{aligned}&\chi \in \mathcal {B}:= \{\chi \in BV(\Omega )\ |\ \chi (x)=\{0, 1\}, \ {a.e.}, \text{ and } \int \limits _{\Omega } (1-\chi ) d\mathbf{x}=\beta |\Omega | \} \end{aligned}$$
(8a)
$$\begin{aligned}&\nabla \cdot \mathbf{u}= 0, \ \ \text {in} \ \ \Omega , \end{aligned}$$
(8b)
$$\begin{aligned}&(\mathbf{u}\cdot \nabla )\mathbf{u}+ \nabla p - \nabla \cdot (\mu \nabla \mathbf{u}) + (\bar{\alpha }G_{\tau }* \chi ) \mathbf{u}= 0, \ \ \text {in} \ \ \Omega , \end{aligned}$$
(8c)
$$\begin{aligned}&\mathbf{u}|_{\partial \Omega } = \mathbf{u}_D, \ \ \text {on} \ \ \partial \Omega . \end{aligned}$$
(8d)

2.3 Derivation of the Method

In this section, we will derive an iterative scheme to find the approximate solution for (7) and (8). Denote

$$\begin{aligned} \mathbf{U} :=&\{ \mathbf{u}\in H^1(\Omega )| \nabla \cdot \mathbf{u}= 0, \mathbf{u}|_{\partial \Omega } = \mathbf{u}_D\} \ \ \ \ \text {and} \ \ \ \ \mathbf{V} := \{ \mathbf{v}\in H_0^1(\Omega )| \nabla \cdot \mathbf{v}= 0 \}. \end{aligned}$$

To derive the first order necessary optimality conditions for a solution \((\chi _\tau , \mathbf{u}_\tau )\) of (7) and (8), we introduce the Lagrangian \(\mathcal E : \mathcal B \times \mathbf{U} \times \mathbf{V} \rightarrow \mathbb R\) by

$$ \mathcal E^\tau (\chi ,\mathbf{u},\tilde{\mathbf{u}}) : = J^\tau (\chi ,\mathbf{u}) + \int \limits _\Omega (\mathbf{u}\cdot \nabla )\mathbf{u}\cdot \tilde{\mathbf{u}}+ \mu \nabla \mathbf{u}\cdot \nabla \tilde{\mathbf{u}}+ (\bar{\alpha }G_{\tau }* \chi ) \mathbf{u}\cdot \tilde{\mathbf{u}}d\mathbf{x}$$

where the pressure term is not shown because \(\nabla \cdot \tilde{\mathbf{u}} = 0\). The variational inequality is formally derived by

$$\begin{aligned} \left\langle \frac{\delta \mathcal {E}^\tau }{\delta \chi }(\chi _\tau ,\mathbf{u}_\tau ,\tilde{\mathbf{u}}_\tau ), \chi -\chi _\tau \right\rangle \ge 0, \ \ \forall \ \chi \in \mathcal {B} \end{aligned}$$
(9)

and the adjoint equation can be deduced by

$$\begin{aligned} \left\langle \frac{\delta \mathcal E^\tau }{ \delta \mathbf{u}}(\chi _\tau ,\mathbf{u}_\tau ,\tilde{\mathbf{u}}_\tau ) , \mathbf{v}\right\rangle = 0 , \ \ \forall \ \mathbf{v}\in \mathcal {\mathbf {V}} \end{aligned}$$
(10)

where \(\langle \cdot ,\cdot \rangle \) denotes the \(L^2\)-inner product.

To be specific, assume \((\chi _\tau ,\mathbf{u}_\tau ) \in \mathcal B \times \mathbf{U}\) is a minimizer of (7) and (8), the following inequality is fulfilled:

$$\begin{aligned} \left\langle \frac{\bar{\alpha }}{2} G_\tau * |\mathbf{u}_\tau |^2 + \gamma \sqrt{\frac{\pi }{\tau }} G_\tau * (1-2\chi _\tau ) + \bar{\alpha }G_\tau *(\mathbf{u}_\tau \cdot \tilde{\mathbf{u}}_\tau ), \chi -\chi _\tau \right\rangle \ge 0, \ \forall \ \chi \in \mathcal B \end{aligned}$$
(11)

where \(\tilde{\mathbf{u}}_\tau \) is the solution to the following adjoint system at \((\mathbf{u}_\tau ,\chi _\tau )\):

$$\begin{aligned}&-(\mathbf{u}_\tau \cdot \nabla )\mathbf{u}_\tau -(\mathbf{u}_\tau \cdot \nabla ) \tilde{\mathbf{u}}+(\nabla \mathbf{u}_\tau )^T \tilde{\mathbf{u}}+\nabla \tilde{p} - \nabla \cdot ( \mu \nabla \tilde{\mathbf{u}}) +(\bar{\alpha }G_\tau *\chi _\tau ) \tilde{\mathbf{u}}= 0,\end{aligned}$$
(12a)
$$\begin{aligned}&\nabla \cdot \tilde{\mathbf{u}}= 0, \end{aligned}$$
(12b)
$$\begin{aligned}&\tilde{\mathbf{u}}|_{\partial \Omega } = 0. \end{aligned}$$
(12c)

Here, \(\tilde{p}\) is the pressure associated to the adjoint system.

Based on the first order necessary optimality condition, to solve (7) and (8), we use an iterative scheme to decrease the value of the objective functional with \(\mathbf{u}\) satisfying (8) and \(\tilde{\mathbf{u}}\) satisfying (12). Without loss of generality, assume the k-th iteration \(\chi ^k\) is given, we compute \((\mathbf{u}^k,\tilde{\mathbf{u}}^k)\) via solving the following system

$$\begin{aligned} {\left\{ \begin{array}{ll} \nabla \cdot \mathbf{u}= 0, \\ \nabla \cdot \tilde{\mathbf{u}}= 0, \\ (\mathbf{u}\cdot \nabla )\mathbf{u}+\nabla p - \nabla \cdot (\mu \nabla \mathbf{u}) + (\bar{\alpha }G_\tau *\chi ^k)\mathbf{u}= \mathbf{f}, \\ -(\mathbf{u}\cdot \nabla )\mathbf{u}-(\mathbf{u}\cdot \nabla ) \tilde{\mathbf{u}}+(\nabla \mathbf{u})^T \tilde{\mathbf{u}}+\nabla \tilde{p} -\nabla \cdot ( \mu \nabla \tilde{\mathbf{u}}) +(\bar{\alpha }G_\tau *\chi ^k) \tilde{\mathbf{u}}= 0,\\ \mathbf{u}|_{\partial \Omega } = \mathbf{u}_D,\\ \tilde{\mathbf{u}}|_{\partial \Omega } = 0. \end{array}\right. } \end{aligned}$$
(13)

After \((\mathbf{u}^k,\tilde{\mathbf{u}}^k)\) are solved from (13), \(\chi ^{k+1}\) is updated through

$$\begin{aligned} \chi ^{k+1}=&\arg \min _{\chi \in \mathcal {B}}\mathcal E ^\tau (\chi ,\mathbf{u}^{k},\tilde{\mathbf{u}}^k). \end{aligned}$$
(14)

Write the objective functional \(\mathcal E^\tau (\chi ,\mathbf{u}^k,\tilde{\mathbf{u}}^k)\) into \(\tilde{\mathcal E}^{\tau ,k}(\chi )\):

$$\begin{aligned} \tilde{\mathcal E}^{\tau ,k}(\chi ):= \mathcal E^\tau (\chi ,\mathbf{u}^k,\tilde{\mathbf{u}}^k) =&\int \limits _{\Omega } \frac{\bar{\alpha }}{2}\chi G_\tau * |\mathbf{u}^k|^2 d\mathbf{x}+ \gamma \sqrt{\frac{\pi }{\tau }} \int \limits _{\Omega }\chi G_\tau * (1-\chi ) d\mathbf{x}\\&+ \int \limits _{\Omega } \bar{\alpha }\chi G_\tau * (\mathbf{u}^k \cdot \tilde{\mathbf{u}}^k) d\mathbf{x}+ \mathcal {N}(\mathbf{u}^k,\tilde{\mathbf{u}}^k), \end{aligned}$$

where \(\mathcal {N}(\mathbf{u}^k,\tilde{\mathbf{u}}^k)\) contains all other terms in \(\mathcal E^\tau (\chi ,\mathbf{u}^k,\tilde{\mathbf{u}}^k) \) which are independent of \(\chi \). The only problem now is to minimize \(\tilde{\mathcal E}^{\tau ,k}(\chi )\) on \(\mathcal {B}\), i.e., finding \(\chi ^{k+1}\) such that

$$\begin{aligned} \chi ^{k+1}=&\arg \min \limits _{\chi \in \mathcal {B}}\tilde{\mathcal E}^{\tau ,k}(\chi ). \end{aligned}$$
(16)

We first relax (16) to a problem defined on a convex admissible set by finding \(r^{k+1}\) such that

$$\begin{aligned} r^{k+1}=&\arg \min \limits _{r \in \mathcal {H}} \tilde{\mathcal E}^{\tau ,k}(r) , \end{aligned}$$
(17)

where \(\mathcal {H}\) is the convex hull of \(\mathcal {B}\):

$$\begin{aligned} \mathcal {H}:=&\{ r\in BV(\Omega )\ |\ r(x)\in [0, 1] \ {a.e.}, \ \hbox {and} \int \limits _{\Omega } rd\mathbf{x}=V_0 \}. \end{aligned}$$

The following lemma holds similarly as that in [9] and we refer the details of a similar proof to [9]. Thus, we can solve the relaxed problem (17) instead of (16).

Lemma 2.1

Let \(\mathbf{u}\in H_{\mathbf{u}_D}^1(\Omega ,\mathbb {R}^d)\) be a given function and \(r = (r_1,r_2)\). Then we have

$$\begin{aligned} \arg \min \limits _{r \in \mathcal {H}} \tilde{\mathcal E}^{\tau ,k}(r)=\arg \min \limits _{r \in \mathcal {B}} \tilde{\mathcal E}^{\tau ,k}(r). \end{aligned}$$

Next we show that (17) can be solved by a thresholding step. Because \(\tilde{\mathcal E}^{\tau ,k}(r)\) is quadratic and concave in r, we first linearize the energy \(\tilde{\mathcal E}^{\tau ,k}(r)\) at \(r^k\) by

$$\begin{aligned} \tilde{\mathcal E}^{\tau ,k}(r) \approx \tilde{\mathcal E}^{\tau ,k}(r^k)+\mathcal {L}^{\tau ,k}_{r^k}(r - r^k), \end{aligned}$$

where

$$\begin{aligned} \mathcal {L}^{\tau ,k}_{r^k}(r) =&\int \limits _{\Omega } \left( \gamma \sqrt{\frac{\pi }{\tau }} r G_\tau * (1-2r ^k)+ r \frac{\bar{\alpha }}{2} G_\tau * |\mathbf{u}^k|^2+r \bar{\alpha } G_\tau * (\mathbf{u}^k \cdot \tilde{\mathbf{u}}^k) \right) d\mathbf{x}\\ =&\int \limits _{\Omega }r \phi d\mathbf{x}\nonumber \end{aligned}$$

where \(\phi =\gamma \sqrt{\frac{\pi }{\tau }} G_\tau * (1-2r ^k) +\frac{\bar{\alpha }}{2} G_\tau * |\mathbf{u}^k|^2+ \bar{\alpha } G_\tau * (\mathbf{u}^k \cdot \tilde{\mathbf{u}}^k)\). Then (17) can be approximately solved by

$$\begin{aligned} \chi ^{k+1} =\arg \min _{r \in \mathcal {H}} \mathcal {L}^{\tau ,k}_{r^k}(r)=\arg \min _{r \in \mathcal {H}} \int \limits _{\Omega } r \phi d\mathbf{x}. \end{aligned}$$
(18)

Then we have the following lemma as in [9] and one can also refer the details of proof to [9].

Lemma 2.2

Let \(\phi =\gamma \sqrt{\frac{\pi }{\tau }} G_\tau * (1-2 \chi ^k) +\frac{\bar{\alpha }}{2} G_\tau * |\mathbf{u}^k|^2+ \bar{\alpha } G_\tau * (\mathbf{u}^k \cdot \tilde{\mathbf{u}}^k) \) and

$$ D_2^{k+1}=\{ \mathbf{x}\in \Omega | \;\phi < \delta \} $$

for some \(\delta \) such that \(|D_2^{k+1}|=(1-\beta ) |\Omega |\). Then with \(\chi ^{k+1} = \chi _{D_2^{k+1}}\), we have

$$\begin{aligned} \mathcal {L}^{\tau ,k}_{\chi ^k}(\chi ^{k+1})\le \mathcal {L}^{\tau ,k}_{\chi ^k}(\chi ^k)\quad \text {for all}\, \tau >0. \end{aligned}$$

The above lemma shows that (18) can be solved by

$$\begin{aligned} {\left\{ \begin{array}{ll} \chi ^{k+1}(\mathbf{x}) = 1, \ \ \text {if} \ \ \phi (\mathbf{x})<\delta , \\ \chi ^{k+1}(\mathbf{x}) = 0, \ \ \text {otherwise}, \end{array}\right. } \end{aligned}$$

where \(\delta \) is chosen as a constant such that \(\int _{\Omega } \chi ^{k+1} d\mathbf{x}= (1-\beta ) |\Omega |\).

To determine the value of \(\delta \), one can treat \(\int _{\Omega } \chi ^{k+1} d\mathbf{x}- (1-\beta )|\Omega |\) as a function of \(\delta \) (i.e., \(f(\delta ) = \int _{\Omega } \chi ^{k+1} d\mathbf{x}- (1-\beta )|\Omega |\)) and use an iteration method (e.g., bisection method or Newton’s method) to find the root of \(f(\delta )= 0\). For the uniform discretization of \(\Omega \), a more efficient method is the quick-sort technique proposed in [44]. Assume we have a uniform discretization of \(\Omega \) with grid size h, we can approximate \(\int _{\Omega } \chi ^{k+1} d\mathbf{x}\) by \(m h^d\) where m is the number of grid points where \(\chi ^{k+1} =1\). Assume \( (1-\beta )|\Omega |\) is approximated by \(M h^d\), we then sort the values of \( {\phi }\) in an ascending order and simply set \( \chi ^{k+1} = 1\) on the first M points.

Now, we arrive at Algorithm 1.

figure a

Remark 2.1

We remark here that it’s obvious that the Step 2 in Algorithm 1 decreases the energy which can be proved similar as we did in [9], i.e.,

$$\begin{aligned} J^\tau (\chi ^{k+1},\mathbf{u}^k) \le J^\tau (\chi ^k,\mathbf{u}^k). \end{aligned}$$

In the Step 1, we don’t have

$$\begin{aligned} J^\tau (\chi ^k,\mathbf{u}^k) \le J^\tau (\chi ^k,\mathbf{u}^{k-1}) \end{aligned}$$

because this step can be interpreted as a projection step. It could increase the value of the energy. However, in the numerical experiments in Sect. 4, we checked the energy curves for all examples as displayed. All of them indicate that the algorithm has the energy decaying property.

Remark 2.2

In the implementation, the stopping criteria is \(\chi ^{k+1} =\chi ^{k}\) on each grid point. It is easy to see that the stationary solution (obtained from Algorithm 1) satisfies the first order necessary optimality condition (8), (9), and (10).

3 Numerical Implementation

Now we illustrate the implementation of Algorithm 1 and we focus on Step 1. The Navier-Stokes equations with a Dacry term penalty and the adjoint problem (13) are solved by the mixed finite element method, and the standard Taylor-Hood finite element space is used for discretization. Let \({\mathcal T}_h\) be a uniform grid of the domain \(\Omega \), and \({\mathcal N}_h\) is the set of all vertices of \({\mathcal T}_h\). For a given \(\overline{\chi }_h \in \mathcal {B}_h\) where \(\mathcal {B}_h\) is the discrete version of \(\mathcal {B}\) defined on \({\mathcal N}_h\). We introduce the Taylor-Hood finite element space

$$\begin{aligned} {{\boldsymbol{V}}}_h&: = \{ \mathbf{v}\in H^1(\Omega ,\mathbb {R}^d) \ | \ \mathbf{v}|_K \in [P_2(K)]^d, \ K \in {\mathcal T}_h \},\\ Q_h&: = \{ q \in L^2(\Omega ,\mathbb {R}) \ | \ \int \limits _\Omega q \ d\mathbf{x}= 0, \ q|_{K} \in P_1(K), \ K \in {\mathcal T}_h \}. \end{aligned}$$

Let \({{\boldsymbol{V}}}^{D}_h : = \{ \mathbf{v}\in {{\boldsymbol{V}}}_h \ | \ \mathbf{v}|_{\partial \Omega } = \mathbf{u}^h_D \}\), where \(\mathbf{u}^h_D \) is the a suitable approximation of the Dirichlet boundary condition \(\mathbf{u}_D\) on the boundary edges/faces of \({\mathcal T}_h\). For the solution of (13), find \((\mathbf{u}_h,p_h)\in {{\boldsymbol{V}}}^{D}_h \times Q_h\) such that

$$\begin{aligned} ((\mathbf{u}_h\cdot \nabla )\mathbf{u}_h, {{\boldsymbol{v}}}_h)- (p_h,\nabla \cdot \mathbf{v}_h) + (\mu \nabla \mathbf{u}_h, \nabla \mathbf{v}_h) +( \alpha (\overline{\chi }_h) \mathbf{u}_h,\mathbf{v}_h)&= 0, \quad \forall \ \mathbf{v}_h \ \in {{\boldsymbol{V}}}^0_h , \\ (\nabla \cdot \mathbf{u}_h,q_h)&= 0, \quad \quad \quad \ \forall \ q_h \in Q_h. \end{aligned}$$

and \((\tilde{\mathbf{u}}_h,\tilde{p}_h) \in {{\boldsymbol{V}}}^{0}_h \times Q_h\) such that

$$\begin{aligned} -((\mathbf{u}_h\cdot \nabla )\tilde{\mathbf{u}}_h, {{\boldsymbol{v}}}_h)&+ ((\nabla \mathbf{u}_h)^T \tilde{\mathbf{u}}_h,\mathbf{v}_h) - (\tilde{p}_h ,\nabla \cdot \mathbf{v}_h) + (\mu \nabla \tilde{\mathbf{u}}_h, \nabla \mathbf{v}_h) +( \alpha (\overline{\chi }_h)\tilde{\mathbf{u}}_h,\mathbf{v}_h) \\&= ((\mathbf{u}_h\cdot \nabla )\mathbf{u}_h, {{\boldsymbol{v}}}_h) , \qquad \forall \ \mathbf{v}_h \ \in {{\boldsymbol{V}}}^0_h , \\ (\nabla \cdot \tilde{\mathbf{u}}_h,q_h)&= 0, \quad \quad \ \forall \ q_h \in Q_h, \end{aligned}$$

where \({{\boldsymbol{V}}}^0_h={{\boldsymbol{V}}}_h\cap H^1_0(\Omega )\). All above systems are solved by standard Newton’s iteration and each iteration is solved by the generalized minimal residual method (GMRES).

We also note that the above bilinear form can be straightforwardly extended to the problem both with Dirichlet boundary \(\Gamma _D\) and Neumann boundary \(\Gamma _N\), where \(\Gamma _D \cap \Gamma _N = \emptyset , \Gamma _D \cup \Gamma _N = \partial \Omega \), and \((\mu \nabla \mathbf{u}- p {{\boldsymbol{I}}})\cdot {{\boldsymbol{n}}}|_{\Gamma _N} = {{\boldsymbol{g}}}\).

When \(\mathbf{u}_h\) and \(\tilde{\mathbf{u}}_h\) are obtained, we can use the FFT to compute \(\phi ^h\) on each node of \({\mathcal N}_h\) as follows:

$$\begin{aligned} \phi ^h =\gamma \sqrt{\frac{\pi }{\tau }}G_\tau * (1-2\overline{\chi }^h)+\frac{\bar{\alpha }}{2}G_{\tau }* (|\mathbf{u}_h|^2 +2\mathbf{u}_h \cdot \tilde{\mathbf{u}}_h) \end{aligned}$$

Following Algorithm 1, we can now use \(\phi ^h\) to update the indicator function \(\chi _h\) by the strategy presented in Algorithm 1.

Remark 3.1

Similar to the adaptive in time strategy used in [9], we can modify Algorithm 1 into an adaptive algorithm by adjusting \(\tau \) during the iterations. We set a threshold value \(\tau _t\) and a given tolerance \(e_t\), if \(e_{\chi }^k \le e_t\), let \(\tau _\mathrm{new}=\eta \tau \) with \(\eta \in (0,1)\) and update \(\tau := \tau _\mathrm{new}\) in the next iteration unless \(\tau \le \tau _t\). Otherwise, \(\tau \) will not be updated, and the iteration will continue with the same \(\tau \).

4 Numerical Experiments

In this section, we perform extensive numerical examples to demonstrate the efficiency of our new algorithm with an adaptive strategy for the choice of \(\tau \). We choose \(\eta =0.5\) in the update of \(\tau \). If no confusion is possible, we still denote by \(\tau \) as its initialization in the following. Also, we denote the Reynolds number by \(Re = \frac{1}{\mu }\).

4.1 Two Dimensional Results

In this section, we test the performance of the proposed algorithm on two dimensional problems on several different design domains as displayed in Fig. 1. For most examples in this section, we assume that the Dirichlet boundary condition with a parabolic profile and the magnitude of the velocity are set as \(|\mathbf{u}_D| = \overline{g}(1-4(\frac{t-a}{l})^2)\) with \(t \in [a-\frac{l}{2},a+\frac{l}{2}]\), where l is the length of the section of the boundary at which the inflow/outflow velocity is imposed, and \(\bar{g}\) is the prescribed velocity at the midpoint a of the flow profile. The directions of the inflow/outflow velocity are illustrated separately in the design domain in each example.

Fig. 1
figure 1

Design domains of two dimensional examples

Example 1

In this example, we consider the design of a bend, which has been tested by the level set method in [10, 14, 19]. The design domain is presented in Fig. 1a. Let \(\bar{g}\) be 1 both in inlet and outlet, and we set the fluid fraction as \(\beta =0.08\pi \). Here, we use our algorithm to obtain the optimal design result on a \(128\times 128\) grid. We assume the initial distribution \(\chi =0\) in the whole domain, and set the parameter \(\bar{\alpha }=1.5\mu \times 10^4\) through this example.

Fig. 2
figure 2

(Example 1) Left to right: Optimal results and the corresponding energy decaying curve for the cases of \(\mathrm Re=10, 100\), and 1000. The parameters are set as \(\tau =0.001\), \(\gamma =0.0001\) and \(\bar{\alpha }=1.5\upmu \times 10^4\)

Fig. 3
figure 3

(Example 1) Plots of energy curves for \(\bar{\alpha }=1.5\upmu \times 10^4\) and \(\mathrm Re=10\). Left: For fixed \(\gamma =0.0001\), energy curves for the cases of \(\tau =0.02,0.005,0.001\). Right: For fixed \(\tau =0.001\), energy curves for the cases of \(\gamma =0.0005,0.0001,0.00005\)

The boundary conditions in this example are slightly different with [10, 19], but are same as that in [14]. Based on the \(128\times 128\) grid, firstly, we test the example for different Reynolds numbers, in which the other parameters are set as \(\tau =0.001\) and \(\gamma =0.0001\). The optimal design results together with the velocity field and the energy decaying curve are displayed in Fig. 2 for the cases of \(\mathrm Re=10,100\) and 1000, separately. It was mentioned in [46] that the radius of curvature of the fluid domain is decreased as the Reynolds number is increased. This phenomenon can also be observed in Fig. 2, and the optimal results are consistent with those obtained by the level set methods in [10, 14, 19].

Furthermore, we numerically check the sensitivity of \(\tau \) and \(\gamma \) on the energy decaying properties. In Fig. 3, we displayed the energy decaying curves for different choices of \(\tau \) and \(\gamma \) with fixed \(\mathrm Re=10\). We observe that the energy converges to almost the same value. In addition, the final design results we obtained are also identical to the left one in Fig. 2.

Example 2

We test the example presented in Fig. 1b which has one parabolic inlet and four parabolic outlets. We assume \(\bar{g}=3\), \(l=0.2\) and \(a=0.8\) on the inlet boundary \(x=0\). For the four outlets, we let \((\bar{g},l,a)=(1,0.1,0.8)\), (1, 0.1, 0.65), (1, 0.2, 0.7) and (1, 0.2, 0.25) on \(y=0\), \(y=1\), \(x=1\) and \(x=1\), respectively. This example has been tested by the phase field method in [18] with the same boundary conditions. Here, we use our algorithm to obtain the final optimal result on a \(256\times 256\) grid. Throughout this example, we set \(\tau =0.001\), \(\gamma =0.01\), \(\bar{\alpha }=1.5\upmu \times 10^4\) and \(\mathrm Re=10\).

Fig. 4
figure 4

(Example 2) Left to right: Optimal results and energy curves for \(\beta =0.5\) and \(\beta =0.4\)

For the initial distribution \(\chi =1-\chi _{\{(x,y):x\in (0,1),y\in (\frac{1}{6},\frac{5}{6})\}}\), we test this example for different fluid fractions \(\beta \). For the left graph of Fig. 4 with \(\beta =0.5\), we obtain the optimal result after 40 iterations. For the the right graph of of Fig. 4 with \(\beta =0.4\), the optimal result is obtained after 38 iterations. We find that the final result in Fig. 4 has a treelike structure which is consistent with that obtained using the phase field method in [18]. The energy decaying curves for different fluid fractions \(\beta \) are also displayed in Fig. 4.

Example 3

In this example, we consider the minimization of the power dissipation in a four terminal device. We set \(\bar{g}=1\) for the two inflows and homogeneous Neumann boundaries on parts of the top and bottom boundaries with centers [0.5, 0] and [0.5, 1] (see Fig. 1c). The fluid fraction is defined as \(\beta =0.4\). Here, we utilize our algorithm to achieve the optimal configurations on \(128\times 128\) and \(256\times 256\) grids.

Fig. 5
figure 5

(Example 3) Left to right: Optimal results and energy curves on a \(128\times 128\) grid and \(256\times 256\) grid. The parameters are set as \(\tau =0.001\), \(\gamma =0.0001\), \(\bar{\alpha }=2.5\upmu \times 10^4\) and \(\mathrm Re=1\)

We test the case for \(\tau =0.001\), \(\gamma =0.0001\), \(\bar{\alpha }=2.5\upmu \times 10^4\) and \(\mathrm Re=1\) on \(128\times 128\) and \(256\times 256\) grids. The initial distribution is set as \(\chi =1-\chi _{\{(x,y):x\in (0,1),y\in (\frac{1}{3},\frac{2}{3})\}}\). In Fig. 5, we observe that the final optimal configuration is consistent with the result obtained using the level set method in [10]. And the final results for different grids are almost the same, which indicates that our algorithm is independent on grid for this example. Furthermore, the energy decaying property can be observed in Fig. 5.

Example 4

In this example, we consider a three terminal device on the design domain as displayed in Fig. 1d. We set \(\bar{g}=1\) on the two inflows and the homogeneous Neumann boundary condition on the outflow. The fluid fraction is set as \(\beta =0.3\) and we test this example on a \(128\times 128\) grid for \(\tau =0.0005\), \(\gamma =0.0002\) and \(\bar{\alpha }=1.5\upmu \times 10^4\).

Fig. 6
figure 6

(Example 4) Left to right: Optimal configurations and energy decaying curves for \(\mathrm Re=20\) and 500

In this example, we study the relation of optimal configurations on different choices of Reynolds numbers. Based on the initial \(\chi =1-\chi _{\{(x,y):x\in (0,1),y\in (\frac{1}{5},\frac{4}{5})\}}\), the final optimal design results with the velocity fields for \(\mathrm Re=20\), and 500 are displayed in Fig. 6. We observe that the configuration gradually separates from each other as the Reynolds number increases. The energy decaying curves are also displayed and the iteration converges in about 20 steps for \(\mathrm Re=20\) and 25 steps for \(\mathrm Re=500\), respectively.

4.2 Three Dimensional Results

In this section, we show the performance of the algorithm on several three dimensional problems for different design domains in Fig. 7. In the following examples, the magnitude of the velocity for the Dirichlet boundary condition on a slice is set as

$$\begin{aligned} |\mathbf{u}_D|=\bar{g}\Big (1-\frac{(s_1-a)^2+(s_2-b)^2}{l^2}\Big ), \end{aligned}$$

where \(\bar{g}\) is the prescribed velocity at the center (ab) of a circle in which the inflow/outflow velocity is imposed, l is the radius of the circle, \((s_1,s_2)\) are Cartesian coordinates on the slice.

Fig. 7
figure 7

Design domains of three dimensional examples

Example 5

In the example, we consider the multi-outlet problem in Fig. 7a. For the inflow, we set \(\bar{g}=1\), \(l=0.2\), and \((a,b)=(\frac{1}{2}, \frac{1}{2})\) on \(x=0\) plane. For the outflow, we set \(l=0.1\), \(\bar{g}=1\), and \((a,b)=(0.8,0.5)\), (0.8, 0.5), (0.8, 0.5), and (0.8, 0.5) on \(y=0\), \(y=1\), \(z=0\), and \(z=1\) planes respectively. Throughout this example, we choose the initial distribution with fluid domain in a region of \(\{(x,y,z):x\in (0,1),y\in (0,1),z\in (\frac{1}{3},\frac{2}{3})\}\), and set \(\beta =0.2\), \(\alpha =2.5\mu \times 10^4\) and \(\mathrm Re=20\).

Fig. 8
figure 8

(Example 5) Left to right: Optimal configurations on different grids (top: \(32\times 32 \times 32\), bottom: \(85 \times 85 \times 85\)) and energy curves. The parameters are set as \(\tau =0.005\), \(\gamma =0.0001\), \(\bar{\alpha }=2.5\upmu \times 10^4\) and \(\mathrm Re=20\)

Fig. 9
figure 9

(Example 5) The slices on the \(85\times 85\times 85\) grid for \(\tau =0.005\), \(\gamma =0.0001\), \(\bar{\alpha }=2.5\upmu \times 10^4\) and \(\mathrm Re=20\). Left: The slice on \(z=0.5\) plane. Right: The slice on \(y=0.5\) plane

Fig. 10
figure 10

(Example 5) Plots of energy curves for \(\bar{\alpha }=2.5\upmu \times 10^4\) and \(\mathrm Re=20\). Left: For fixed \(\gamma =0.0001\), energy curves for the cases of \(\tau =0.01,0.005,0.001\). Right: For fixed \(\tau =0.005\), energy curves for the cases of \(\gamma =0.0005,0.0001,0.00005\)

We first test the case for \(\tau =0.005\) and \(\gamma =0.0001\) on \(32\times 32\times 32\) and \(85\times 85\times 85\) grids. The optimal results in the left graphs of Fig. 8 are consistent with those obtained using the level set method in [10]. In addition, from the energy decaying curves in Fig. 8, we observe that the iteration converges in about 20 steps and 30 steps on coarse and fine grids respectively. In Fig. 9, we displayed the slices on \(32\times 32\times 32\) grids on \(z=0.5\) and \(y = 0.5\) planes.

Next, we compute the result for different \(\tau \) and \(\gamma \) on the \(32\times 32\times 32\) grid. The energy curves for \(\gamma =0.0001\) and \(\tau =0.01,0.005,0.001\) are displayed in the left graph of Fig. 10, and the energy curves for \(\tau =0.005\) and \(\gamma =0.001,0.0005,0.0001\) are displayed in the right graph of Fig. 10. We observe that the energy converges to almost the same value for different \(\gamma \) and \(\tau \).

Example 6

Here, we consider an example with two inlets and four outlets. The design domain is defined in Fig. 7a. For the two inflows, let \(\bar{g}=2\), \(l=0.05\) and \((a,b)=(0.5,0.5)\) on \(x=0\) and \(x=1\) planes respectively. For the four outflows, we set \(\bar{g}=1\), \(l=0.05\) and \((a,b)=(0.5,0.5)\) on \(y=0\), \(y=1\), \(z=0\) and \(z=1\) planes respectively. In the example, we use our algorithm to obtain the final optimal result for \(\tau =0.001\), \(\gamma =0.0001\), \(\bar{\alpha }=2.5\upmu \times 10^4\) and \(\mathrm Re=1\). The initial distribution of fluid region is set as \(\{(x,y,z):x\in (0,1),y\in (0,1),z\in (\frac{1}{6},\frac{5}{6})\}\).

For the fluid fraction \(\beta =0.1\), we design optimal configurations on \(64\times 64\times 64\) and \(90\times 90\times 90\) grids. The final results for the coarse and fine grids with corresponding energy decaying curves are displayed in Fig. 11. We observe that the interface is smoother on the fine mesh and the iteration converges in 25 and 30 steps for the coarse and fine grids respectively.

Fig. 11
figure 11

(Example 6) Left to right: Optimal configurations on the different grids (top: \(64\times 64\times 64\), bottom: \(90\times 90\times 90\)) and energy decaying curves. The fluid fraction is \(\beta =0.18\)

Fig. 12
figure 12

(Example 6) Left to right: Optimal configurations for different \(\beta \) (top: \(\beta = 0.1\), bottom: \(\beta = 0.18\)), energy decaying curves, and slices on \(y=0.5\) plane

Based on the \(64\times 64\times 64\) grid, we check the dependency of the results on the choice of \(\beta \). In Fig. 12, we displayed the results, energy decaying curves, and slices on the \(y=0.5\) plane for the optimal shape obtained by \(\beta =0.1\) and 0.18. The iteration converges in about 25 steps and 20 steps for \(\beta =0.1\) and 0.18. From Fig. 12, we can observe that the solid domain in the center shrinks as \(\beta \) increases.

5 Conclusion

In this paper, we present an efficient threshold dynamics method for topology optimization for Navier–Stokes flow. This is an extension of our previous work [9] to the case of fluids in Navier–Stokes flow. We aim to minimize a total energy functional that consists of the potential power and the perimeter approximated by nonlocal energy. Different from the algorithm in [9], during the iterations of the algorithm, we need to solve not only the Brinkman equation but also an adjoint problem by the mixed finite element method. Then the indicator functions of fluid-solid regions are updated by a thresholding step which is based on the convolutions evaluated by the FFT. A simple adaptive time strategy is used to accelerate the convergence of the algorithm. Some numerical examples are presented to verify the efficiency of the new algorithm, and the total energy decaying property of the proposed algorithm can be observed numerically. The proposed algorithm is simple and easy to implement. For the numerical experiments that we have performed, the proposed algorithm always finds an optimal shape and the numerical results are relatively insensitive to the initial guesses and parameters.