Vector Maxwell Topology Optimization
Overview
A photonic band gap is a frequency window in which electromagnetic waves cannot propagate — the optical analogue of the phononic band gap. Topology optimization widens it by distributing a high-index dielectric ε_hi = n² inside a low-index background ε_lo, on the Nédélec edge-element space so the curl–curl operator stays divergence-free. Rasmah’s MaxwellBandGapTopOpt maximizes the gap between consecutive PEC-cavity resonances via MMA, with the refractive index supplied by the material.
using RasmahOptimize the band gap of a PEC cavity
Distribute a dielectric of index n = 3 in a unit cube to open the largest possible gap between the first and second resonances.
m = tetrahedralize_box(1.0, 1.0, 1.0, 3, 3, 3)
mat = Material(youngs_modulus = 1e9, poisson_ratio = 0.3, refractive_index = 3.0)
x, history = solve(MaxwellBandGapTopOpt(), m, mat; volfrac = 0.5, n = 1, max_iter = 30)
println("density range = [", round(minimum(x); digits = 3), ", ", round(maximum(x); digits = 3), "]")
println("band gap objective: ", round(history[1]; digits = 4), " → ", round(history[end]; digits = 4))density range = [0.001, 0.918]
band gap objective: -0.0415 → -0.0002
Verification — the gap widens
The optimization must widen the band gap (raise the objective) from its initial value, while the density field stays in [0,1]:
println("objective improves: ", history[end] > history[1])
println("density in [0,1]: ", all(0 .<= x .<= 1))objective improves: true
density in [0,1]: true
vtk(m; field = x, fieldname = "dielectric density ρ", edges = true)Next steps
- Electromagnetic wave eigenmodes — the resonances being optimized.
- Phononic band gap — the elastic-wave analogue.
