Fourier Modal Method Solution to the Seminar Tasks

Similar documents
Addition of angular momentum

A Propagating Wave Packet Group Velocity Dispersion

The Matrix Exponential

The Matrix Exponential

Optics and Non-Linear Optics I Non-linear Optics Tutorial Sheet November 2007

Addition of angular momentum

Chapter 6: Polarization and Crystal Optics

Quasi-Classical States of the Simple Harmonic Oscillator

That is, we start with a general matrix: And end with a simpler matrix:

cycle that does not cross any edges (including its own), then it has at least

Einstein Equations for Tetrad Fields

2. Background Material

Coupled Pendulums. Two normal modes.

5.80 Small-Molecule Spectroscopy and Dynamics

surface of a dielectric-metal interface. It is commonly used today for discovering the ways in

PHYSICS 489/1489 LECTURE 7: QUANTUM ELECTRODYNAMICS

Homework #3. 1 x. dx. It therefore follows that a sum of the

4. Money cannot be neutral in the short-run the neutrality of money is exclusively a medium run phenomenon.

Problem Set #2 Due: Friday April 20, 2018 at 5 PM.

ECE 344 Microwave Fundamentals

There is an arbitrary overall complex phase that could be added to A, but since this makes no difference we set it to zero and choose A real.


COMPUTER GENERATED HOLOGRAMS Optical Sciences 627 W.J. Dallas (Monday, April 04, 2005, 8:35 AM) PART I: CHAPTER TWO COMB MATH.

2.3 Matrix Formulation

Derivation of Electron-Electron Interaction Terms in the Multi-Electron Hamiltonian

Problem Set 6 Solutions

Hydrogen Atom and One Electron Ions

Function Spaces. a x 3. (Letting x = 1 =)) a(0) + b + c (1) = 0. Row reducing the matrix. b 1. e 4 3. e 9. >: (x = 1 =)) a(0) + b + c (1) = 0

22/ Breakdown of the Born-Oppenheimer approximation. Selection rules for rotational-vibrational transitions. P, R branches.

Why is a E&M nature of light not sufficient to explain experiments?

1.2 Faraday s law A changing magnetic field induces an electric field. Their relation is given by:

Intro to Nuclear and Particle Physics (5110)

6. The Interaction of Light and Matter

MATH 319, WEEK 15: The Fundamental Matrix, Non-Homogeneous Systems of Differential Equations

The van der Waals interaction 1 D. E. Soper 2 University of Oregon 20 April 2012

1 General boundary conditions in diffusion

Brief Introduction to Statistical Mechanics

SECTION where P (cos θ, sin θ) and Q(cos θ, sin θ) are polynomials in cos θ and sin θ, provided Q is never equal to zero.

Pipe flow friction, small vs. big pipes

Definition1: The ratio of the radiation intensity in a given direction from the antenna to the radiation intensity averaged over all directions.

Ch. 24 Molecular Reaction Dynamics 1. Collision Theory

u x v x dx u x v x v x u x dx d u x v x u x v x dx u x v x dx Integration by Parts Formula

Schrodinger Equation in 3-d

General Notes About 2007 AP Physics Scoring Guidelines

Full Waveform Inversion Using an Energy-Based Objective Function with Efficient Calculation of the Gradient

Linear-Phase FIR Transfer Functions. Functions. Functions. Functions. Functions. Functions. Let

Math 102. Rumbos Spring Solutions to Assignment #8. Solution: The matrix, A, corresponding to the system in (1) is

The graph of y = x (or y = ) consists of two branches, As x 0, y + ; as x 0, y +. x = 0 is the

de/dx Effectively all charged particles except electrons

Davisson Germer experiment Announcements:

Introduction to Arithmetic Geometry Fall 2013 Lecture #20 11/14/2013

The pn junction: 2 Current vs Voltage (IV) characteristics

10. The Discrete-Time Fourier Transform (DTFT)

MCE503: Modeling and Simulation of Mechatronic Systems Discussion on Bond Graph Sign Conventions for Electrical Systems

Finite element discretization of Laplace and Poisson equations

Higher order derivatives

As the matrix of operator B is Hermitian so its eigenvalues must be real. It only remains to diagonalize the minor M 11 of matrix B.

High Energy Physics. Lecture 5 The Passage of Particles through Matter

EEO 401 Digital Signal Processing Prof. Mark Fowler

Supplementary Materials

Homotopy perturbation technique

E hf. hf c. 2 2 h 2 2 m v f ' f 2f ' f cos c

