1 Introduction

Recent advances in additive manufacturing have allowed for complex architected materials. Geometrically sophisticated devices or structures at the micro/nanoscale, such as micro-electro-mechanical systems, are designed with thin-film fabrication techniques (Villanueva and Maute 2014). Even direct manipulation of individual atoms to design materials in the field of nanotechnology has been possible (Chen et al. 2020). Topology optimization can be used to find the optimal material distribution or topology within a given domain so as to improve the performance, durability, and efficiency of materials or structures. On the other hand, topology optimization provides unrestricted and heuristic designs of micro/nanostructures. To fully utilize the new manufacturing approaches, it is critical to design microstructural materials with desired properties, which are determined by the topologies and compositions of the microstructure.

Homogenization is commonly used to compute the effective parameters for materials with complex microstructures. Topology optimization of material microstructures is the inverse problem of homogenization, aiming to find the interior topology of a base cell with specific properties (Sigmund 1994), such as negative Poisson’s ratio (Clausen et al. 2015; Vogiatzis et al. 2017), maximum shear modulus (Du et al. 2017; Huang et al. 2011), maximum bulk modulus (Huang et al. 2011; Gibiansky and Sigmund 2000), maximum buckling strength (Thomsen et al. 2018), etc. Popular topology optimization methods included the density-based approach (Andreassen et al. 2011; Xia and Breitkopf 2015; Gao et al. 2019), level-set method (Wang et al. 2003; Vogiatzis et al. 2017; Gao et al. 2018; Nguyen et al. 2020), and BESO method (Huang and Xie 2009; Huang et al. 2011; Radman et al. 2013), to name a few. When the material consists of a periodically repeated microstructure, the asymptotic homogenization method is a good choice to extract the homogenized material properties. It corresponds to the energy-based approaches that employ average stress and strain theorems (Sigmund 1994). The homogenization method is often combined with an adjoint method (Bendsoe and Sigmund 2003) to conduct the sensitivity analysis, which can be difficult with increasing complexity for instance for multi-field problems.

In this study, we propose a new methodology for topology optimization of microstructures using perturbation analysis and penalty methods. The homogenized material coefficients are efficiently computed with multiple load cases based on perturbation analysis (Kaczmarczyk et al. 2008), which avoids complex mathematical derivations. Periodic boundary conditions are imposed with the penalty methods. The sensitivity analysis is implemented directly without the adjoint method. The main advantage of the method is that it can be easily extended to the multi-field coupling material design problems of first-order and even second-order homogenization. The derivation of the proposed method is more straightforward than the traditional method using the asymptotic expansion. In terms of optimization problems related to the stiffness tensor, this method may have no advantage. However, the adjoint method is used in the traditional direct manner, which is not intuitive for the multi-field coupling problem, especially the second-order homogenization problem. In addition, the calculation of the homogenized material parameter (piezoelectric tensor, dielectric tensor) based on the asymptotic expansion method is quite complex.

The remainder of the paper is organized as follows: Sect. 2 introduces the proposed method including a comparison with the energy-based method; Sect. 3 presents the formulations for the design of piezoelectric materials while Sect. 4 describes the numerical implementation. Three numerical examples are used to demonstrate the capability of the methodology in section 5 before Sect. 6 concludes our manuscript.

2 Topology optimization formulations based on the proposed method

2.1 Homogenization with perturbation analysis

In the \(\hbox {FE}^{2}\) (Feyel and Chaboche 2000) approach, the microscopic displacement field \({\varvec{u}}_{\textrm{m }}\) can be written as the sum of a macroscopic field and a periodic fluctuation field,

$$\begin{aligned} {\varvec{u}}_{\textrm{m }}=\varvec{\varepsilon }_{\textrm{M}}\cdot {\varvec{y}}+{\varvec{r}}_u \end{aligned}$$
(1)

where \(\varvec{\varepsilon }_{\textrm{M}}\) is the macroscopic strain, \({\varvec{y}}\) is the local base cell spatial coordinate, and \({\varvec{r}}_u\) is the displacement microfluctuation field. The volume average of the microstrain field is equal to the macroscopic strain, where the symmetric operator is dropped since it has been assumed (Kaczmarczyk et al. 2008).

$$\begin{aligned}{} & {} \frac{1}{ V }\int _{V}\varvec{\varepsilon }_{\textrm{m}}{\rm{dV}}=\frac{1}{ V }\int _{V}({\varvec{u}}_{\textrm{m}}\otimes \bigtriangledown ){\rm{dV}}\nonumber \\{} & {} \quad =\varvec{\varepsilon }_{\textrm{M}}+\underset{=0}{\underbrace{\frac{1}{ V }\int _{V}({\varvec{r}}_u\otimes \bigtriangledown ){\rm{dV}}}} \end{aligned}$$
(2)

The last integral of the RHS of Eq. (2) can be transformed into a boundary integral by the Gauss divergence theorem yielding

$$\begin{aligned}{} & {} \frac{1}{ V }\int _{V}({\varvec{r}}_u\otimes \bigtriangledown ){\rm{dV}}=\frac{1}{ V }\int _{\Gamma }({\varvec{r}}_u\otimes {\varvec{n}}){\rm{d}}\Gamma =0 \end{aligned}$$
(3)
$$\begin{aligned}{} & {} \quad {\varvec{r}}_{u \mathrm R}={\varvec{r}}_{u \mathrm L}, \; {\varvec{r}}_{u \mathrm T}={\varvec{r}}_{u \mathrm B} \end{aligned}$$
(4)

where \(\mathrm R\), \(\mathrm L\), \(\mathrm T\) , and \(\mathrm B\) represent the right, left, top, and bottom boundaries of the base cell, respectively. Periodic boundary conditions finally lead to the equation

$$\begin{aligned}{}[[{\varvec{u}}]]={\varvec{u}}^+_{\textrm{m}} - {\varvec{u}}^-_{\textrm{m}}=({\varvec{W}}^+ - {\varvec{W}}^-)\varvec{\varepsilon }_{\textrm{M}} = {\varvec{g}} \end{aligned}$$
(5)

where \([[{\varvec{u}}]]\) denotes the jump in the displacement field (Fig. 1), where the matrix \({\varvec{W}}\) is determined by the node coordinate \({\varvec{y}}\):

$$\begin{aligned}{} & {} {\varvec{W}}=\begin{bmatrix} y_1 &{} 0 &{} \frac{1}{2} y_2 \\ 0 &{} y_2 &{} \frac{1}{2} y_1\\ \end{bmatrix} (\mathrm 2D \; problems),\;\nonumber \\{} & {} \quad {\varvec{W}}=\begin{bmatrix} y_1 &{} 0 &{} 0 &{} \frac{1}{2} y_2 &{} 0 &{} \frac{1}{2} y_3\\ 0 &{} y_2&{} 0 &{} \frac{1}{2} y_1 &{} \frac{1}{2} y_3 &{} 0 \\ 0 &{} 0&{} y_3 &{} 0 &{} \frac{1}{2} y_2 &{} \frac{1}{2} y_1 \\ \end{bmatrix} (\mathrm 3D \; problems) \end{aligned}$$
(6)
Fig. 1
figure 1

Periodic boundary conditions

The Hill-Mandel macro-homogeneity condition (Hill 1963) requires the increment energy equivalence between the microscale and the macroscale:

$$\begin{aligned}{} & {} \varvec{\sigma }_{\textrm{M}}:\delta \varvec{\varepsilon }_{\textrm{M}} = \frac{1}{V} \int _{V} \varvec{\sigma }_{\textrm{m}}:\delta \varvec{\varepsilon }_{\textrm{m}} {\rm{dV}}\nonumber \\{} & {} \quad \quad =\frac{1}{V} \int _{V} \varvec{\sigma }_{\textrm{m}}: (\delta \varvec{\varepsilon }_{\textrm{M}}+\delta {\varvec{r}}_u \otimes \bigtriangledown ){\rm{dV}} \end{aligned}$$
(7)
$$\begin{aligned}{} & {} \quad = \frac{1}{V} \int _{V} \varvec{\sigma }_{\textrm{m}} {\rm{dV}}: \delta \varvec{\varepsilon }_{\textrm{M}}+ \underset{=0 ( \text{Periodicity})}{\underbrace{\frac{1}{V} \int _{\Gamma }(\varvec{\sigma }_{\textrm{m}} \cdot \delta {\varvec{r}}_u \cdot {\varvec{n}}) {\rm{d}}\Gamma }} \end{aligned}$$
(8)

