Benjamin Vial Department of Mathematics, Imperial College London b.vial@imperial.ac.uk
What is topology optimization?
A mathematical method that optimizes material layout within a given design space, for a given set of sources, boundary conditions and constraints with the goal of maximizing the performance of the system
Hello World!
: Maximizing a beam
stiffness with fixed volume fraction
Jeremy Bleyer, Numerical Tours of Computational Mechanics with FEniCS, Manual (Zenodo, 2018), doi:10.5281/zenodo.1287832.↩︎
Niels Aage et al., “Giga-Voxel Computational Morphogenesis for Structural Design,” Nature 550, no. 7674 (October 2017): 84–86, doi:10.1038/nature23911.↩︎
Sean Molesky et al., “Inverse Design in Nanophotonics,” Nature Photonics 12, no. 11 (November 2018): 659–670, doi:10.1038/s41566-018-0246-9.↩︎
Material distribution in design domain \(\Omega_{\rm des}\): density function \(p \in [0,1]\)
B. S. Lazarov and O. Sigmund, “Filters in Topology Optimization Based on Helmholtz-type Differential Equations,” International Journal for Numerical Methods in Engineering 86, no. 6 (2011): 765–781, doi:10.1002/nme.3072.↩︎
\[\densp(\densf) = \frac{\tanh\left[\beta\nu\right] + \tanh\left[\beta(\densf-\nu)\right] }{\tanh\left[\beta\nu\right] + \tanh\left[\beta(1-\nu)\right]}\] with \(\nu=1/2\) and \(\beta>0\) increased during the course of the optimization.5
Fengwen Wang, Boyan Stefanov Lazarov, and Ole Sigmund, “On Projection Methods, Convergence and Robust Formulations in Topology Optimization,” Struct Multidisc Optim 43, no. 6 (December 2010): 767–784, doi:10.1007/s00158-010-0602-y.↩︎
\(\varepsilon(\densp)=(\varepsilon_{\rm max}-\varepsilon_{\rm min})\,\densp^m + \varepsilon_{\rm min}\)6
M. P. Bendsøe and O. Sigmund, “Material Interpolation Schemes in Topology Optimization,” Arch. Appl. Mech. Ing. Arch. 69, no. 9–10 (November 1999): 635–654, doi:10.1007/s004190050248.↩︎
nlopt
package8Krister Svanberg, “A Class of Globally Convergent Optimization Methods Based on Conservative Convex Separable Approximations,” SIAM Journal on Optimization, n.d., 555–573.↩︎
Steven G. Johnson, “The NLopt Nonlinear-Optimization Package,” n.d., doi:http://github.com/stevengj/nlopt.↩︎
Solution vector \(\B u\) we want to compute is parametrized by a vector of parameters \(\B p\) of size \(M\) and defined implicitly through an operator \(\B F\) as: \[\begin{equation} \B F(\B u, \B p) = \B 0 \label{eq:genimpeq} \end{equation}\]
\(\B G\) is a functional of interest of dimension \(N\), representing the quantity to be optimized
\[\begin{equation} \frac{\mathrm{d}\B G}{\mathrm{d}p_i} \approx \frac{\B G(\B p + h \B e_i) - \B G(\B p)}{h} \end{equation}\] where \(\B e_i\) is the vector with \(0\) in all entries except for \(1\) in the \(i^{th}\) entry.
Explicitly, the gradient can be computed applying the chain rule: \[\begin{equation} \frac{\mathrm{d}\B G}{\mathrm{d}\B p} = \frac{\partial \B G}{\partial \B p} + \frac{\partial \B G}{\partial \B u} \frac{\mathrm{d}\B u}{\mathrm{d}\B p}. \label{eq:gradG} \end{equation}\] Taking the total derivative of Eq. (\(\ref{eq:genimpeq}\)) we obtain the tangent linear equation: \[\begin{equation} {\frac{\partial \B F(\B u, \B p)}{\partial \B u}} {\frac{\mathrm{d}\B u}{\mathrm{d}\B p}} = {-\frac{\partial \B F(\B u, \B p)}{\partial \B p}}. \end{equation}\]
Assuming the tangent linear system is invertible, we can rewrite the Jacobian as: \[\begin{equation} \frac{\mathrm{d}\B u}{\mathrm{d}\B p} = - \left(\frac{\partial \B F(\B u, \B p)}{\partial \B u}\right)^{-1} \frac{\partial \B F(\B u, \B p)}{\partial \B p}. \end{equation}\] After substituting this value in (\(\ref{eq:gradG}\)) and taking the adjoint (Hermitian transpose, denoted by \(\dagger\)) we get: \[\begin{equation} \frac{\mathrm{d}\B G}{\mathrm{d}\B p}^{\dagger} = \frac{\partial \B G}{\partial \B p}^{\dagger} - \frac{\partial \B F(\B u, \B p)}{\partial \B p}^{\dagger} \left(\frac{\partial \B F(\B u, \B p)}{\partial \B u}\right)^{-\dagger} \frac{\partial \B G}{\partial \B u}^{\dagger} . \end{equation}\]
Defining the adjoint variable \(\B \lambda\) as: \[\begin{equation} \B \lambda = \left(\frac{\partial \B F(\B u, \B p)}{\partial \B u}\right)^{-\dagger} \frac{\partial \B G}{\partial \B u}^{\dagger} \end{equation}\] we obtain the adjoint equation \[\begin{equation} \left(\frac{\partial \B F(\B u, \B p)}{\partial \B u}\right)^{\dagger} \B \lambda = \frac{\partial \B G}{\partial \B u}^{\dagger}. \end{equation}\]
Andreas Griewank and Andrea Walther, Evaluating Derivatives, Other Titles in Applied Mathematics (Society for Industrial and Applied Mathematics, 2008), doi:10.1137/1.9780898717761.↩︎
\(f: \mathbb{R}^n \rightarrow \mathbb{R}^m\)
Example: \(f(x_1,x_2) = x_1x_2 + \sin(x_1)\)
Forward mode
Reverse mode
Time-harmonic regime with a convention in \(\exp(-i \omega t)\):
\[\begin{equation} \curl {\B H} =-i \omega \varepsilon_{0} \tens{\e} {\B E} \label{eq:maxwell1} \end{equation}\] \[\begin{equation} \curl {\B E} =i \omega \mu_{0} \tens{\mu}{\B H} \label{eq:maxwell2} \end{equation}\]
Benjamin Vial and Yang Hao, “Topology Optimized All-Dielectric Cloak: Design, Performances and Modal Picture of the Invisibility Effect,” Optics Express 23, no. 18 (August 2015): 23551, doi:10.1364/oe.23.023551.↩︎
Objective: minimize scattered field in the background \[\begin{equation*} \min_{p(\B r)} \quad \phi=\gamma\phi_1 + (1-\gamma) \phi_2 \end{equation*}\] \[\begin{equation*} \phi_1=\frac{1}{W}\int_{\Omega_{\rm B}}\left|E_{\rm d}^{\rm cloak}\right|^2 {\rm d} \B r\end{equation*}\] \[\begin{equation*} \phi_2=\int_{\Omega_{\rm D}}\frac{h_{\rm m}^2}{S}\left| \B \nabla\,\varepsilon \right|^2 {\rm d} \B r\end{equation*}\]
Correlation coefficient: \[\begin{equation*} \rho(X,Y)=\frac{ {\rm E}(XY) - {\rm E}(X){\rm E}(Y) }{ \sqrt{{\rm E}(X^2)-{\rm E}(X)^2} \sqrt{{\rm E}(Y^2)-{\rm E}(Y)^2} } \end{equation*}\]
Objective: make a metallic cylinder look like an arbitrarily shaped dielectric \[\begin{equation*} \min_{p(\B r)} \quad \phi=\gamma\phi_1 + (1-\gamma) \phi_2 \end{equation*}\] \[\begin{equation*} \phi_1=\frac{1}{W}\int_{\Omega_{\rm B}}\left|E^{\rm ill} - E^{\rm ref}\right|^2 {\rm d} \B r\end{equation*}\] \[\begin{equation*} \phi_2=\int_{\Omega_{\rm D}}\frac{h_{\rm m}^2}{S}\left| \B \nabla\,\varepsilon \right|^2 {\rm d} \B r\end{equation*}\]
Benjamin Vial, Max Munoz Torrico, and Yang Hao, “Optimized Microwave Illusion Device,” Scientific Reports 7, no. 1 (June 2017): 3929, doi:10.1038/s41598-017-04410-4.↩︎
Open source libraries with bindings for the python
programming language using a custom code gyptis
.
gmsh
fenics
using second order Lagrange basis
functionsdolfin-adjoint
library with
automatic differentiationBenjamin Vial, “Gyptis” (Zenodo, June 2022), doi:10.5281/zenodo.6636134.↩︎
Christophe Geuzaine and Jean-François Remacle, “Gmsh: A 3-D Finite Element Mesh Generator with Built-in Pre- and Post-Processing Facilities,” Int J Numer Meth Engng 79, no. 11 (September 2009): 1309–1331, doi:10.1002/nme.2579.↩︎
Martin Alnæs et al., “The FEniCS Project Version 1.5,” Archive of Numerical Software 3, no. 100 (December 2015), doi:10.11588/ans.2015.100.20553.↩︎
Sebastian K. Mitusch, Simon W. Funke, and Jørgen S. Dokken, “Dolfin-Adjoint 2018.1: Automated Adjoints for FEniCS and Firedrake,” Journal of Open Source Software 4, no. 38 (June 2019): 1292, doi:10.21105/joss.01292.↩︎
Objective: focal point at two different locations depending on the excitation frequency \[\begin{equation*} \max_{p(\B r)} \quad \Phi = \left|E_1(\omega_1,\B r_1)\right| + \left|E_2(\omega_2,\B r_2)\right| \end{equation*}\]
Benjamin Vial et al., “Optimization and Experimental Validation of a Bi-Focal Lens in the Microwave Domain,” AIP Advances 12, no. 2 (February 2022): 025103, doi:10.1063/5.0074062.↩︎
Benjamin Vial and Yang Hao, “Enhanced Tunability in Ferroelectric Composites Through Local Field Enhancement and the Effect of Disorder,” Journal of Applied Physics 126, no. 4 (July 2019): 044102, doi:10.1063/1.5101053.↩︎
\[\begin{equation*} \ef(E) = \frac{ \ef(0)}{ \left[(\xi +1)^{1/2} +\xi \right]^{2/3} +\left[(\xi +1)^{1/2} - \xi \right]^{2/3} -1} \label{eq:nl_eps}\end{equation*}\] with \(\xi=E/E_{\rm N}\), \(\ef(0)=3050\) and \(E_{\rm N}=1.65\,\)kV/mm at DC, \(\ef(0)=165\) and \(E_{\rm N}=1.12\,\)kV/mm at \(f=3.8\,\)GHz.
Orest G. Vendik, Leon T. Ter-Martirosyan, and Svetlana P. Zubko, “Microwave Losses in Incipient Ferroelectrics as Functions of the Temperature and the Biasing Field,” Journal of Applied Physics 84, no. 2 (June 1998): 993–998, doi:10.1063/1.368166.↩︎
Solve for the potential \(V\) satisfying law for a given permittivity distribution \(\e\): \[\begin{equation} \ddiv (\e(\B E) \grad V) = 0 \label{eq:elstat}\end{equation}\] biased by a constant uniform electric field \(\B E_{\rm B} =\Eb \B x\). The electric field \(\B E=-\grad V\) derived from the solution depends on the permittivity distribution, which itself depends on the electric field.
Two scale expansion \(\Hm(\B r)=\Hm_0(\B r,\B r/\nu) + \nu \Hm_1(\B r,\B r/\nu) + \nu^2 \Hm_2(\B r,\B r/\nu) + ...\) for magnetic field \(\Hm\)
Two annex problems \(\mathcal P_j\), \(j={x, y}\) on the unit cell : \[\begin{equation} \ddiv \left[ \e(\B E) \grad(\psi_j + r_j) \right] = 0, \label{eq:hom_annex}\end{equation}\] The homogenized permittivity \(\ehom\) is then obtained as: \[\begin{equation} \ehom(\B E) = \langle \e(\B E)\rangle \B I + \B \phi(\B E), \label{eq:hom_epsi}\end{equation}\] where \(\mn{.}\) denotes the mean value over the unit cell, \(\B I\) is the \(2\times 2\) identity matrix and \(\B \phi_{ij}(\B E) = \langle \e(\B E) \grad \psi_i(\B E) \rangle_j\) are correction terms.
Grégoire Allaire, “Homogenization and Two-Scale Convergence,” SIAM Journal on Mathematical Analysis 23, no. 6 (November 1992): 1482–1518, doi:10.1137/0523084.↩︎
Objective: maximize the tunability of the composites along the direction of the applied electric field defined as \(\tunh(E)=\exxh(0)/\exxh(E)\) \[\begin{equation} \begin{aligned} \max_{p(\B r)} \quad & \sigma(E) = \frac{\tunh(E)}{\eta(E)}-1\\ \textrm{s.t.} \quad & f_{\rm min} < f < f_{\rm max}\\ \end{aligned} \label{eq:max_tuna} \end{equation}\] where \(\sigma\) is the tunability enhancement compared to the bulk BST tunability \(\eta(E)=\ef(0)/\ef(E)\).
Benjamin Vial and Yang Hao, “High Frequency Meta-Ferroelectrics by Inverse Design,” Optical Materials Express 11, no. 5 (April 2021): 1457, doi:10.1364/ome.424011.↩︎
Loss reduction factor: \[\begin{equation} \theta(E) = 1- \frac{\tdhxx(E)}{\tdf(E)} \label{eq:loss_red_factor} \end{equation}\] where the homogenized loss tangent \(xx\) component is \(\tdhxx(E) = -\im \exxh(E) / \re\exxh(E)\).
Objective: high tunability and low loss \[\begin{equation} \begin{aligned} \min_{p(\B r)} \quad & \gamma\,\sigma(E) + (1-\gamma)\,\theta(E)\\ \textrm{s.t.} \quad & f_{\rm min} < f < f_{\rm max}\ \end{aligned} \label{eq:biobj} \end{equation}\]
Objective: maximize the normalized scattering width: \[\begin{equation} \max_{p(\B r)} \quad \Phi = \sigma_s/2R \end{equation}\]
TE
TM
D. M. Whittaker and I. S. Culshaw, “Scattering-Matrix Treatment of Patterned Multilayer Photonic Structures,” Physical Review B 60, no. 4 (July 1999): 2610–2618, doi:10.1103/PhysRevB.60.2610.↩︎
Victor Liu and Shanhui Fan, “S4 : A Free Electromagnetic Solver for Layered Periodic Structures,” Computer Physics Communications 183, no. 10 (October 2012): 2233–2244, doi:10.1016/j.cpc.2012.04.026.↩︎
Fourier coefficients \(d_{x}\) and \(d_{y}\) of the displacement field \(\B{D}\) related to the electric field by: \[\begin{equation} \left[\begin{array}{c}-d_{y}(z) \\ d_{x}(z)\end{array}\right]=\mathcal{E}\left[\begin{array}{c}-e_{y}(z) \\ e_{x}(z)\end{array}\right] \label{eq:DE} \end{equation}\]
M. G. Moharam and T. K. Gaylord, “Rigorous Coupled-Wave Analysis of Planar-Grating Diffraction,” JOSA 71, no. 7 (July 1981): 811–818, doi:10.1364/JOSA.71.000811.↩︎
Lifeng Li, “New Formulation of the Fourier Modal Method for Crossed Surface-Relief Gratings,” JOSA A 14, no. 10 (October 1997): 2758–2767, doi:10.1364/JOSAA.14.002758.↩︎
Thomas Schuster et al., “Normal Vector Method for Convergence Improvement Using the RCWA for Crossed Gratings,” JOSA A 24, no. 9 (September 2007): 2880–2890, doi:10.1364/JOSAA.24.002880.↩︎
Whittaker and Culshaw, “Scattering-Matrix Treatment of Patterned Multilayer Photonic Structures.”↩︎
FMM and PWEM in python
with various numerical backends
for core linear algebra operations and array manipulation
Charles R. Harris et al., “Array Programming with NumPy,” Nature 585, no. 7825 (September 2020): 357–362, doi:10.1038/s41586-020-2649-2.↩︎
Pauli Virtanen et al., “SciPy 1.0: Fundamental Algorithms for Scientific Computing in Python,” Nature Methods 17 (2020): 261–272, doi:10.1038/s41592-019-0686-2.↩︎
Dougal Maclaurin, David Duvenaud, and Ryan P Adams, “Autograd: Effortless Gradients in Numpy,” in ICML 2015 AutoML Workshop, vol. 238, 2015, 5.↩︎
Adam Paszke et al., “PyTorch: An Imperative Style, High-Performance Deep Learning Library,” in Advances in Neural Information Processing Systems 32, ed. H. Wallach et al. (Curran Associates, Inc., 2019), 8024–8035; Adam Paszke et al., “Automatic Differentiation in PyTorch,” in NIPS-W, 2017.↩︎
James Bradbury et al., “JAX: Composable Transformations of Python+NumPy Programs,” 2018.↩︎
Objective: maximize the average of the transmission coefficient in the \((1,0)\) diffracted order for both polarizations: \[\begin{equation} \max_{p(\B r)} \quad \Phi = \frac{1}{2} \left( T^{\rm TE}_{(1,0)} + T^{\rm TM}_{(1,0)}\right) \end{equation}\]
Mahmoud I. Hussein, “Reduced Bloch Mode Expansion for Periodic Media Band Structure Calculations,” Proceedings of the Royal Society A: Mathematical, Physical and Engineering Sciences 465, no. 2109 (September 2009): 2825–2848, doi:10.1098/rspa.2008.0471.↩︎
Objective: open and maximize a bandgap between the \(5^{th}\) and \(6^{th}\) eigenvalues:\[\begin{equation*}\max_{p(\B r)} \quad \Phi = \min_{\B k} \omega_{6}(\B k) - \max_{\B k} \omega_{5}(\B k)\end{equation*}\]
Ole Sigmund and Kristian Hougaard, “Geometric Properties of Optimal Photonic Crystals,” Physical Review Letters 100, no. 15 (April 2008): 153904, doi:10.1103/PhysRevLett.100.153904.↩︎
Objective: obtain a prescribed dispersion curve for the \(6^{th}\) band \[\begin{equation*}\min_{p(\B r)} \quad \Phi = \left\langle\left|\omega_{6}(k_x) - \langle \omega_{6}\rangle - \omega_{\rm tar}(k_x) \right|^2\right\rangle \end{equation*}\] with \[\begin{align*}\omega_{\rm tar}(k_x) =& -0.02 \cos(k_x a) + 0.01 \cos(2 k_x a) \\ &+ 0.007 \cos(3 k_x a)\end{align*}\] \(\langle f\rangle =\frac{1}{M}\sum_{m=0}^M f_m\)
FEM
FMM
PWEM
Online example