1 Minimum Cut Problem

Background: We have discussed the PIB, HO, and the energy of the RR model. In this chapter, the H-atom, and atomic orbitals.

Bifurcation Theory. , a stationary point, depends on the value of α. At certain values

Construction of asymmetric orthogonal arrays of strength three via a replacement method

Introduction to Condensed Matter Physics

ELECTRON-MUON SCATTERING

Principles of active remote sensing: Lidars. 1. Optical interactions of relevance to lasers. Lecture 22

Middle East Technical University Department of Mechanical Engineering ME 413 Introduction to Finite Element Analysis

Sec 2.3 Modeling with First Order Equations

Elements of Statistical Thermodynamics

Fourier Transforms and the Wave Equation. Key Mathematics: More Fourier transform theory, especially as applied to solving the wave equation.

What are those βs anyway? Understanding Design Matrix & Odds ratios

State-space behaviours 2 using eigenvalues

Collisions between electrons and ions

3 Finite Element Parametric Geometry

EAcos θ, where θ is the angle between the electric field and

Diffraction Gratings

SAFE HANDS & IIT-ian's PACE EDT-15 (JEE) SOLUTIONS

EEO 401 Digital Signal Processing Prof. Mark Fowler

Davisson Germer experiment

The Transmission Line Wave Equation

Homogeneous Constant Matrix Systems, Part I

Y 0. Standing Wave Interference between the incident & reflected waves Standing wave. A string with one end fixed on a wall

Electromagnetics Research Group A THEORETICAL MODEL OF A LOSSY DIELECTRIC SLAB FOR THE CHARACTERIZATION OF RADAR SYSTEM PERFORMANCE SPECIFICATIONS

Electrochemistry L E O

Slide 1. Slide 2. Slide 3 DIGITAL SIGNAL PROCESSING CLASSIFICATION OF SIGNALS

Section 11.6: Directional Derivatives and the Gradient Vector

Alpha and beta decay equation practice

Derivation of Eigenvalue Matrix Equations

Extraction of Doping Density Distributions from C-V Curves

MA 262, Spring 2018, Final exam Version 01 (Green)

8 Foldy-Wouthuysen Transformation

Chapter 6 Folding. Folding

Content Skills Assessments Lessons. Identify, classify, and apply properties of negative and positive angles.

Waves in cavities such as vehicle compartments, rooms or ducts

4. (5a + b) 7 & x 1 = (3x 1)log 10 4 = log (M1) [4] d = 3 [4] T 2 = 5 + = 16 or or 16.

On the irreducibility of some polynomials in two variables

Symmetric centrosymmetric matrix vector multiplication

Transcription:

Fourir Modal Mthod Solution to th Sminar Tasks Thomas Kaisr, Matthias Zilk Th assignmnt was about th implmntation of a D vrsion of th Fourir Modal Mthod in TE polarization and was dividd into two tasks. Th first task was to solv th ignvalu problm in Fourir spac that lads to th grating mods. Th scond task was to find th amplituds of th rflctd and transmittd diffraction ordrs as wll as thir diffractioicincis. Task : Layr Eignmods Th goal of Task was th implmntation of a function fmmd_te_layr_mods() that calculats th TE ignmods of a singl grating layr in th Fourir domain. Th ignmods of th grating layr in a truncatd Fourir basis ar dtrmind by th algbraic ignvalu problm β φ = [k ε K ] φ = Mφ. () ε is a Toplitz matrix that contains th Fourir cofficints ε m of th spatial distribution ε mn = ε m n ε = ε ε ε ε ε N ε N ε N ε N+ ε () whrby N is th numbr of rtaind positiv Fourir ordrs in th xpansion of th lctric fild. Th diagonal matrix K = G N + k x G N + k x G N + k x (3) contains th transvrs momntum of th rspctiv Fourir componnts that is mad up of th contribution of th rciprocal lattic G m = π Λ m () and th th transvrs wav vctor componnt of th illumination k x. Th matrix M is complx valud. For a ral valud distribution ε(x) it is Hrmitian. In cas of absorption, i.. a complx valud distribution, M has no spcial symmtry. Th ignvalus and ignvctors of M can b calculatd with th Matlab function ig().