The macroscopic stress is obtained by

$$\begin{aligned} \varvec{\sigma }_{\textrm{M}} = \frac{1}{V} \int _{V} \varvec{\sigma }_{\textrm{m}} {\rm{dV}} \end{aligned}$$
(9)

The stress–strain relationship at the macroscale is not known a priori, and the linearized relation between stain increments and stress increments are

$$\begin{aligned} \Delta \varvec{\sigma }_{\textrm{M}} ={\varvec{C}}_{\sigma \varepsilon }^H:\Delta \varvec{\varepsilon }_{\textrm{M}} \end{aligned}$$
(10)

The above homogenized stiffness tensor \(C_{klmn }^H\) (\({\varvec{C}}_{\sigma \varepsilon }^H\)) in this study is computed by perturbation analysis. The so-called two-index notation is introduced for the material tangent matrix replacing kl or mn by i or j, respectively. After discretization of the base cell, the homogenized stiffness tensor can be computed as

$$\begin{aligned}{} & {} C_{ij}^{H}=\frac{{\varvec{I}}_n^i}{V}\sum _{e}\int _{v}\varvec{\sigma }^{e}(\varvec{\varepsilon }_{\textrm{M}}^{j}){\rm{dv}}\nonumber \\{} & {} \quad =\frac{{\varvec{I}}_n^i}{V} \sum _{e}\int _{v} {\varvec{C}}^{e} {\varvec{B}}{\varvec{u}}^e(\varvec{\varepsilon }_{ \mathrm M}^{j}) {\rm{dv}} \end{aligned}$$
(11)

where \({\varvec{u}}^e(\varvec{\varepsilon }_{M}^{j})\) is the solution of nodal unknowns corresponding to the unit test strain; \({\varvec{I}}_{n}^{i}\) is the i-th row of the identity matrix \({\varvec{I}}_{n}\), where n is equal to three (2D) or six (3D). \({\varvec{B}}\), \({\varvec{C}}^{e}\) are the shape function gradient and the material stiffness tensor, respectively.

2.2 Imposition of the periodic boundary conditions using the penalty methods

The variational formulation of the penalty methods and periodic boundary conditions is given by (Henyš et al. 2019; Nguyen et al. 2014; Sanders et al. 2012):

$$\begin{aligned}{} & {} \int _{V} \varvec{\sigma }_{\textrm{m}}({\varvec{u}}): \varvec{\varepsilon }_{\textrm{m}}({\varvec{v}}){\rm{dV}}+ \alpha \int _{\Gamma } [[{\varvec{u}}]]\cdot [[{\varvec{v}}]]{\rm{d}}\Gamma \nonumber \\{} & {} \quad =\alpha \int _{\Gamma }{\varvec{g}}\cdot [[{\varvec{v}}]]{\rm{d}}\Gamma \end{aligned}$$
(12)

where \(\alpha\) is the penalty parameter, and \({\varvec{u}}\), \({\varvec{v}}\) are the displacement variables of the solution and trial functions, respectively. With the interpolation on the boundary, the solution and trial displacement gap functions are approximated as:

$$\begin{aligned}{}[[{\varvec{u}}]] = {\varvec{N}}^{+}{\varvec{u}}_{\Gamma } ^{+}- {\varvec{N}}^{-}{\varvec{u}}_{\Gamma } ^{-}, \; [[{\varvec{v}}]] = {\varvec{N}}^{+}{\varvec{v}}_{\Gamma } ^{+} - {\varvec{N}}^{-}{\varvec{v}}_{\Gamma } ^{-} \end{aligned}$$
(13)

where \({\varvec{N}}^{+}\) and \({\varvec{N}}^{-}\) are the shape function matrices. To illustrate the imposition of periodic boundary constraints, we partition the displacement vector \({\varvec{U}}\) into the interior displacements and displacements on the boundary \({\Gamma }^{+}\) and \({\Gamma }^{-}\). The global system of equations can be obtained as

$$\begin{aligned}{} & {} \begin{bmatrix} {\varvec{K}}_{b}^{(1,1)} &{} {\varvec{K}}_{b}^{(1,2)} &{} {\varvec{K}}_{b}^{(1,3)} \\ {\varvec{K}}_{b}^{(2,1)} &{} {\varvec{K}}_{b}^{(2,2)} +{\varvec{K}}_{p}^{(1,1)} &{} {\varvec{K}}_{b}^{(2,3)}+{\varvec{K}}_{p}^{(1,2)} \\ {\varvec{K}}_{b}^{(3,1)} &{} {\varvec{K}}_{b}^{(3,2)}+{\varvec{K}}_{p}^{(2,1)} &{} {\varvec{K}}_{b}^{(3,3)} +{\varvec{K}}_{p}^{(2,2)} \end{bmatrix}\begin{bmatrix} \varvec{\bar{U}}\\ {\varvec{U}}^{+}\\ {\varvec{U}}^{-} \end{bmatrix}\nonumber \\{} & {} \quad \quad =\begin{bmatrix} {\varvec{0}}\\ {\varvec{F}}^{+}\\ {\varvec{F}}^{-} \end{bmatrix} \end{aligned}$$
(14)

where \({\varvec{K}}_b\) is the bulk stiffness matrix, and \({\varvec{K}}_{p}\) and \({\varvec{F}}\) are the penalty coupling matrix and external force vector generated by penalty methods, respectively. The penalty parameter \(\alpha\) is chosen to make the pivot element of \({\varvec{K}}_{p}\) be orders of magnitude greater than the pivot element of \({\varvec{K}}_{b}\). The above matrices are given by

$$\begin{aligned}{} & {} {\varvec{K}}_{b}= \sum _{e}{\varvec{G}}_e^T{\varvec{K}}_b^e{\varvec{G}}_e, \; {\varvec{K}}_b^e=\int _{v}{\varvec{B}}^{T}{\varvec{C}}^{e}{\varvec{B}}{\rm{dv}} \end{aligned}$$
(15)
$$\begin{aligned}{} & {} \quad \begin{bmatrix} {\varvec{K}}_{p}^{(1,1)} &{} {\varvec{K}}_{p}^{(1,2)}\\ {\varvec{K}}_{p}^{(2,1)}&{} {\varvec{K}}_{p}^{(2,2)} \end{bmatrix}\nonumber \\{} & {} \quad \quad =\alpha \begin{bmatrix} \int _{\Gamma }{\varvec{N}}^{+T}{\varvec{N}}^{+}{\rm{d}}\Gamma &{} -\int _{\Gamma }{\varvec{N}}^{+T}{\varvec{N}}^{-}{\rm{d}}\Gamma \\ -\int _{\Gamma }{\varvec{N}}^{-T}{\varvec{N}}^{+}{\rm{d}}\Gamma &{} \int _{\Gamma }{\varvec{N}}^{-T}{\varvec{N}}^{-}{\rm{d}}\Gamma \end{bmatrix} \end{aligned}$$
(16)
$$\begin{aligned}{} & {} \quad \begin{bmatrix} {\varvec{F}}^{+}\\ {\varvec{F}}^{-} \end{bmatrix}=\alpha \begin{bmatrix} \int _{\Gamma }{\varvec{N}}^{+T}{\varvec{g}}{\rm{d}}\Gamma \\ - \int _{\Gamma }{\varvec{N}}^{-T}{\varvec{g}}{\rm{d}}\Gamma \end{bmatrix} \end{aligned}$$
(17)

2.3 Sensitivity analysis

The modified SIMP approach (Solid Isotropic Material with Penalization) (Andreassen et al. 2011) is applied here, where the design domain is discretized by square finite elements, and each element is assigned a pseudo-density \(\rho _e\) that determines its stiffness tensor \({\varvec{C}}^e\):

$$\begin{aligned} {\varvec{C}}^e(\rho _e)= (f_{\min}+\rho _e^{p}(f_{0}-f_{\min}) ){\varvec{C}}_{0} \end{aligned}$$
(18)

