MATLAB and COMSOL codes for TopOpt-based inverse design in photonics.

200 line MATLAB-based TopOpt code configured for designing cylindrical metalenses in 2D. Five COMSOL-Multiphysics models, demonstrating the application of topology optimization in photonics.

A 200 line MATLAB code demonstrating the application of topology optimization to electromagnetic design problems. The code is intended for educational purposes for researchers and students alike, aimed at introducing newcomers to topology optimization as an inverse design tool within electromagnetics.

 

NOTE: An error associated with the use of the DENSITY_FILTER function was identified and corrected on 12.04.2021.

 

The code is found here: top200EM.m

Execute an example by running the following commands in the MATLAB prompt:

>> DomainElementsX = 400;

>> DomainElementsY = 200;

>> DesignThicknessElements = 15;

>> DDIdx = repmat([1:DomainElementsY:DomainElementsX*DomainElementsY],DesignThicknessElements,1);

>> DDIdx = DDIdx+repmat([165:165+DesignThicknessElements-1]',1,DomainElementsX);

>>

>> [DVs,obj]=top200EM([200,80],DDIdx,DomainElementsX,DomainElementsY,0.5,3.0,35,3.0,200);

 

A description of the physics model, design problem, top200EM.m code itself along with suggestions for code extensions can be found in the paper "A 200 Line MATLAB Code for Inverse Design in Photonics by Topology Optimization" (arXiv:2009.14276) by Rasmus E. Christiansen and Ole Sigmund. The original publication is available at https://doi.org/10.1364/JOSAB.405955.
 
A set of five COMSOL Multiphysics models providing an introduction to topology optimization as an inverse design tool in electromagnetics, that does not require extensive programming experience, extensive knowledge of the finite element method or of the theory behind mathematical optimization are found here: COMSOLModels.zip. A tutorial paper describing inverse design by topology optimization in photonics and the five model problems treated in the COMSOL models is found in "A Tutorial for Inverse Design in Photonics by Topology Optimization" (arXiv:2008.11816) by Rasmus E. Christiansen and Ole Sigmund. The original publication is available at https://doi.org/10.1364/JOSAB.406048.