. Implmntation Th calculation of th ignmods of th grating layr first rquirs th calculation of th Toplitz matrix ε. This part was implmntd in a sparat function fmmd matrix(). Th function first chcks if th layr is homognous: fmmd matrix.m if isscalar ( prm ) ( max (abs ( prm (:) - prm ())) == ) 5 prm_top = diag ( prm ()* ons (,*N+)); 6 rturn 7 nd If this is th cas, a diagonal matrix is rturnd dirctly. Othrwis th discrt Fourir transform of th is calculatd with th fft() routin and th rquird positiv and ngativ Fourir componnts ar xtractd. fmmd matrix.m 8 prm_ft = fft ( prm )/ numl ( prm ); 9 prm_ pos = prm_ ft (:* N +); 3 prm_ng = prm_ft ([, nd : -: nd -*N + ]); Th rsults of fft() has to b dividd by th numbr of lmnts in th vctor to obtain th corrct scaling, whr prm_ft() == man(prm). Plas not that th ngativ Fourir componnts ar stord at th nd of th vctor prm_ft in rvrs ordr and that th zroth componnt from th bginning of th vctor has to b addd by insrting a at th bginning of th indx vctor in lin 3. Th xtractd Fourir componnts ar thn passd to th built-in toplitz() function that taks car of assmbling th Toplitz matrix: fmmd matrix.m 3 prm_ top = toplitz ( prm_pos, prm_ ng ); Th actual calculation of th ignmods and th propagation constants was implmntd in th function fmmd_te_layr_mods(): 7 m = -N: N; 8 k = (m** pi/ priod + kx ).^; 9 % homognous layr fmmd_te_layr_mods.m if isscalar ( prm ) ( max (abs ( prm (:) - prm ())) == ) phi = y (* N +); 3 bta = prm ()* k ^ - k; % inhomognous layr 5 ls 6 prm_ top = fmmd matrix ( prm, N); 7 [phi, bta ] = ig (k ^* prm_top - diag (k )); 8 bta = diag ( bta ); 9 nd 3 bta = sqrt ( bta ); 3 % mak sur that th propagation constants blong to forward mods 3 ind = ( ral ( bta ) + imag ( bta )) < ; 33 bta (ind) = -bta (ind );

Λ = 3 µm ε H = ε L = w =.5 µm Figur : Gomtry of th grating layr invstigatd in task. Only a singl priod is usd in th simulation. Th implmntation xplicitly handls th cas of a homognous layr in th lins to 3. This nsurs that th ordring of th ignmods and propagation constants of a homognous layr is consistnt with th numbring of th Fourir ordrs. Th inhomognous cas is handld in th lins 6 to 8. Th matrix ε is calculatd with th aformntiond function fmmd matrix(). Th rmaining assmbling of th matrix of th ignvalu problm is a litral translation of quations (), (3) and () into Matlab xprssion. Th matrix is passd to th built-in ig() function that calculats all ignvctors and ignvalus. In ordr to obtain th propagation constants, th squar root of th calculatd ignvalus is takn in lin 3. Thrby it has to b mad sur that th obtaind propagation constants actually blong to th forward mods. This th purpos of th last two lins of th function.. Rsults Th implmntation of th function fmmd_te_layr_mods() was tstd by calculating th ignmods of th grating layr shown in figur at a wavlngth of λ =.6 µm and with a transvrs wav vctor k x =. Th numbr of positiv of Fourir ordrs was N = 5. Th normalizd propagation constants β i /k of th grating mods ar shown in figur a and th magnitud of thir Fourir componnts is show in figur b. As th transvrs wav vctor k x was zro, positiv and ngativ componnts with th sam ordr ar xcitd qually strong. Nin mods xhibit a ral propagation constant and can propagat. Th rmaining mods hav purly imaginary propagation constants. Th spctrum of th propagating mods compriss primarily th lowr Fourir componnts whil th vanscnt mods ar dominatd by th largr Fourir componnts. Nonthlss, vn th propagating mods hav non-vanishing contributions from Fourir componnts of th ordr and abov. It is thrfor important to notic, that th numbr of Fourir componnts has to b chosn largr than th numbr of propagating diffraction ordrs in th substrat and cladding rgion in ordr to proprly dscrib th dynamics in th structurd grating rgion, vn whn th insid th grating dos not xcd th abov or blow. Th fild distributions of th propagating mods is shown in figur 3. Th ffctiv indx = β i /k of th mods is shown in th plots. Fiv mods hav activ indx that xcds th lowr rfractiv indx n L = of th grating. Ths mods ar guidd within th high indx rgion of th grating. Th rmaining mods hav activ indx < n L and hav significant fild also in th low indx rgion. Th lowr th ffctiv indx of th mods is, th strongr thy oscillat along th transvrs dirction. As th grating profil is symmtric and as k x =, th mods xhibit ithr an vn or an odd symmtry with rspct to th symmtry plan of th grating. Task : Diffraction Efficincis Th goal of task was th solution of th boundary valu problm in ordr to calculat th amplituds and diffractioicincis of th transmittd and rflctd diffraction ordrs. Th boundary valu problm is solvd with th T-matrix algorithm that builds th transfr matrix T(, M + ) (5) 3