where \({\varvec{C}}_{0}\) is the material stiffness tensor, \(f_{0}=1\), and \(f_{min}\) is a very small factor assigned to void regions to prevent the singularity of the stiffness matrix, and p is a penalization factor introduced to reduce the intermediate densities. The mathematical formulation of the optimization problem reads as follows:

$$\begin{aligned} \begin{aligned} \underset{\rho }{\textrm{min}}&:c(C^H_{ij}(\rho ))\\ \mathrm {{subject \, to}}&: {\varvec{K}}{\varvec{U}}_{s}={\varvec{F}}_{s}\\&: \sum _{e}v_e\rho _e/V\leqslant \vartheta \\&:0\leqslant \rho _e \leqslant 1 \end{aligned} \end{aligned}$$
(19)

where c is the objective function, \({\varvec{K}}\) is the global stiffness matrix defined in (14), \({\varvec{U}}_{s}\) and \({\varvec{F}}_{s}\) are the global displacement and force vectors corresponding to the unit test strain, respectively; \(v_e\), V, and \(\vartheta\) are the element volume, the base cell volume, and the prescribed volume fraction, respectively. The sensitivity of the objection function \({\partial c}/{\partial \rho _e}\) is computed based on the perturbation analysis and penalty methods. By differentiating (19), we obtain:

$$\begin{aligned}{} & {} \frac{\partial {\varvec{K}}}{\partial \rho _k} {\varvec{U}}_s+{\varvec{K}}\frac{\partial {\varvec{U}}_s}{\partial \rho _k}=\frac{\partial {\varvec{F}}_s}{\partial \rho _k}={\varvec{0}} \end{aligned}$$
(20)
$$\begin{aligned}{} & {} \quad \frac{\partial {\varvec{U}}_s}{\partial \rho _k}=-{\varvec{K}}^{-1} \frac{\partial {\varvec{K}}}{\partial \rho _k} {\varvec{U}}_s=-{\varvec{K}}^{-1}{\varvec{G}}_k^T\frac{\partial {\varvec{K}}_b^k}{\partial \rho _k}{\varvec{G}}_k{\varvec{U}}_s\nonumber \\{} & {} \quad \quad =-{\varvec{K}}^{-1}{\varvec{G}}_k^T\frac{\partial {\varvec{K}}_b^k}{\partial \rho _k}{\varvec{U}}^k_s=-{\varvec{K}}^{-1}{\varvec{M}}^k_s \end{aligned}$$
(21)

where

$$\begin{aligned}{} & {} {\varvec{K}}={\varvec{K}}_b+{\varvec{K}}_{p}=\sum _{e}{\varvec{G}}_e^T{\varvec{K}}_b^e{\varvec{G}}_e+{\varvec{K}}_{p} \end{aligned}$$
(22)
$$\begin{aligned}{} & {} \quad {\varvec{M}}^k_s={\varvec{G}}_k^T\frac{\partial {\varvec{K}}_b^k}{\partial \rho _k}{\varvec{U}}^k_s \end{aligned}$$
(23)

The penalty coupling matrix \({\varvec{K}}_p\) and external force vector \({\varvec{F}}_s\) are independent of the element density variable. \({\varvec{G}}\) is the transformation matrix forming the global stiffness matrix, \({\varvec{K}}_b^k\) and \({\varvec{U}}^k_s\) are the element stiffness matrix and the vector containing the degrees of freedom (DOFs). The sensitivity of the homogenized stiffness tensor \({\partial C_{ij}^{H}}/ \partial {\rho _{e}}\) consists of two terms:

$$\begin{aligned}{} & {} \frac{\partial C_{ij}^{H}}{\partial \rho _{k}} =\frac{{\varvec{I}}_n^i}{V}\int _{v} \frac{\partial {\varvec{C}}^k}{\partial \rho _k} {\varvec{B}}{\varvec{u}}^k(\varvec{\varepsilon }_{\textrm{M}}^{j}){\rm{dv}}+\nonumber \\{} & {} \quad \frac{{\varvec{I}}_n^i}{V}\sum _{e}\int _{v} {\varvec{C}}^e {\varvec{B}} \frac{\partial {\varvec{u}}^e(\varvec{\varepsilon }_{\textrm{M}}^{j})}{\partial \rho _k} {\rm{dv}} \end{aligned}$$
(24)

The first term on the right side of (24) can be written as

$$\begin{aligned}{} & {} \frac{{\varvec{I}}_n^i}{V}\int _{v} \frac{\partial {\varvec{C}}^k}{\partial \rho _k} {\varvec{B}}{\varvec{u}}^k(\varvec{\varepsilon }_{\textrm{M}}^{j}){\rm{dv}}\nonumber \\{} & {} \quad =\frac{{\varvec{I}}_n^i}{V} \frac{\partial {\varvec{C}}^k}{\partial \rho _k} \left( \int _{v} {\varvec{B}}{\rm{dv}}\right) {\varvec{u}}^k(\varvec{\varepsilon }_{\textrm{M}}^{j}) \nonumber \\{} & {} \quad \quad =\frac{{\varvec{I}}_n^i}{V} p\rho _k^{p-1}(f_{0}-f_{min}) {\varvec{C}}_0 \tilde{{\varvec{B}}}{\varvec{u}}^k(\varvec{\varepsilon }_{\textrm{M}}^{j}) \end{aligned}$$
(25)

where \(\tilde{{\varvec{B}}}=\int _{v} {\varvec{B}}{\rm{dv}}\). Introducing (21) in the second term on the right side of (24) yields

$$\begin{aligned} \begin{aligned} \frac{{\varvec{I}}_n^i}{V}\sum _{e}\int _{v} {\varvec{C}}^e {\varvec{B}}&\frac{\partial {\varvec{u}}^e(\varvec{\varepsilon }_{\textrm{M}}^{j})}{\partial \rho _k} {\rm{dv}}= \frac{{\varvec{I}}_n^i}{V} \left( \sum _{e}\int _{v} {\varvec{C}}^e {\varvec{B}} {\varvec{G}}_e {\rm{dv}}\right) \frac{\partial {\varvec{U}}(\varvec{\varepsilon }_{\textrm{M}}^{j})}{\partial \rho _k} \\&= - \frac{{\varvec{I}}_n^i}{V} {\varvec{J}} {\varvec{K}}^{-1}{\varvec{M}}^k(\varvec{\varepsilon }_{\textrm{M}}^{j}) = - \frac{{\varvec{I}}_n^i}{V} {\varvec{l}}^T {\varvec{M}}^k(\varvec{\varepsilon }_{\textrm{M}}^{j}) \end{aligned} \end{aligned}$$
(26)

with

$$\begin{aligned} {\varvec{J}} = \sum _{e}\int _{v} {\varvec{C}}^e {\varvec{B}} {\varvec{G}}_e{\rm{dv}}, \; {\varvec{l}} = {\varvec{K}}^{-1} {\varvec{J}}^T \end{aligned}$$
(27)

The computation of \({\varvec{J}}\) can be prepared in advance, and \({\varvec{l}}\) is identical for each element and only needs to be calculated once in each optimization loop reducing the computational cost. Hence, the sensitivity of the homogenized stiffness tensor is given as:

$$\begin{aligned}{} & {} \frac{\partial C_{ij}^{H}}{\partial \rho _{k}} =\frac{{\varvec{I}}_n^i}{V} p\rho _k^{p-1}(f_{0}-f_{min}) {\varvec{C}}_0 \tilde{{\varvec{B}}}{\varvec{u}}^k(\varvec{\varepsilon }_{\textrm{M}}^{j})\nonumber \\{} & {} \quad - \frac{{\varvec{I}}_n^i}{V} {\varvec{l}}^T {\varvec{M}}^k(\varvec{\varepsilon }_{\textrm{M}}^{j}) \end{aligned}$$
(28)

2.4 Comparison

In the classic asymptotic homogenization method, the homogenized stiffness tensor is given by the volume integration over the base cell (Sigmund 1994)

$$\begin{aligned} C^H_{ijkl}=\frac{1}{V}\int _{V}C_{pqrs}(\varepsilon ^{0(ij)}_{pq}-\varepsilon ^{*(ij)}_{pq})(\varepsilon ^{0(kl)}_{rs}-\varepsilon ^{*(kl)}_{rs}){\rm{dV}} \end{aligned}$$
(29)

