41
Laboratory for Electromagnetic Fields and Microwave Electronics (IFH) Advances in MMP and OpenMaX Christian Hafner Laboratory for Electromagnetic Fields and Microwave Electronics ETH Zurich, Switzerland Lab: http://www.ifh.ee.ethz.ch COG: http://alphard.ethz.ch Software: http://openMaX.ethz.ch http://max-1.ethz.ch http://alphard.ethz.ch/Hafner/mmp/mmp.htm

Advances in MMP and OpenMaX - computational optics …alphard.ethz.ch/Hafner/Workshop/HafnerShortCourse201… ·  · 2011-06-09computers under MS-DOS with GEM for graphics, Fortran

  • Upload
    hadiep

  • View
    215

  • Download
    2

Embed Size (px)

Citation preview

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    Advances in MMP and OpenMaX

    Christian Hafner

    Laboratory for Electromagnetic Fields and Microwave Electronics

    ETH Zurich, Switzerland

    Lab: http://www.ifh.ee.ethz.ch

    COG: http://alphard.ethz.ch

    Software: http://openMaX.ethz.ch

    http://max-1.ethz.ch

    http://alphard.ethz.ch/Hafner/mmp/mmp.htm

    http://www.ifh.ee.ethz.ch/http://alphard.ethz.ch/http://openmax.ethz.ch/http://max-1.ethz.ch/http://alphard.ethz.ch/Hafner/mmp/mmp.htm

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    Overview MMP

    History, concept OpenMaX projects

    2D / 3D, E / H / hybrid, scattering / eigenvalue, symmetries Domains

    Material properties, data files, formula definition, Drude-Lorentz models Boundaries

    C-polygons and deformations, matching point generation, boundary conditions, fictitious boundaries, 3D model generation, GMSH binding

    ExpansionsOverwiew, beams, distributed multipoles, multilayer expansions

    Eigenvalue solverStrategies, double peak problem, error minimization techniques, almost degenerate modes, complex frequency search, periodic waveguides, radiating modes, capture and tracing

    PostprocessingField representations, animations, optical forces, integration

    Speed-up techniquesMBPE, PET, multiple right hand sides

    OptimizationReal parameters / binary, deterministic / stochastic

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    MMP - History1980: Multiple Multipole Program (MMP) proposed, first 2D implementations

    1990: Artech House publishes first 2D MMP book-software package for personal computers under MS-DOS with GEM for graphics, Fortran 77 / C / C++, various compilers, parallel processing on transputer boards.

    1993: John Wiley & Sons publishes first 3D MMP package, MS-Windows, mmptool (GUI) for UNIX , Fortran 77 / C / C++, various compilers, parallel processing on transputer boards.

    1999: John Wiley & Sons publishes MaX-1: Focus on GUI, advanced input/output, new 2D MMP implementation, Generalized FD solver, formula interpreter,, Windows 95, 98, ME, 2000, XP, , Visual Fortran 90 / C++

    2001: 3D MMP added, continuous improvement

    2009: OpenMaX based on MaX-1: 2D + 3D MMP, 2D + 3D FDTD, pure Fortran 90 with QuickWin graphics (Intel Visual Fortran)

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    MMP - Concept

    Approximate field in any domain by superposition of expansions which fulfill the Maxwell equations in that domain Only boundary conditions on domain boundaries need to be solved numerically Pure boundary discretization technique.

    Typical expansions: Plane waves, harmonic expansions, Rayleigh expansions, multipoles, Bessel expansions, complex origin expansions, multilayer expansions, superpositions of these expansions or solutions of sub-problems: connections.

    Dont insist on the orthogonality of the expansions! Accept ill-conditioned matrices!Error minimization technique, weighted residuals, solve overdetermined systems of equations directly (QR decomposition).

    MMP includes plane wave expansion techniques, method of fundamental solutions, fictitious sources, auxiliary sources, Mie, etc.

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    OpenMaX projectsTime dependence: static, harmonic (frequency domain), time domain (only FDTD)

    Dimension: 2D (cylindrical not only perpendicular incidence) or 3D

    Scattering / Eigenvalue (gamma, omega, CX, CY, CZ, nonlinear eigenvalue search)

    Wave type (E, H, hybrid for 2D)

    Symmetry planes (xy, xz, yz only)

    Periodic symmetries (X, X+Y, X+Y+Z not necessarily perpendicular vectors)

    Examples: Scattering (arbitrary excitations, multiple excitations) Antennas (sender / receiver) Waveguides (cylindrical or periodic, e.g., array of spheres in a dielectric rod) Cavity modes Gratings, Photonic crystals, Metamaterials Waveguide discontinuities, Couplers

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    DomainsMaterial properties (linear, homogeneous, isotropic)

    Complex epsilon, complex mueFortran notation, e.g., (2.4,1.34E-2)

    Import from filee.g., #EpsilonAg.wl2 (wavelength dependence of complex epsilon)

    Formula definition omega (v2) dependence, e.g., add(mul(c2,2.25),div(mul(c0,1.3e-4),v2)frequency (v1) dependencetime (v0) dependence (only for FDTD)

    Drude-Lorentz models: simplified formulae.g., dlf(v1,6.64,1.3569e16,6.248e13,1.8468,1.3569e16,0.159)

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    Boundaries C-polygons and deformations

    New: 2 parameter definitionsFormula style: /x-dir/y-dir/

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    Boundaries Matching point generation

    Uniform distribution of matching points Higher density near multipole expansion(select distance in MMP dialog) (overdetermination factor > 0)

    Strategy improved

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    Boundaries Boundary conditionsContinuity conditions for field components

    Usual: continuity of Et, Ez, Dn, Ht, Hz, Bnuseless conditions automatically deleted (e.g., PEC boundaries)

    Specific: select some from above + V, Az for staticsenforce strong continuity of special field componentswant to work without overdetermination (e.g., no Dn + Bn continuity)

    Periodic: X, Y, Z (Y and Z vectors not necessarily perpendicular)Et, Ez, Dn, Ht, Hz, Bn continuousboundary between domains with identical number and material propertiesusually straight line boundary, but curved is also possible

    Special: topological BC (for Ralf Vogelgesang)

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    Boundaries Fictitious boundaries For numerical integration (weight 0)

    For multipole generation (weight 0)

    Separation of domains with identical properties (D1/D2, D2/D3)

    Explicit periodic boundaries (D2/D2)

    Implicit periodic boundaries (at x=0) are not modeled!

    Example: MMP model of a periodic slab of circular wires, illuminated by a plane wave,Incident from top, Rayleigh expansions in D1, D3

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    Boundaries 3D model generation

    2D objects: C-polygons and multipoles 3D objects: surfaces (and distributed multipoles)

    3D transformations: Cylinder, Torus, Spiral, Cone3D primitive objects: Triangles, RectanglesAutomatic generation of 3D expansions and 3D matching points

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    Boundaries GMSH binding

    OpenMaX: Draw domain boundaries Export to GMSH

    GMSH: Create triangular mesh Save mesh (Solve FEM problem)

    OpenMaX: Import mesh data Find mesh points along boundaries Invert points at boundaries Create multipole expansions Perform checks Balance locations of expansions

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    Expansions - OverviewPlane waves multi-plane wave expansions (2D, 3D depends on project dimension)Harmonic expansions (superpositions of plane waves sin, cos instead of exp)Rayleigh expansions (plane waves + evanescent plane waves for periodic problems)

    2D multipoles and Bessel expansions may also be used in 3D projects, with arbitrary orientationreal or complex origins

    3D multipoles and Bessel expansions, real or complex origins

    3D distributed multipoles (along straight line, arc or ring, spiral, Fourier or Legendre)

    2D and 3D multilayer expansions (only monopole / dipole, but also complex origin)

    Generalized connections (multi parameter connections)

    Automatic generation of 2D multipole sets (new: GMSH based)Adaption and checks of 2D multipole setsGeneration of 3D multipole or 3D distributed multipole setsConversion of ring multipoles into complex origin multipoles

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    Expansions - Beams

    Gaussian beam Complex origin Bessel beamsApproximation of Maxwell eq. Analytic solution of Maxwell eq.

    Width tuned by imaginary part of locationHigher orders and degrees (3D) available

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    Expansions - Beams continued

    Complex origin multipole beam Ring multipole (no cut but numerical integration)(cut line in arbitrary direction)

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    Expansions Distributed multipoles

    Fourier basis along line Legendre basis along line

    Numerical integration required! Straight line, arc (ring), spiral implemented

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    Expansions Multilayer expansions Monopole (2D) or dipole (3D)

    expansions available On or in arbitrary multilayer

    structure (boundaries in xz plane) Dielectric or metallic materials Continuity conditions along flat

    multilayer boundaries automatically fulfilled no problems with discretization of infinite boundaries

    Complex origin versions available Numerical solution of Sommerfeld

    integrals (limited accuracy / long computation time)

    Implementation: Aytac Alparslan

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    Eigenvalue solvers Strategies I Loss-free materials real eigenvalues Dispersion-free materials linear eigenvalue search Lossy, dispersive materials complex, nonlinear eigenvalue search

    Resonators: complex resonance frequency Waveguides: complex propagation constant () or real ()? PhC waveguides: complex periodicity constant C() or C()? Band diagrams: k() or k()? Problem: how to measure ()?

    2 possible ways out:() = (Re()) complicated search space, high numerical cost!measurement for real , Drude Lorentz model fit: (), complex extension ()

    Numerical methods Analytical: Zeros of the determinant of a square matrix (numerically difficult

    when ill-conditioned) Minima of the weighted residual of a rectangular matrix (overdetermined),

    important: fixed amplitude of the mode (RX=E instead of SX=R*RX=0) Fictitious excitation + sensors (MAS/FDTD): Maxima of eigenvalue response Boundary methods: Minima of the absolute or relative error integral

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    Eigenvalue solvers Strategies IISquare matrices: S(e)X(e)=0, Det(S(e))=0: Condition problems may cause noise!Numerical improvement: S(e)T(e), Det(M)=Prod(tkk(e)) last element tnn(e)=0: Reduce numerical problems! Selection of last expansion important!

    Overdetermined systems: R(e)X(e)=E(e), E(e)2=min.! Avoid trivial solutions X=0!Procedure: Solve R(e)X(e)=E(e) using QR decomposition, set xn=1 (last expansion!)

    Improvement: Define Amplitude A(e) and normalize it.A(e) may be any field component in one point, averaged over N points, integrated Higher effort better reliability. Example: total power flux = 1.Possible search functions: E(e)2, E(e)2 / A(e), 1 / A(e), E(e)p / Aq(e),...

    Last expansion: May suppress modes because not all modes may be excited. Method of fictitious excitations (MAS, FDTD,).Selection of fictitious excitations similar to Amplitude definition: 1 point, N points

    Improvement: Minimize Error Integral along all boundaries instead of E(e)2.Various definitions of Error!

    Improvement: Symmetry decomposition! Reduce Matrix size (memory, computation time) and number of eigenvalues!

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    Eigenvalue solvers Double peak problem

    Example: 2D photonic crystal (circular rods on a square lattice)3 Search functions: residual, 1/amplitude (fict. excit.+sensor), residual/amplitude

    1. Residual has very narrow dip: difficult to find!2. Amplitude has double-peaks (1/amplitude has double minima): two pseudo-solutions!3. Residual/Amplitude may also have double minima More sophisticated search function (power of residual / amplitude instead of 3.) More sophisticated search strategy: Analyze all three functions, not only one Insert fictitious loss

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    Eigenvalue solvers Error minimizationSearch for minimum error on boundaries

    Implemented error functions:

    1. Relative error average2. Relative error maximum3. Abs. error average / field average4. Abs. error maximum / field average5. Abs. error average / field maximum6. Abs. error maximum / field maximum

    1.

    2. 3. 4.

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    Eigenvalue solvers Almost degenerate modes

    Mode 1

    Upper Au slab

    Mode 2

    Upper Au slab

    Very primitive example: Pair of Au slabs exhibits 4 almost degenerate SPP modes.

    Symmetry decomposition: Pairs of even and odd modes, still almost degenerate.

    Solutions (require experience, do not always solve the problem): Refine search (time consuming) Select better search function Select different last expansions Appropriate amplitude definition Apply model-based parameter estimation technique Eigenvalue tracing (start where modes are well separated)

    Average relative error Average absolute error /Average field

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    Eigenvalue solvers Complex frequency search

    Palik, measured Drude approximation Complex frequency

    Example: metallic photonic crystal (circular Ag rods on square lattice)Eigenvalue search:

    Measurement (Palik) only for real . Drude approximation not very accurate.But: complex may be inserted! No long valleys observed! Numerical search much easier! Zoom: flat band modes

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    Eigenvalue solvers Periodic waveguides

    ( ) (0) i zField z Field e =

    ( )0

    0 0

    ( ) ( ); 0

    zi C ndField z Field z ez z nd z d

    = = + < >r): n(m+r)(m+r)

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    Speed-up techniques Multiple right hand sides II

    S matrix computation:N input and N output ports(or incident and scattered waves)

    N right hand sides

    Example: Array of gold spheres in the XYPlane, i.e., metamaterial slab.The Rayleigh expansions in the upper and lower half space act as ports.S matrix technique may then be applied to compute stacks of such metamaterial slabs.

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    Optimization binary FSS optimization I

    First, the unit cell is divided to an NN grid, and coded in a binary string.

    metallic patchno patch

    For rough grids: brute-force simulations of all the possible cases optimal solution known performance of optimizers may be studied best optimizer used for more demanding problems

    The arrangement of the best cases shows the importance of choosing a proper optimization algorithm.

    The evaluation of the fitness function is done using a MoMcode.

    More details: Dissertation of Arya Fallahi

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    Optimization binary FSS optimization II

    N STAT MGA0 MGA1 MGA2 MUT0 MUT1 MUT2 RHC

    1 7.84 11.9 11.7 20.6 6.86 25.7 27.3 97.6

    2 7.55 13.1 14.4 22.0 6.99 26.9 27.3 85.5

    3 8.44 15.4 17.7 20.4 7.81 25.1 25.5 42.9

    4 7.74 17.2 20.1 18.9 7.42 23.6 23.6 26.7

    5 10.1 20.5 22.9 27.6 7.59 23.8 24.3 23.7

    6 9.57 19.8 23.6 30.3 7.96 23.5 24.5 23.5

    7 8.88 19.9 24.2 29.4 8.11 23.2 22.6 21.7

    8 8.77 17.3 23.6 28.0 8.11 21.3 19.8 20.0

    av 8.61 16.9 19.8 24.7 7.54 24.1 24.4 42.7

    Probabilities of finding the global optimum in percentaveraged over fitness definitions with 100, 200, 500, 1000 fitness evaluations

    eight optimizers

    Our most advanced Micro Genetic Algorithm MGA2 is much better than standard GA The mutation-based binary evolutionary strategy MUT2 has similar performance Binary Hill Climbing with Random Restart (RHC) outperformall optimizers for N

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    Optimization binary FSS optimization IIIPhC Power Divider 12 Bit OptimizationTest your intuition: Java applet by Jasmin Smajichttp://alphard.ethz.ch/MetaMaterials/PowerDivider/divider.htm

    T and Y structures not bad but far from optimum Deterministic path from T to second best solution exists Global optimum very hard to find

    Second best Best

    http://alphard.ethz.ch/MetaMaterials/PowerDivider/divider.htm

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    Optimization Sensitivity analysisSensitivity analysis: rod size and rod locations

    Optimize size and locations of three most important rods: 9 parameters Further improvement possible, but: fabrication tolerances problematic!

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    Optimization Parameter optimization

    Start with good initial guess: Perform sensitivity analysis Gradient-based methods with gradient approximation useful in simple cases Best solution may be further improved: bigger search spaceNo good initial guess: Try stochastic optimizers Simulated annealing and particle swarm optimization very disappointing Genetic Algorithms and Micro Genetic Algorithms disappointing Downhill simplex with random restart promising for simple cases Evolutionary strategies best in most cases

    Our experience with parameter optimizersGenetic Algorithm Downhill simplex r.r. Evolutionary strategy

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    Optimization OpenMaX I

    User Run OpenMaX in slave mode: x:\path\OpenMaXaax in-file inf Load or define project with parameters to be optimized Run Optimizer Analyze best solutions

    Optimizer Create in-file (contains model information for OpenMaX) Wait for out-file (contains fitness of the model solved by OpenMaX) Delete out-file

    OpenMaX Wait for in-file Solve model as soon as the in-file is present Delete in-file and create out-file

  • Laboratory for Electromagnetic Fields and Microwave Electronics (IFH)

    Optimization OpenMaX IITypical OpenMaX directives for model modifications

    Binary optimization:? BIT(v0,2) < 1 ? DELete COLor 22 (delete boundaries and expansiosn with color number 22if the bit number 2 of the variable v0 is < 1)

    Real parameter optimization:MOVe CORner 1 2 v0 neg(v1)(Move corner 2 of boundary 1 in the xy plane with the vector (v0,-v1))

    Note: The values of the variables v0,v1,v2,,v99 are created by the optimizer and written on the in-file.

    Alternative: The optimizer creates and writes a complete OpenMaXproject (more general but more demanding for the optimizer code)