Physics

Maxwell equation assembly and material properties.

Materials

DistributedEmitterOpt.refindexFunction
refindex(material::String) -> (n_interp, k_interp)

Load refractive index data for a material and return interpolation functions. The interpolants are callable with wavelength in nm.

Example

n_Ag, k_Ag = refindex("Ag")
n_532 = n_Ag(532.0)  # Real part at 532 nm
k_532 = k_Ag(532.0)  # Imaginary part
DistributedEmitterOpt.resolve_indexFunction
resolve_index(mat::MaterialSpec, λ::Float64) → ComplexF64

Get complex refractive index at wavelength λ (nm).

  • String: lookup from material database
  • Float64: use directly as real index
DistributedEmitterOpt.plasmon_periodFunction
plasmon_period(n_fluid, n_metal, λ) -> Float64

Estimate surface plasmon polariton wavelength: λ_spp = λ / Re(√(εm·εf / (εm + εf)))

Maxwell assembly

DistributedEmitterOpt.assemble_maxwellFunction
assemble_maxwell(pt, sim, phys) -> SparseMatrix

Assemble Maxwell curl-curl matrix with Sommerfeld ABC.

A = ∫ (∇×v)·(∇×u) dΩ - k²∫ ε(p)v·u dΩ + ik√ε ∫ v·u dS (ABC)

Maxwell solver

DistributedEmitterOpt.solve_forward!Function
solve_forward!(pde, pt, sim, pool) -> Dict{CacheKey, CellField}

Solve Maxwell for every unique field configuration. Caches LU factorizations in the pool.

DistributedEmitterOpt.solve_adjoint!Function
solve_adjoint!(pde, sources, sim, pool) -> Dict{CacheKey, CellField}

Solve adjoint Maxwell for each adjoint source. Reuses the LU factors already in the pool.

Solve A'x = b (adjoint system).

DistributedEmitterOpt.pde_sensitivityFunction
pde_sensitivity(pde, fields, adjoints, pf, pt, sim, control; space=sim.Pf)

Compute dg/dpf from the PDE term (lambda^T dA/dp E), summed over all field configs.