where \(\varepsilon ^{*(kl)}_{pq}\) is the periodic solution to the variational problem

$$\begin{aligned} \int _{V}C_{ijpq}\varepsilon ^{0(kl)}_{pq}\frac{\partial v_i}{\partial y_j}{\rm{dV}}=\int _{V}C_{ijpq}\varepsilon ^{*(kl)}_{pq}\frac{\partial v_i}{\partial y_j}{\rm{dV}} \end{aligned}$$
(30)

where \(\varepsilon ^{0(kl)}_{pq}\) corresponds to the unit test strain fields on the base cell, and v is the Y-periodic admissible displacement field. There is an equivalent method to predict the effective material properties named the energy-based approach (Sigmund 1994; Xia and Breitkopf 2015; Gao et al. 2018), where the unit test strain fields are imposed on the boundary of the base cell (Sigmund 1994), and the homogenized stiffness tensor is calculated as

$$\begin{aligned} C^H_{ijkl}=\frac{1}{V}\int _{V}C_{pqrs}\varepsilon ^{A(ij)}_{pq}\varepsilon ^{A(kl)}_{rs}{\rm{dV}} \end{aligned}$$
(31)

After discretization of the base cell, (31) is approximated by

$$\begin{aligned} C^H_{ijkl}=\frac{1}{V}\sum _{e}({\varvec{u}}_e^{A(ij)})^T {\varvec{k}}_e{\varvec{u}}_e^{A(kl)} \end{aligned}$$
(32)

where \({\varvec{u}}_e^{A(ij)}\) is the element displacement solution corresponding to the unit test strain fields, and \({\varvec{k}}_e\) is the element stiffness matrix. The sensitivity of the homogenized stiffness tensor \({\partial C^H_{ijkl}}/{\partial \rho _e}\) is computed using the adjoint method (Xia and Breitkopf 2015),

$$\begin{aligned} \frac{\partial C^H_{ijkl}}{\partial \rho _e}=\frac{1}{V}p\rho _e^{p-1}(f_{0}-f_{min})({\varvec{u}}_e^{A(ij)})^T {\varvec{k}}_0{\varvec{u}}_e^{A(kl)} \end{aligned}$$
(33)

\({\varvec{k}}_0\) being the element stiffness matrix for elements with \(\rho _e=1\). Periodic boundary conditions are often imposed in a direct manner for the above energy-based method in 2D (Xia and Breitkopf 2015) and 3D (Gao et al. 2018), where the boundary constraints are separated into the corner, edge, and face (3D) constraints to prevent overconstraints, then the redundant unknown freedoms are eliminated. It is simpler to impose the periodic boundary conditions using the penalty methods as constraints are applied only on the boundary elements, especially for 3D problems, while the direct approach requires dealing with additional constraints on the corner or the edge as shown in Fig. 2. However, the penalty method is variationally inconsistent, and discrete results are sensitive to the penalty parameter \(\alpha\)  (Sanders et al. 2012).

Fig. 2
figure 2

Comparison of two methods of imposing periodic boundary conditions, a penalty methods, b the direct method

A comparison of the proposed method and the energy-based approach is found in Table 1. For the energy-based approach, the imposition of periodic boundary conditions is not limited to the direct manner, and the penalty methods and Lagrange multipliers can also be adopted. With the adjoint method, the formulations of homogenization and sensitivity analysis are more concise. However, the proposed method is more straightforward in derivation and has hardly been applied before. More importantly, it can be easily extended to other multi-field coupling microstructure optimization issues, which will be illustrated in the next section.

Table 1 Comparison of the proposed method and energy-based approach

3 Extension to the design of piezoelectric materials

3.1 Homogenization

The piezoelectric constitutive relations are given by:

$$\begin{aligned}{}&{} \varvec{\sigma }= {\varvec{C}} \varvec{\varepsilon }- {\varvec{e}} {\varvec{E}} \end{aligned}$$
(34)
$$\begin{aligned}{} & {}{\varvec{D}}={\varvec{e}}^T \varvec{\varepsilon }+ \varvec{\kappa } {\varvec{E}} \end{aligned}$$
(35)

with \({\varvec{E}}=-\phi \nabla\). \({\varvec{C}}\), \({\varvec{e}}\) , and \(\varvec{\kappa }\) indicating the elastic stiffness tensor, the piezoelectric tensor, and the dielectric tensor, respectively; \({\varvec{D}}\), \({\varvec{E}}\) , and \(\phi\) are the electric displacement vector, the electric field vector, and the electric potential, respectively. The microscopic displacement \({\varvec{u}}_{\textrm{m }}\) and \(\phi _{\textrm{m }}\) can be written as the sum of a macroscopic field and a periodic fluctuation field,

$$\begin{aligned}{} & {} {\varvec{u}}_{\textrm{m }}=\varvec{\varepsilon }_{\textrm{M}}\cdot {\varvec{y}}+{\varvec{r}}_u \end{aligned}$$
(36)
$$\begin{aligned}{} & {} \quad \phi _{\textrm{m }}=(-{\varvec{E}}_{\textrm{M}}) \cdot {\varvec{y}}+r_\phi \end{aligned}$$
(37)

where \({\varvec{E}}_{\textrm{M}}\) is the macroscopic electric field while \(r_\phi\) is the electric potential microfluctuation field. After the volume average of \(\varvec{\varepsilon }_{\textrm{m}}\) and \({\varvec{E}}_{\textrm{m}}\), the following boundary conditions can be obtained,

$$\begin{aligned} {\varvec{r}}_{u \mathrm R}={\varvec{r}}_{u \mathrm L}, \; {\varvec{r}}_{u \mathrm T}={\varvec{r}}_{u \mathrm B}, \; r_{\phi \mathrm R}=r_{\phi \mathrm L}, \; r_{\phi \mathrm T}=r_{\phi \mathrm B} \end{aligned}$$
(38)

Periodic boundary conditions lead to

$$\begin{aligned}{} & {} [[{\varvec{u}}]]={\varvec{u}}^+_{\textrm{m}} - {\varvec{u}}^-_{\textrm{m}}=({\varvec{W}}^+ - {\varvec{W}}^-)\varvec{\varepsilon }_{\textrm{M}} = {\varvec{g}} \end{aligned}$$
(39)
$$\begin{aligned}{} & {} \quad [[\phi ]]=\phi ^+_{\textrm{m}} - \phi ^-_{\textrm{m}}=({\varvec{L}}^+ - {\varvec{L}}^-)(-{\varvec{E}}_{\textrm{M}} )= q \end{aligned}$$
(40)

where \([[{\varvec{u}}]]\) and \([[\phi ]]\) are the jump in the displacement field and the electric potential (Fig. 3), and the matrix \({\varvec{W}}\) (6) and \({\varvec{L}}\) are determined by the node coordinate \({\varvec{y}}\):

$$\begin{aligned}{} & {} {\varvec{L}}=\begin{bmatrix} y_1&y_2 \end{bmatrix} (\mathrm 2D \; problems),\;\nonumber \\{} & {} \quad {\varvec{L}}=\begin{bmatrix} y_1&y_2&y_3 \end{bmatrix} (\mathrm 3D \; problems) \end{aligned}$$
(41)
Fig. 3
figure 3

Periodic boundary conditions

The Hill-Mandel energy condition can be expressed as

$$\begin{aligned}{} & {} \varvec{\sigma }_{\textrm{M}}:\delta \varvec{\varepsilon }_{\textrm{M}} -{\varvec{D}}_{\textrm{M}} \cdot \delta {\varvec{E}}_{\textrm{M}}\nonumber \\{} & {} \quad =\frac{1}{V} \int _{V} (\varvec{\sigma }_{\textrm{m}}:\delta \varvec{\varepsilon }_{\textrm{m}} -{\varvec{D}}_{\textrm{m}} \cdot \delta {\varvec{E}}_{\textrm{m}} ) {\rm{dV}} \end{aligned}$$
(42)

This condition can be subdivided into mechanical and electrical parts as (Schröder and Keip 2012)

