{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Mode solver Fully Vectorial\n", "\n", "## Strip waveguides \n", "\n", "Lets compute the modes for different types of waveguides" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "```\n", " _________________________________\n", "\n", "\n", " clad_thickness\n", " width\n", " <---------->\n", " ___________ _ _ _ _ _ _\n", " | |\n", " _____| |____ |\n", " wg_heigth\n", " slab_thickness |\n", " _______________________ _ _ _ _ __\n", "\n", " sub_thickness\n", " _________________________________\n", " <------------------------------->\n", " sub_width\n", "```" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import matplotlib.pyplot as plt\n", "import modes as ms\n", "from tqdm import tqdm" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "ms.waveguide(width=0.5, slab_thickness=0)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "ymargin = 1\n", "s = ms.mode_solver_full(plot=True, plot_index=True, logscale=True, n_modes=1, width=0.2, thickness=0.22, fields_to_write=('Ex'), clad_thickness=[ymargin], sub_thickness=ymargin)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "ymargin = 1.5\n", "s = ms.mode_solver_full(plot=True, plot_index=True, logscale=True, n_modes=1, width=0.25, thickness=0.22, fields_to_write=('Ex'), clad_thickness=[ymargin], sub_thickness=ymargin, sub_width=2*ymargin)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can also plot the mode in logscale" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "s = ms.mode_solver_full(plot=True, plot_index=True, logscale=True, n_modes=1, width=0.5, thickness=0.22, fields_to_write=('Ex'))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "s = ms.mode_solver_full(plot=True, plot_index=True) # by default it will plot at the fields" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "ms.mode_solver_full?" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "where the waveguide parameters" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "s.results['n_effs'][0].real" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "s = ms.mode_solver_full(plot=False, n_modes=1, width=0.5, thickness=0.22, fields_to_write=('Ex'), overwrite=True)\n", "A, centre, sigma_2 = ms.fit.fit_gaussian(s.wg.xc, s.wg.yc, np.abs(s.modes[0].fields['Ex']))\n", "print(f\"Aeff = {A:.2f}, mode_center = {centre}, Sigma2 = ({sigma_2[0]:.2f}, {sigma_2[1]:.2f})\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "What is the waveguide geometry that gives the smallest mode area, for the TE polarization at 1550, for a silicon thickness of 220 nm, strip waveguide?" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "nm = 1e-3\n", "widths = np.linspace(250, 600, 15)*nm\n", "aeffs = []\n", "sigma2x = []\n", "sigma2y = []\n", "\n", "for width in tqdm(widths):\n", " s = ms.mode_solver_full(plot=False, n_modes=1, width=width, thickness=0.22, fields_to_write=('Ex'), clad_thickness=[ymargin], sub_thickness=ymargin, sub_width=2*ymargin+width, overwrite=True)\n", " A, centre, sigma2 = ms.fit.fit_gaussian(s.wg.xc, s.wg.yc, np.abs(s.modes[0].fields['Ex'])) \n", " aeffs.append(A)\n", " sigma2x.append(sigma2[0])\n", " sigma2y.append(sigma2[1])" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plt.plot(widths, aeffs, 'o')\n", "plt.xlabel('wg width (nm)')\n", "plt.ylabel(r'Aeff ($\\mu m^2$)')\n", "\n", "plt.figure()\n", "plt.plot(widths, sigma2x)\n", "plt.xlabel('wg width (nm)')\n", "plt.ylabel(r'$\\sigma_x^2$')\n", "\n", "plt.figure()\n", "plt.plot(widths, sigma2y)\n", "plt.xlabel('wg width (nm)')\n", "plt.ylabel(r'$\\sigma_y^2$')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "As you can see 350 nm width will give you the smallest mode area for 220nm Silicon strip waveguides\n", "\n", "\n", "## Rib waveguides" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "s = ms.mode_solver_full(plot=True, plot_index=True, n_modes=1, width=0.5, thickness=0.22, slab_thickness=0.09, fields_to_write=('Ex'), overwrite=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Convergence tests\n", "\n", "Lets do some convergence tests wherer we reduce the meshsize (20 nm by default)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# dx=np.linspace(0.01, 0.02, 3)\n", "dx = np.array([5, 10, 20, 40])*1e-3\n", "n_effs = [ms.mode_solver_full(n_modes=1, x_step=dxi, y_step=dxi, plot=False).results['n_effs'][0].real for dxi in dx]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plt.plot(dx*1e3, n_effs)\n", "plt.xlabel('mesh size (nm)')\n", "plt.ylabel('neff0')" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.7" } }, "nbformat": 4, "nbformat_minor": 4 }