Examples using RCWA — Rigorous Coupled Wave Analysis 1.0 documentation

# Examples using RCWA

These examples can all be found in the examples folder in the main rcwa package on github.

## Bragg Mirror Reflection Spectra

    # Author: Jordan Edmunds, Ph.D. Student, UC Berkeley
    # Contact: jordan.e@berkeley.edu
    # Creation Date: 11/01/2019
    #
    from rcwa import Layer, LayerStack, Source, Solver, Plotter

    import numpy as np
    from matplotlib import pyplot as plt

    designWavelength = 1.3
    startWavelength = 0.6
    stopWavelength = 2.2
    stepWavelength = 0.005

    n1 = 3.5 # refractive index of layer 1 (Si)
    n2 = 1.45 # refractive index of layer 2 (SiO2)
    t1 = designWavelength/4/n1
    t2 = designWavelength/4/n2

    reflectionLayer = Layer(n=1)
    transmissionLayer = Layer(n=n1)
    layer0 = Layer(n=n1, L=t1)
    layer1 = Layer(n=n2, L=t2)
    layer2 = Layer(n=n1, L=t1)
    layer3 = Layer(n=n2, L=t2)
    layer4 = Layer(n=n1, L=t1)
    layer5 = Layer(n=n2, L=t2)
    layer6 = Layer(n=n1, L=t1)
    layer7 = Layer(n=n2, L=t2)
    layer8 = Layer(n=n1, L=t1)
    layer9 = Layer(n=n2, L=t2)
    layer10 = Layer(n=n1, L=t1)
    stack = LayerStack(reflectionLayer,
           layer0, layer1, layer2, layer3, layer4, layer5, layer6, layer7, layer8, layer9, layer10,
            transmissionLayer)
    source = Source(wavelength=designWavelength)

    print("Solving system...")
    TMMSolver = Solver(stack, source, (1, 1))
    wavelengths = np.arange(startWavelength, stopWavelength + stepWavelength,
            stepWavelength)

    TMMSolver.Solve(wavelengths=wavelengths)
    #Plotter.plotEllipsometrySpectra(TMMSolver1.results)
    Plotter.plotRTSpectra(TMMSolver.results)
    plt.show()

## Reflection from a Dispersive Interface (Silicon)

    # Author: Jordan Edmunds, Ph.D. Student, UC Berkeley
    # Contact: jordan.e@berkeley.edu
    # Creation Date: 11/01/2019
    #
    from rcwa import Material, Layer, LayerStack, Source, Solver, Plotter

    import numpy as np
    import pandas as pd
    from matplotlib import pyplot as plt

    designWavelength = 1.3
    startWavelength = 0.25
    stopWavelength = 0.85
    stepWavelength = 0.001

    source = Source(wavelength=designWavelength)
    si = Material(material_name='Si')
    data = pd.DataFrame({'Wavelength (um):': si.wavelengths, 'er': si._er, 'n': si._n})
    print(data)

    reflectionLayer = Layer(n=1) # Free space
    transmissionLayer = Layer(material=si)
    stack = LayerStack(reflectionLayer, transmissionLayer)

    print("Solving system...")
    TMMSolver = Solver(stack, source, (1, 1))
    wavelengths = np.arange(startWavelength, stopWavelength + stepWavelength,
            stepWavelength)

    TMMSolver.Solve(wavelengths=wavelengths)
    #Plotter.plotEllipsometrySpectra(TMMSolver.results)
    Plotter.plotRTSpectra(TMMSolver.results)
    plt.show()

## Reflection from a Dispersive Interface (SiO2)

    # Author: Jordan Edmunds, Ph.D. Student, UC Berkeley
    # Contact: jordan.e@berkeley.edu
    # Creation Date: 11/01/2019
    #
    from rcwa import Material, Layer, LayerStack, Source, Solver, Plotter

    import numpy as np
    import pandas as pd
    from matplotlib import pyplot as plt

    designWavelength = 1.3
    startWavelength = 0.25
    stopWavelength = 0.85
    stepWavelength = 0.001

    source = Source(wavelength=designWavelength)
    siO2 = Material(material_name='SiO2')

    reflectionLayer = Layer(n=1) # Free space
    transmissionLayer = Layer(material=siO2)
    stack = LayerStack(reflectionLayer, transmissionLayer)

    print("Solving system...")
    TMMSolver = Solver(stack, source, (1, 1))
    wavelengths = np.arange(startWavelength, stopWavelength + stepWavelength,
            stepWavelength)

    TMMSolver.Solve(wavelengths=wavelengths)
    #Plotter.plotEllipsometrySpectra(TMMSolver.results)
    Plotter.plotRTSpectra(TMMSolver.results)
    plt.show()