$$\begin{aligned}{} & {} \varvec{\sigma }_{\textrm{M}}:\delta \varvec{\varepsilon }_{\textrm{M}} = \frac{1}{V}\int _{V} \varvec{\sigma }_{\textrm{m}}:\delta \varvec{\varepsilon }_{\textrm{m}} {\rm{dV}} \end{aligned}$$
(43)
$$\begin{aligned}{} & {} \quad -{\varvec{D}}_{\textrm{M}} \cdot \delta {\varvec{E}}_{\textrm{M}} = \frac{1}{V} \int _{V} ( -{\varvec{D}}_{\textrm{m}} \cdot \delta {\varvec{E}}_{\textrm{m}}) {\rm{dV}} \end{aligned}$$
(44)

The homogenized stress and electric displacement can be obtained by averaging:

$$\begin{aligned}{} & {} \varvec{\sigma }_{\textrm{M}} = \frac{1}{V} \int _{V} \varvec{\sigma }_{\textrm{m}} {\rm{dV}} \end{aligned}$$
(45)
$$\begin{aligned}{} & {} {\varvec{D}}_{\textrm{M}} =\frac{1}{V} \int _{V} {\varvec{D}}_{\textrm{m}} {\rm{dV}} \end{aligned}$$
(46)

The updates of the macrolevel stress and electric displacement are performed by the following incremental relations:

$$\begin{aligned}{} & {} \Delta \varvec{\sigma }_{\textrm{M}}={\varvec{C}}_{\sigma \varepsilon }^{H}:\Delta \varvec{\varepsilon }_{\textrm{M}}+{\varvec{C}}_{\sigma E }^{H}\cdot \Delta (-{\varvec{E}}_{\textrm{M}}) \end{aligned}$$
(47)
$$\begin{aligned}{} & {} \quad \Delta {\varvec{D}}_{\textrm{M}}={\varvec{C}}_{D \varepsilon }^{H}:\Delta \varvec{\varepsilon }_{\textrm{M}} +{\varvec{C}}_{D E }^{H}\cdot \Delta (-{\varvec{E}}_{\textrm{M}} ) \end{aligned}$$
(48)

The homogenized stiffness tensor \({\varvec{C}}_{\sigma \varepsilon }^H\), the homogenized piezoelectric tensor \({\varvec{C}}_{\sigma E }^H\) (\({\varvec{C}}_{D \varepsilon }^H\)), and the homogenized dielectric tensor \({\varvec{C}}_{D E }^H\) are computed by perturbation analysis associated with independent unit test macroscopic strain and electric field. After discretization of the base cell, the above homogenized tensors for 2D problems can be computed as:

$$\begin{aligned}{} & {} C_{ij}^{H}=\frac{{\varvec{I}}_3^i}{V}\sum _{e}\int _{v}\varvec{\sigma }^{e}(\varvec{\varepsilon }_{\textrm{M}}^{j}){\rm{dv}}\nonumber \\{} & {} \quad \quad =\frac{{\varvec{I}}_3^i}{V}\sum _{e}\int _{v} ({\varvec{C}}^{e} {\varvec{B}}_{u}{\varvec{u}}^e(\varvec{\varepsilon }_{ \mathrm M}^{j}) +{\varvec{e}}^{e} {\varvec{B}}_{\phi }\varvec{\phi }^e(\varvec{\varepsilon }_{\textrm{M}}^{j})){\rm{dv}} \end{aligned}$$
(49)
$$\begin{aligned}{} & {} (e_{ij}^{H})^T=\frac{{\varvec{I}}_2^i}{V}\sum _{e}\int _{v} {\varvec{D}}^{e}(\varvec{\varepsilon }_{ \mathrm M}^{j}){\rm{dv}}\nonumber \\{} & {} \quad \quad =\frac{{\varvec{I}}_2^i}{V}\sum _{e}\int _{v} ({\varvec{e}}^{eT} {\varvec{B}}_{u}{\varvec{u}}^e(\varvec{\varepsilon }_{ \mathrm M}^{j})-\varvec{\kappa }^{e} {\varvec{B}}_{\phi }\varvec{\phi }^e(\varvec{\varepsilon }_{ \mathrm M}^{j})){\rm{dv}} \end{aligned}$$
(50)
$$\begin{aligned}{} & {} \kappa _{ij}^{H}=\frac{{\varvec{I}}_2^i}{V}\sum _{e}\int _{v} {\varvec{D}}^{e}(-{\varvec{E}}_{\textrm{M}}^{j}){\rm{dv}}\nonumber \\{} & {} \quad \quad =\frac{{\varvec{I}}_2^i}{V}\sum _{e}\int _{v} ({\varvec{e}}^{eT} {\varvec{B}}_{u}{\varvec{u}}^e(-{\varvec{E}}_{\textrm{M}}^{j})-\varvec{\kappa }^{e} {\varvec{B}}_{\phi }\varvec{\phi }^e(-{\varvec{E}}_{\textrm{M}}^{j})){\rm{dv}} \end{aligned}$$
(51)

where \({\varvec{u}}^e\) and \(\varvec{\phi }^e\) are the solutions of unknown freedoms corresponding to the unit test strain and electric field. \({\varvec{B}}_u\) and \({\varvec{B}}_\phi\) are the displacement and electric potential shape function gradient, respectively. \({\varvec{C}}^{e}\), \({\varvec{e}}^{e}\) , and \(\varvec{\kappa }^{e}\) are the material coefficient tensors of the elements.

The use of perturbation analysis makes the homogenization method easy to extend to multi-field coupling problems. In contrast, the formulations of the asymptotic homogenization method are more complex and need to be re-derived to deal with such problems (Silva et al. 1997, 1999).

3.2 Periodic boundary conditions

Periodic boundary conditions are also imposed with the penalty methods. The formulation can be derived in a similar way to the previous section. By dividing the unknown vector \({\varvec{U}}\) into the interior unknowns, displacements, and electric potentials on the boundary \({\Gamma }^{+}\) and \({\Gamma }^{-}\), the global system of equations can be obtained as:

$$\begin{aligned}{} & {} \begin{bmatrix} {\varvec{K}}_{b}^{(1,1)} &{} {\varvec{K}}_{b}^{(1,2)} &{} {\varvec{K}}_{b}^{(1,3)} &{} {\varvec{K}}_{b}^{(1,4)} &{} {\varvec{K}}_{b}^{(1,5)} \\ {\varvec{K}}_{b}^{(2,1)} &{} {\varvec{K}}_{b}^{(2,2)} +{\varvec{K}}_{pu}^{(1,1)} &{} {\varvec{K}}_{b}^{(2,3)}+{\varvec{K}}_{pu}^{(1,2)} &{} {\varvec{K}}_{b}^{(2,4)} &{} {\varvec{K}}_{b}^{(2,5)} \\ {\varvec{K}}_{b}^{(3,1)} &{} {\varvec{K}}_{b}^{(3,2)}+{\varvec{K}}_{pu}^{(2,1)} &{} {\varvec{K}}_{b}^{(3,3)} +{\varvec{K}}_{pu}^{(2,2)} &{} {\varvec{K}}_{b}^{(3,4)} &{} {\varvec{K}}_{b}^{(3,5)} \\ {\varvec{K}}_{b}^{(4,1)} &{} {\varvec{K}}_{b}^{(4,2)} &{} {\varvec{K}}_{b}^{(4,3)} &{} {\varvec{K}}_{b}^{(4,4)} +{\varvec{K}}_{p \phi }^{(1,1)} &{} {\varvec{K}}_{b}^{(4,5)} +{\varvec{K}}_{p \phi }^{(1,2)} \\ {\varvec{K}}_{b}^{(5,1)} &{} {\varvec{K}}_{b}^{(5,2)} &{} {\varvec{K}}_{b}^{(5,3)} &{} {\varvec{K}}_{b}^{(5,4)}+{\varvec{K}}_{p \phi }^{(2,1)} &{} {\varvec{K}}_{b}^{(5,5)} +{\varvec{K}}_{p \phi }^{(2,2)} \end{bmatrix}\nonumber \\{} & {} \quad \begin{bmatrix} \varvec{\bar{U}}\\ {\varvec{U}}^{+}\\ {\varvec{U}}^{-}\\ \varvec{\Phi }^{+}\\ \varvec{\Phi }^{-}\\ \end{bmatrix}=\begin{bmatrix} {\varvec{0}}\\ {\varvec{F}}_U^{+}\\ {\varvec{F}}_U^{-} \\ {\varvec{F}}_\Phi ^{+}\\ {\varvec{F}}_\Phi ^{-} \end{bmatrix} \end{aligned}$$
(52)