Fourir ordr log(magnitud) (normalizd) 8 - -.5 6 - - /k -.5 - ral part imaginary part -.5 3 5 mod numbr (a) propagation constants 3 5 mod numbr (b) Fourir cofficints -3 Figur : Propagation constants and Fourir cofficints of th ignmods of th invstigatd grating layr. Th mods ar not shown in th ordr as rturnd by fmmd_te_layr_mods() but hav bn sortd by th ral and imaginary part of th propagation constants. =.975 =.899 =.767-3 =.569-3 =.88-3 =.935-3 =.98-3 =.56-3 =.36-3 - 3-3 Figur 3: Ral part of th ral-spac fild distributions of all propagating ignmods of th invstigatd grating layr. Th phas of th mods has ban adjustd to maximiz th ral part of th filds bfor plotting (lading to a vanishing imaginary part for k x = ). Th distribution within th grating layr is shown in orang.

of th whol grating with M layrs in a stpwis fashion. Th algorithm starts in th homognous rgion in front of th grating with layr indx k =, thicknss d =, ignvctors φ () = [ φ (),,, φ(),n+] (6) and ignvalus β = diag ([ β (),, β() N+]). (7) Th initial systm transfr matrix is th idntity matrix: T(, ) =. (8) Th algorithm thn itrats ovr all layrs. In ach layr k it calculats th ignvctor β (k) and builds th transfr matrix from th prvious layr to th currnt layr and ignvalus T(k, k) = [ β (k) β (k) ] [ φ (k ) φ (k ) β (k) φ (k ) φ (k ) β (k) ] [ p (k )+ (d k ) p (k ) (d k ) ] (9) whrby th ntris of th propagators p (k )± (d k ) ar givn by p (k )± mn (d k ) = δ mn xp ( ±iβ m (k ) d k ). () This layr transfr matrix is multiplid with th systm transfr matrix which yilds th xtndd systm transfr matrix: T(, k) = T(k, k) T(, k ). () Th algorithm nds in th homognous layr bhind th grating with layr indx k = M +. Onc th systm transfr matrix is known, th amplitud rflction and transmission cofficints ar givn by [ T ] = T(, M + ) [ a in R ] = [ t t t t ] [ a in R ] () whrby a in dscribs th incidnt fild with a in m = δ mn+. Rarranging quation () yilds th xplicit xprssions R = t t a in, T = ( t t t (3) t ) a in. () Th diffractioicincis η R T transmission cofficints via = [η R T, N,, η R T,N] T can b calculatd from th rflction and η R = η R = R R { β N+} () { β () (R R )}, (5) R { β () N+} R { β (M+) (T T )}. (6) 5

. Implmntation Th T-matrix algorithm was implmntd in th function fmmd_te() which contains a litral translation of th dscribd algorithm: fmmd_te.m 33 k = * pi/ lam; % vacuum wavnumbr 3 kx = k* sqrt ( prm_ in )* sin ( thta ); % transvrs wav vctor 35 Ntot = * N + ; % total numbr of diffraction ordrs 36 37 % initial T- matrix 38 t_ matrix = y (* Ntot ); 39 % mods on th incidnc sid d = ; [bta, phi ] = fmmd_te_layr_mods ( prm_in, priod, k, kx, N); 3 bta_ in = bta ; 5 % itration ovr grating layrs 6 for la = : numl ( layr_ ticknsss ) 7 d = layr_ ticknsss ( la ); 8 [bta, phi ] = fmmd_te_layr_mods ( layr_prm (la,:), priod,... 9 k, kx, N); 5 layr_ t_ matrix = fmmd_ layr_ t_ matrix ( bta, phi, d,... 5 bta, phi, d ); 5 % prpnd T- matrix of th currnt layr 53 t_matrix = layr_t_matrix * t_matrix ; 5 bta = bta ; 55 phi = phi ; 56 d = d; 57 nd 58 59 % mods on th th xit sid 6 d = ; 6 [bta, phi ] = fmmd_te_layr_mods ( prm_out, priod, k, kx, N); 6 bta_ out = bta ; 63 layr_ t_ matrix = fmmd_ layr_ t_ matrix ( bta, phi, d,... 6 bta, phi, d ); 65 t_matrix = layr_t_matrix * t_matrix ; 66 67 % amplituds of th incidnt mods 68 ind = N + ; % indx of th th diffraction ordr 69 ap = zros ( Ntot,); 7 ap(ind ) = ; 7 7 % transmission and rflction cofficints 73 i = : Ntot ; 7 i = Ntot +:* Ntot ; 75 S = -t_matrix (i, i )\ t_matrix (i, i ); 76 S = t_matrix (i, i) + t_matrix (i, i )* S; 77 T = S *ap; 78 R = S *ap; 79 8 % diffractioicincis 8 ta_r = ral (R.* conj (R).* bta_in (:) )/ ral ( bta_in ( ind )); 8 ta_t = ral (T.* conj (T).* bta_out (:))/ ral ( bta_in ( ind )); 6