## Ellipsometry of bare Si wafer [BROKEN]

    # Author: Jordan Edmunds, Ph.D. Student, UC Berkeley
    # Contact: jordan.e@berkeley.edu
    # Creation Date: 11/01/2019
    #
    from rcwa import Material, Layer, LayerStack, Source, Solver, Plotter

    import numpy as np
    import pandas as pd
    from matplotlib import pyplot as plt

    startWavelength = 0.25
    stopWavelength = 0.850
    stepWavelength = 0.001
    incident_angle = np.radians(75)

    source = Source(wavelength=startWavelength, theta=incident_angle)
    si = Material('Si')
    breakpoint()

    reflectionLayer = Layer(n=1) # Free space
    transmissionLayer = Layer(material=si)
    stack = LayerStack(reflectionLayer, transmissionLayer)

    print("Solving system...")
    TMMSolver = Solver(stack, source, (1, 1))
    wavelengths = np.arange(startWavelength, stopWavelength + stepWavelength,
            stepWavelength)

    TMMSolver.Solve(wavelengths=wavelengths)

    tan_psi_predicted = np.array([result['tanPsi'] for result in TMMSolver.results])
    cos_delta_predicted = np.array([result['cosDelta'] for result in TMMSolver.results])

    fig, ax = plt.subplots()
    ax.plot(wavelengths, tan_psi_predicted)
    ax.plot(wavelengths, cos_delta_predicted)
    ax.legend([r'$Tan(\Psi)$', r'$Cos(\Delta)$'])
    plt.show()

## Rectangular Lattice Photonic Crystal with Triangular Shape

    import unittest
    from rcwa import Source, Layer, LayerStack, Crystal, Plotter, complexArray, Solver
    import numpy as np

    devicePermittivityCellData = np.transpose(np.loadtxt('triangleData.csv', delimiter=','))
    devicePermeabilityCellData = 1 + 0 * devicePermittivityCellData

    reflectionLayer = Layer(er=2.0, ur=1.0)
    transmissionLayer = Layer(er=9.0, ur=1.0)

    wavelength = 2
    deg = np.pi / 180
    k0 = 2*np.pi/wavelength
    theta = 60 * deg
    phi = 30*deg
    pTEM = 1/np.sqrt(2)*complexArray([1,1j])
    source = Source(wavelength=wavelength, theta=theta, phi=phi, pTEM=pTEM, layer=reflectionLayer)
    t1, t2 = complexArray([1.75, 0, 0]), complexArray([0, 1.5, 0])

    crystalThickness = 0.5

    numberHarmonics = (3, 3)

    deviceCrystal = Crystal(devicePermittivityCellData, devicePermeabilityCellData, t1, t2)
    layer1 = Layer(crystal=deviceCrystal, L=crystalThickness, numberHarmonics=numberHarmonics)
    layerStack = LayerStack(reflectionLayer, layer1, transmissionLayer)

    solver = Solver(layerStack, source, numberHarmonics)
    solver.Solve()

    # Get the amplitude reflection and transmission coefficients
    (rxCalculated, ryCalculated, rzCalculated) = (solver.rx, solver.ry, solver.rz)
    (txCalculated, tyCalculated, tzCalculated) = (solver.tx, solver.ty, solver.tz)

    # Get the diffraction efficiencies R and T and overall reflection and transmission coefficients R and T
    (R, T, RTot, TTot) = (solver.R, solver.T, solver.RTot, solver.TTot)
    print(RTot, TTot, RTot+TTot)

# Indices and tables

- Index

- Module Index

- Search Page