where \({\varvec{K}}_b\) is the bulk coupling stiffness matrix, \({\varvec{K}}_{pu}\), \({\varvec{K}}_{p\phi }\), \({\varvec{F}}_U\), and \({\varvec{F}}_\Phi\) are, respectively, the penalty coupling matrices and external force vectors generated by penalty methods. The above matrices are given by

$$\begin{aligned}{} & {} {\varvec{K}}_{b}= \sum _{e}{\varvec{G}}_e^T{\varvec{K}}_b^e{\varvec{G}}_e \end{aligned}$$
(53)
$$\begin{aligned}{} & {} {\varvec{K}}_{b}^e = \begin{bmatrix} {\varvec{K}}_{uu}^e&{} {\varvec{K}}_{u\phi } ^e \\ {\varvec{K}}_{\phi u}^e&{} {\varvec{K}}_{\phi \phi }^e \\ \end{bmatrix}\nonumber \\{} & {} \quad =\begin{bmatrix} \int _{v} {\varvec{B}}^T_{u}{\varvec{C}}^e{\varvec{B}}_{u}{\rm{dv}} &{} \int _{v}{\varvec{B}}^T_{u}{\varvec{e}}^e{\varvec{B}}_{\phi }{\rm{dv}}\\ \int _{v}{\varvec{B}}^T_{\phi }{\varvec{e}}^{eT}{\varvec{B}}_{u}{\rm{dv}} &{} \int _{v}({\varvec{B}}^T_{\phi }(-\varvec{\kappa }^e){\varvec{B}}_{\phi }){\rm{dv}} \end{bmatrix} \end{aligned}$$
(54)
$$\begin{aligned}{} & {} \quad \begin{bmatrix} {\varvec{K}}_{pu}^{(1,1)} &{} {\varvec{K}}_{pu}^{(1,2)}\\ {\varvec{K}}_{pu}^{(2,1)}&{} {\varvec{K}}_{pu}^{(2,2)} \end{bmatrix}\nonumber \\{} & {} \quad =\alpha \begin{bmatrix} \int _{\Gamma }{\varvec{N}}_u^{+T}{\varvec{N}}_u^{+}{\rm{d}}\Gamma &{} -\int _{\Gamma }{\varvec{N}}_u^{+T}{\varvec{N}}_u^{-}{\rm{d}}\Gamma \\ -\int _{\Gamma }{\varvec{N}}_u^{-T}{\varvec{N}}_u^{+}{\rm{d}}\Gamma &{} \int _{\Gamma }{\varvec{N}}_u^{-T}{\varvec{N}}_u^{-}{\rm{d}}\Gamma \end{bmatrix} \end{aligned}$$
(55)
$$\begin{aligned}{} & {} \quad \begin{bmatrix} {\varvec{K}}_{p\phi }^{(1,1)} &{} {\varvec{K}}_{p\phi }^{(1,2)}\\ {\varvec{K}}_{p\phi }^{(2,1)}&{} {\varvec{K}}_{p\phi }^{(2,2)} \end{bmatrix}\nonumber \\{} & {} \quad =\beta \begin{bmatrix} \int _{\Gamma }{\varvec{N}}_\phi ^{+T}{\varvec{N}}_\phi ^{+}{\rm{d}}\Gamma &{} -\int _{\Gamma }{\varvec{N}}_\phi ^{+T}{\varvec{N}}_\phi ^{-}{\rm{d}}\Gamma \\ -\int _{\Gamma }{\varvec{N}}_\phi ^{-T}{\varvec{N}}_\phi ^{+}{\rm{d}}\Gamma &{} \int _{\Gamma }{\varvec{N}}_\phi ^{-T}{\varvec{N}}_\phi ^{-}{\rm{d}}\Gamma \end{bmatrix} \end{aligned}$$
(56)
$$\begin{aligned}{} & {} \quad \begin{bmatrix} {\varvec{F}}_U^{+}\\ {\varvec{F}}_U^{-} \end{bmatrix}=\alpha \begin{bmatrix} \int _{\Gamma }{\varvec{N}}_u^{+T}{\varvec{g}}{\rm{d}}\Gamma \\ - \int _{\Gamma }{\varvec{N}}_u^{-T}{\varvec{g}}{\rm{d}}\Gamma \end{bmatrix}, \;\nonumber \\{} & {} \quad \begin{bmatrix} {\varvec{F}}_\Phi ^{+}\\ {\varvec{F}}_\Phi ^{-} \end{bmatrix}=\beta \begin{bmatrix} \int _{\Gamma }{\varvec{N}}_\Phi ^{+T} q {\rm{d}}\Gamma \\ - \int _{\Gamma }{\varvec{N}}_\Phi ^{-T} q {\rm{d}}\Gamma \end{bmatrix} \end{aligned}$$
(57)

where \(\alpha\) and \(\beta\) are the penalty parameters.

3.3 Sensitivity analysis

The material properties based on the SIMP model are determined by the design variable \(\rho _e\):

$$\begin{aligned}{} & {} {\varvec{C}}^e(\rho _e)=f(\rho _e){\varvec{C}}_0, \; {\varvec{e}}^e(\rho _e)=f(\rho _e){\varvec{e}}_0, \; \varvec{\kappa }^e(\rho _e)=f(\rho _e)\varvec{\kappa }_0 \end{aligned}$$
(58)
$$\begin{aligned}{} & {} \quad f(\rho _e)=f_{\min}+\rho _e^p(f_{0}-f_{\min}), \;\rho _e\in [0,1] \end{aligned}$$
(59)

The optimization objective c is a function of the homogenized tensors \({\varvec{C}}^{H}\), \({\varvec{e}}^{H}\) , and \(\varvec{\kappa }^{H}\). Taking the homogenized piezoelectric tensor \({\varvec{e}}^{H}\) (50) as an example, its sensitivity analysis is as follows.

$$\begin{aligned} \begin{aligned} \frac{\partial (e_{ij}^{H})^T}{\partial \rho _{k}} =&\frac{{\varvec{I}}_2^i}{V} \int _{v} \left( \frac{\partial {\varvec{e}}^{kT} }{\partial \rho _{k}} {\varvec{B}}_{u}{\varvec{u}}^k(\varvec{\varepsilon }_{ \mathrm M}^{j})- \frac{\partial \varvec{\kappa }^{k}}{\partial \rho _{k}} {\varvec{B}}_{\phi }\varvec{\phi }^k(\varvec{\varepsilon }_{ \mathrm M}^{j})\right) {\rm{dv}} \\ +&\frac{{\varvec{I}}_2^i}{V}\sum _{e}\int _{v} \left( {\varvec{e}}^{eT} {\varvec{B}}_{u} \frac{\partial {\varvec{u}}^e(\varvec{\varepsilon }_{ \mathrm M}^{j}) }{\partial \rho _{k}} - \varvec{\kappa }^{e} {\varvec{B}}_{\phi } \frac{\partial \varvec{\phi }^e(\varvec{\varepsilon }_{ \mathrm M}^{j})}{\partial \rho _{k}} \right) {\rm{dv}} \end{aligned} \end{aligned}$$
(60)

The first term on the right side of (60) can be written as