d = d = d 3 =.5 µm x θ z ε in = ε H ε L ε H = ε L = ε H ε L ε out = w =.5Λ w =.5Λ w 3 =.75Λ Λ = 3 µm Figur : Gomtry of th multilayr grating invstigatd in task. Th dirction of th incidnt light is indicatd by th rd arrow. Only a singl priod is usd in th simulation. Th only notabl fatur of th implmntation is th optimization that not all ignvctors and propagations constants ar stord. Th T-matrix algorithm only nds th thicknss, th propagation constants and th ignvalus of th last prvious and of th currnt layr. Th valus of th prvious layr ar stord in th variabls d, phi and bta. Th valus of th currnt layr ar stord in d, phi and bta. At th nd of ach itration in th lins 5 to 56 th valus of th prvious layr ar updatd with th valus of th currnt layr. Additionally, th propagation constants of th homognous layr in front of th grating ar rquird for th calculation of th diffractioicincis. Ths ar stord in th variabl bta_in. Th propagation constants of th homognous layr bhind th grating ar rquird to b calculatd th diffractioicincis of th transmittd diffraction ordrs. Aftr th T-matrix algorithm thy ar containd in bta. Howvr, to mak th cod mor radabl, thy ar also stord in th variabl bta_out. To kp th function fmmd_te() compact and simpl, th calculation of th layr transfr matrix was shiftd to a sparat function fmmd_layr_t_matrix() which contains just a litral translation of quations (9) and (): fmmd_layr_t_matrix.m 7 p = diag ([ xp ( i* bta (:)* d ); xp (-i* bta (:)* d )]); 8 t_ matrix = [ phi, phi ;... 9 phi * diag ( bta ), -phi * diag ( bta )]... 3 \ [ phi, phi ;... 3 phi * diag ( bta ), -phi * diag ( bta )]; 3 t_ matrix = t_ matrix * p;. Rsults Th implmntation of th algorithm was tstd with a multilayr grating that is shown in figur. Th diffractioicincis wr calculatd at a wavlngth of λ =.6 µm for various angls of incidnc θ { 3,, +3 }. Th numbr of positiv of Fourir ordrs was N =. Th spatial distribution was discrtizd with N x = grid points. Th rsults ar ar show in figur 5. Th numrical valus ar also givn in tabls and. Th grating has a strongly asymmtric profil. Hnc vn at normal incidnc th distribution diffraction fficincis of th xcitd diffraction ordrs is quit asymmtric. Th distribution of th rflctd light is shown figur 5a. At normal incidnc th diffractioicincis of th positiv rflctd diffraction ordrs ar largr than th diffractioicincis of th rspctiv ngativ ordrs. Howvr, th rflctd powr is sprad ovr all propagating diffraction ordrs and thr is no singl dominating diffraction ordr. Whn 7