$$\begin{aligned}{} & {} \frac{{\varvec{I}}_2^i}{V} \int _{v} \left( \frac{\partial {\varvec{e}}^{kT} }{\partial \rho _{k}} {\varvec{B}}_{u}{\varvec{u}}^k(\varvec{\varepsilon }_{ \mathrm M}^{j})- \frac{\partial \varvec{\kappa }^{k}}{\partial \rho _{k}} {\varvec{B}}_{\phi }\varvec{\phi }^k(\varvec{\varepsilon }_{ \mathrm M}^{j})\right) {\rm{dv}}\nonumber \\{} & {} \quad \quad =\frac{{\varvec{I}}_2^i}{V} \frac{\partial {\varvec{e}}^{kT} }{\partial \rho _{k}} \left( \int _{v} {\varvec{B}}_{u} {\rm{dv}}\right) {\varvec{u}}^k(\varvec{\varepsilon }_{ \mathrm M}^{j})\nonumber \\{} & {} \quad - \frac{{\varvec{I}}_2^i}{V} \frac{\partial \varvec{\kappa }^{k}}{\partial \rho _{k}} \left( \int _{v} {\varvec{B}}_{\phi } {\rm{dv}}\right) \varvec{\phi }^k(\varvec{\varepsilon }_{ \mathrm M}^{j})\nonumber \\{} & {} \quad \quad =\frac{{\varvec{I}}_2^i}{V} p\rho _k^{p-1}(f_{0}-f_{min}) ({\varvec{e}}_0^{T}\tilde{{\varvec{B}}}_u {\varvec{u}}^k(\varvec{\varepsilon }_{ \mathrm M}^{j})- \varvec{\kappa }_0\tilde{{\varvec{B}}}_\phi \varvec{\phi }^k(\varvec{\varepsilon }_{ \mathrm M}^{j})) \end{aligned}$$
(61)

with \(\tilde{{\varvec{B}}}_u=\int _{v} {\varvec{B}}_u{\rm{dv}}\), \(\tilde{{\varvec{B}}}_\phi =\int _{v} {\varvec{B}}_\phi {\rm{dv}}\). Introducing (21) in the second term on the right side of (60) yields

$$\begin{aligned}{} & {} \frac{{\varvec{I}}_2^i}{V}\sum _{e}\int _{v} \left( {\varvec{e}}^{eT} {\varvec{B}}_{u} \frac{\partial {\varvec{u}}^e(\varvec{\varepsilon }_{ \mathrm M}^{j}) }{\partial \rho _{k}} - \varvec{\kappa }^{e} {\varvec{B}}_{\phi } \frac{\partial \varvec{\phi }^e(\varvec{\varepsilon }_{ \mathrm M}^{j})}{\partial \rho _{k}} \right) {\rm{dv}}=\nonumber \\{} & {} \quad \frac{{\varvec{I}}_2^i}{V} (\sum _{e}\int _{v} \left( {\varvec{e}}^{eT} {\varvec{B}}_{u} {\varvec{G}}_{eu} - \varvec{\kappa }^{e} {\varvec{B}}_{\phi } {\varvec{G}}_{e\phi }\right) {\rm{dv}} ) \frac{\partial {\varvec{U}}(\varvec{\varepsilon }_{\textrm{M}}^{j})}{\partial \rho _k}\nonumber \\{} & {} \quad = -\frac{{\varvec{I}}_2^i}{V} {\varvec{s}} {\varvec{K}}^{-1}{\varvec{M}}^k(\varvec{\varepsilon }_{\textrm{M}}^{j}) = -\frac{{\varvec{I}}_2^i}{V} {\varvec{t}}^T {\varvec{M}}^k(\varvec{\varepsilon }_{\textrm{M}}^{j}) \end{aligned}$$
(62)

where

$$\begin{aligned} {\varvec{s}} = \sum _{e}\int _{v} ( {\varvec{e}}^{eT} {\varvec{B}}_{u} {\varvec{G}}_{eu} - \varvec{\kappa }^{e} {\varvec{B}}_{\phi } {\varvec{G}}_{e\phi }) {\rm{dv}}, \; {\varvec{t}} = {\varvec{K}}^{-1} {\varvec{s}}^T \end{aligned}$$
(63)

The matrix \({\varvec{K}}\) in (62) can be rewritten as

$$\begin{aligned} {\varvec{K}}={\varvec{K}}_b+{\varvec{K}}_{p}=\sum _{e}{\varvec{G}}_e^T{\varvec{K}}_b^e{\varvec{G}}_e+{\varvec{K}}_{pu}+{\varvec{K}}_{p\phi } \end{aligned}$$
(64)

Hence, the sensitivity of the homogenized piezoelectric tensor is computed as

$$\begin{aligned}{} & {} \frac{\partial (e_{ij}^{H})^T}{\partial \rho _{k}} =\frac{{\varvec{I}}_2^i}{V} p\rho _k^{p-1}(f_{0}-f_{min}) ({\varvec{e}}_0^{T}\tilde{{\varvec{B}}}_u {\varvec{u}}^k(\varvec{\varepsilon }_{ \mathrm M}^{j})\nonumber \\{} & {} \quad -\varvec{\kappa }_0\tilde{{\varvec{B}}}_\phi \varvec{\phi }^k(\varvec{\varepsilon }_{ \mathrm M}^{j}))-\frac{{\varvec{I}}_2^i}{V} {\varvec{t}}^T {\varvec{M}}^k(\varvec{\varepsilon }_{\textrm{M}}^{j}) \end{aligned}$$
(65)

4 Implementation

The base cell is discretized into \(nelx \times nely\) rectangular elements in 2D, and the mesh grids of \(3 \times 3\) elements are given in Fig. 4 and Fig. 5 to illustrate the design for the 2D material stiffness and piezoelectric cases. The degrees of freedom of one corner are fixed. The stopping criterion is the change in terms of design variables between two consecutive designs becomes less than 0.01. Optimality criteria (OC) method (Andreassen et al. 2011) is used to solve the optimization problem for the 2D and 3D cases, while the method of moving asymptotes (MMA) (Svanberg 1987) is adopted for the optimization of piezoelectric material. To ensure the existence of solutions to the topology optimization problem and to avoid the formation of checkerboard patterns, the density filter (Andreassen et al. 2011) is applied. The proposed method is implemented in Matlab.

Fig. 4
figure 4

A base cell discretized into \(3 \times 3\) elements (2D)

Fig. 5
figure 5

A base cell discretized into \(3 \times 3\) elements (piezocomposites)

The procedures of the topology optimization for the homogenized stiffness tensor and piezoelectric materials are given in Table 2. The penalty coupling matrix, external force vector, and the integration of shape function gradient are all independent of the element density variable and can be calculated in advance. The transformation matrices are included in the matrices \({\varvec{K}}_b\), \({\varvec{M}}_s\), \({\varvec{J}}\) , and \({\varvec{s}}\), which can be computed using the sparse matrices. Their rows and columns are prepared ahead, and the values are updated in the optimization loop.

The processes barely change when extending the proposed method to the design of the piezoelectric materials, as no other treatments are applied except perturbation analysis and the penalty methods. For the first-order multi-field coupling and even second-order homogenization problems, the corresponding modifications are straightforward. On the other hand, the extension to the above cases requires complex derivations for the asymptotic expansion method and adjoint method, especially the adjoint method is not intuitive to conduct.

Table 2 The optimization procedures

5 Numerical examples

This section presents three examples of designs of microstructured materials with the proposed method, namely materials with negative Poisson’s ratio (2D), maximum bulk modulus (3D), and maximum hydrostatic coupling coefficient (piezocomposite). There are educational MATLAB codes targeting topology optimization of microstructures to achieve extreme material properties with the energy-based method in 2D (Xia and Breitkopf 2015) and 3D (Gao et al. 2019), so that the results of the proposed method and the energy-based method in the 2D and 3D examples (Xia and Breitkopf 2015; Gao et al. 2019, 2018) in terms of homogenization, sensitivity analysis, and optimal design are compared and discussed. Thereafter, the extensions of the method to piezocomposite are explored.

5.1 2D microstructured materials with negative Poisson’s ratio

The base cell is discretized into \(100 \times 100\) elements. The volume constraint \(\vartheta\) is set to 0.5, \(p=3\), the filter radius \(r_{\mathrm{{min}}}=4\) , and the penalty parameter is \(\alpha =1000\), where the optimization parameter setups are the same as in the literature (Xia and Breitkopf 2015) to compare with the results of the energy-based method. The unit Young’s modulus and the Poisson’s ratio \(\upsilon =0.3\) are used for computing the solid material stiffness tensor \(\varvec{C}_0\). To construct negative Poisson’s ratio materials, the objection function is set as (Xia and Breitkopf 2015):

$$\begin{aligned} c=C_{12}-0.8^{loop}(C_{11}+C_{22}) \end{aligned}$$
(66)