diffractioicincy diffractioicincy rflctd diffraction ordrs.7 transmittd diffraction ordrs..35.3 =-3 = =+3.6.5 =-3 = =+3.5...3.5..5.. -7-6 -5 - -3 - - 3 5 6 7 diffraction ordr (a) rflctd diffraction ordrs -7-6 -5 - -3 - - 3 5 6 7 diffraction ordr (b) transmittd diffraction ordrs Figur 5: Diffractioicincis of th rflctd and transmittd diffraction ordrs of th invstigatd grating gomtry for various angls of incidnc. Tabl : Diffractioicincis of th rflctd diffraction ordrs. θ 7 6 5 3 + + + +3 + +5 +6 +7 3.......87.8.88.36..5.........8.3.66.5.39..... +3....5.3.8.7.8.5...... Tabl : Diffractioicincis of th transmittd diffraction ordrs. θ 7 6 5 3 + + + +3 + +5 +6 +7 3....353.3.77.6358.9.359.95.6.65.9.3....8.678.98.9.535.36.3.7.76.76.95.. +3..63.8.33.8.336.5675.8.3.375.95.3... th angl of incidnc is changd, som diffraction ordrs bcom vanscnt and can no longr propagat whil othr diffraction ordr that wr vanscnt at normal incidnc can now propagat instad. For xampl, at θ = 3 th nd diffraction ordr disappars and th +3 rd and + th ordr appar instad. Accordingly at θ = +3 th + nd diffraction ordr disappars and th 3 rd and th ordr appar instad. Th distribution of th transmittd light is shown in figur 5b. It is quit diffrnt form th distribution of th rflctd light. Th st diffraction ordr dominats ovr all othr diffraction ordrs. This blaz ffct rsults from th approximatly triangular shap of th grating that is cratd by th staircas lik arrangmnt of th 3 grating layrs. In a grating with prfctly triangular shap, th blaz ffct is strongst whn a diffraction ordr propagats at th sam angl as th light that is rfractd at th slopd grating groovs. Howvr, to approximat such a prfct triangular grating, significantly mor than 3 layrs ar ncssary. In th analyzd 3 layr grating, th blaz ffct is not prfct as can b sn from th rlativly larg fraction of powr that is transmittd into th othr diffraction ordrs. Intrstingly, th blaz ffct in transmission sms to b quit robust against variations of th angl of incidnc..3 Stability Issus Th transfr matrix algorithm is numrically instabl. Whn th numbr of positiv Fourir ordrs is incrasd to N =, Matlab issus a warning that a singular matrix is ncountrd in th calculation of th rflction and transmission cofficints: 8

> In fmmd_te (lin 75) In tst_fmmd_te (lin ) Warning: Matrix is clos to singular or badly scald. Rsults may b inaccurat. RCOND =.36367-. Chcking th sum of th transmittd and rflctd powr fraction - sum(ta_r + ta_t) = -.853+ rvals that nrgy is no longr consrvd. Th calculatd diffractioicincis hav unphysical valus. Th sam happns whn th thicknsss of th grating layrs ar doubld from d i =.5 µm to d i =.5 µm: > In fmmd_te (lin 75) In tst_fmmd_te (lin 8) Warning: Matrix is clos to singular or badly scald. Rsults may b inaccurat. RCOND = 6.68593-. Again th diffractioicincis hav unphysical valus: - sum(ta_r + ta_t) = -8.6665+. Th root of this problm is th backwards propagator p (d) that appars in th transfr matrix algorithm whn th mod amplituds hav to b translatd from th top of a layr to th bottom: [ a + bot a bot ] = [ p + (d) p (d) ] [ a + top a top ] (7) with p ± (d k ) according to quation (). For vanscnt mods with I {β m} > th ntris of p (d) grow xponntially with th layr thicknss d. For a larg numbr of Fourir ordrs (lading to strongly vanscnt mods with vry larg imaginary parts of th propagation constants) or for sufficintly larg layr thicknsss, th ntris of th matrix ovrflow and subsqunt calculations yild wrong rsults. A stratgy to ovrcom this instability is to avoid th xponntially growing factors by xchanging th positions of th input ports in th algorithm: [ a + bot a top ] = [ p + (d) p + (d) ] [ a + top a bot ]. (8) Equation (8) no longr conncts th amplituds on on sid of th layr with th amplituds on th othr sid of th layr in trms of a transfr matrix, but it conncts th incidnt amplituds with th scattrd amplituds in trms of a scattring matrix. This ida can b xtndd across th boundary of adjacnt layrs and is th foundation of th numrically stabl S-matrix algorithm. Howvr, th numrical stability of this algorithm coms at th pric of an incrasd complxity. Scattring matrics of multipl layrs can t b concatnatd by a simpl matrix multiplication, but rquir a mor sophisticatd schm instad. Dtails can b found in []. Th stabl S-matrix algorithm was implmntd in th function fmmd_te_stabl. W lav it to th intrstd radr to xplor th sourc cod of this function. Rfrncs [] Lifng Li, Formulation and comparison of two rcursiv matrix algorithms for modling layrd diffraction gratings, JOSA A 3, p. (996), https://doi.org/.36/josaa.3.. 9