The initial design is shown in Fig. 6, which also includes the homogenized stiffness tensor calculated by the perturbation analysis according to Eq. (11), the differences with the results of the energy-based homogenization approach, and their \(\mathrm L_2\)-norm. The displacement solutions corresponding to three test strains with penalty methods and the difference with the direct solution are given in Fig. 7. The relative differences of the homogenized stiffness tensor and displacements are all within \(10^{-5}\), indicating the accuracy of the proposed perturbation analysis and penalty methods, respectively.

Fig. 6
figure 6

The initial design and the homogenized stiffness tensor \({\varvec{C}^H}\) and difference \(\varvec{e}_{C^H}\) with the energy-based method

Fig. 7
figure 7

The unit strain test solutions with penalty methods and the difference \(e_{u}\) with the direct solution

Based on the proposed method, the sensitivity for the initial design is shown in Fig. 8b. It is compared with the sensitivity from the energy-based method, and the relative difference is also within \(10^{-5}\). The optimal designs of the two methods are very similar, differing only locally, and the difference in homogenized stiffness tensor is also small, as illustrated in Fig. 9. In addition, the method also allows designing materials with negative Poisson’s ratio without introducing additional symmetry or isotropy constraints as in the energy-based method (Xia and Breitkopf  2015).

Fig. 8
figure 8

Sensitivity for the initial design: a Initial design, b Sensitivity with the proposed method, c Sensitivity difference with the energy-based method

Fig. 9
figure 9

Optimal designs: a Optimal design with the proposed method, b Optimal design with the energy-based method, c Optimal design difference of the two methods, d Material properties based on the proposed method and difference between the two designs

The above comparison shows that the perturbation analysis, penalty methods, and sensitivity analysis in the proposed method are very accurate, especially the sensitivity analysis is consistent without shortcuts (Wang et al. 2021). It should be noted that the Poisson’s ratio of the optimized design is \(-\)0.52 based on parameter setups consistent with the literature. Theoretically, Poisson’s ratio of the optimal microstructure can approach the limiting value of −1 by adjusting the initial design, optimization algorithm, and parameter setups. However, the core of the proposed method lies in homogenization and sensitivity analysis, so we do not focus on parameter study in the numerical examples.

5.2 3D microstructured materials with maximum bulk modulus

The maximum of the material bulk modulus corresponds to the minimization of the following objective function:

$$\begin{aligned}{} & {} c=-(C_{11}+C_{12}+C_{13}+C_{21}\nonumber \\{} & {} \quad +C_{22}+C_{23}+C_{31}+C_{32}+C_{33}) \end{aligned}$$
(67)

The base cell is discretized into \(50 \times 50 \times 50\) elements, \(\vartheta =0.5\), \(p=5\), \(r_{\mathrm{{min}}}=2\) , and \(\alpha =1000\) are the solution parameters. Young’s modulus and Poisson’s ratio of the solid material are also selected as \(E=1\) and \(\upsilon =0.3\). The initial design is a cube with a matrix density of \(\vartheta\) and a spherical inclusion of density \(\vartheta /2\), as shown in Fig. 10a. For the initial design, the homogenized stiffness tensor and the comparison with the energy-based method (Gao et al. 2019, 2018) are given in Fig. 10b, and the sensitivity \({\partial c}/{\partial \rho _e}\) and its difference are illustrated in slices, as shown in Fig. 10c, d, respectively. All the relative differences are within \(10^{-5}\).

The optimal design without symmetry constraints is shown in Fig. 11, which is similar to the results in the literature (Chen et al. 2020; Sivapuram et al. 2018). Compared with the sensitivity analysis of the energy-based method, the vector l (26) needs to be solved in addition to the displacement u. The computation cost for different discretizations can be found in Fig. 12. The logarithm of the computation time is proportional to the mesh density, most of which is spent on solving for u and l. The disadvantage of the proposed method is that the computation cost is about twice the energy-based method for the presented 3D problem.

Fig. 10
figure 10

Comparisons: a Initial design (1/8 model), b Homogenized stiffness tensor, c Sensitivity \({\partial c}/{\partial \rho _e}\), d Sensitivity difference of the two methods

Fig. 11
figure 11

Optimal design: a The whole model, b Half-model, c Homogenized stiffness tensor

Fig. 12
figure 12

The logarithm of the computation time of different mesh grids

5.3 2D microstructured materials with maximum hydrostatic coupling coefficient

The hydrostatic coupling coefficient (\(d_h\)) is an important performance characteristic for the design of low-frequency 1–3 piezocomposites such as hydrophones (Silva et al. 1999). For the 2D plane strain microstructures in the 1–3 plane, the hydrostatic coupling coefficient can be written as (Silva et al. 1997):

$$\begin{aligned} d_h={\varvec{v}}{\varvec{C}}^{-1}{\varvec{e}} \end{aligned}$$
(68)

where

$$\begin{aligned} {\varvec{C}}=\begin{pmatrix} C_{11} &{}C_{13} \\ C_{13} &{} C_{33} \end{pmatrix}, \; {\varvec{e}}=\begin{pmatrix} e_{11} \\ e_{33} \end{pmatrix}, \; {\varvec{v}}=\begin{pmatrix} 1&1 \end{pmatrix} \end{aligned}$$
(69)

The base cell is discretized into \(100 \times 100\) elements; we choose the following parameters: \(\vartheta =0.5\), \(p=3\), \(r_{\mathrm{{min}}}=3\), \(\alpha =10^5\) , and \(\beta =10^5\). The initial guess of the material topology layout is a circle with the density of 0.001 in the base cell. The material matrices in (58) are given as follows, and the material properties are listed in Table 3.

$$\begin{aligned}{} & {} {\varvec{C}}_0=\begin{bmatrix} \lambda +2G &{} \lambda &{} 0\\ \lambda &{} \lambda +2G &{} 0 \\ 0 &{} 0 &{} G \end{bmatrix}, \nonumber \\{} & {} \quad {\varvec{e}}_0^T =\begin{bmatrix} 0 &{} 0 &{} e_{15}\\ e_{31} &{} e_{33} &{}0 \end{bmatrix}, \nonumber \\{} & {} \quad \varvec{\kappa }_0 =\begin{bmatrix} \kappa _{11}&{} 0\\ 0 &{} \kappa _{33} \end{bmatrix} \end{aligned}$$
(70)
Table 3 Material properties (\([\lambda , G]={\textrm{GPa}}\), \([{\varvec{e}}]=\mathrm {C/m^2}\), \([\varvec{\kappa }]=\mathrm {nC/Vm}\))

Without imposing symmetry constraints, the optimal design, the homogenized material tensor, and the hydrostatic coupling coefficient \(d_h\) are given in Fig. 13a, where the microstructure is a rotating structure. Due to the asymmetry of the material model or the objective function, the density consistency (\(\rho _{\varGamma +}=\rho _{\varGamma -}\)) of the optimized microstructure on the boundary cannot be guaranteed, so additional symmetry constraints are sometimes required. When symmetry constraints are applied, the corresponding results are shown in Fig. 13b, where \(d_h\) is much smaller. The optimal structure is axis-symmetric, and it contains two gray vertical bands due to the existence of gray elements, which can be avoided by the level-set method and needs further study.

Fig. 13
figure 13

The optimal design, homogenized material tensors (\([{\varvec{C}}]={\textrm{GPa}}\), \([{\varvec{e}}]=\mathrm {C/m^2}\), \([\varvec{\kappa }]=\mathrm {nC/Vm}\)), and objective function value: a Without symmetry constraints, b With symmetry constraints

6 Conclusions

This work proposes a new methodology to design material microstructures with perturbation analysis and the penalty methods. For 3D problems, it is more convenient to impose periodic boundary conditions with the penalty methods. Most importantly, this method can be easily and directly extended to multi-field coupling material design issues of first-order and even second-order homogenization. The numerical examples demonstrate the accuracy of the proposed method, where the relative differences of the homogenized effective parameters and sensitivity with the energy-based approach are within \(10^{-5}\). Due to the use of perturbation analysis in homogenization, the sensitivity analysis of unknown freedoms to the design variables requires solving additional equations, increasing the solution time by twice. In addition, this methodology is based on the SIMP method, so there are some shortcomings such as gray elements, and further research is needed to combine the proposed method with the level-set method.