{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Mode solver semivectorial" ] }, { "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", "\n", "ms.mode_solver_semi(n_modes=2, thickness=0.22, width=0.5, wavelength=1.55, plot_index=True, plot=True)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "ms.mode_solver_semi(n_modes=2, thickness=0.22, width=0.5, wavelength=1.55, logscale=True, plot=True, plot_index=True)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "ms.mode_solver_semi?" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Convergence tests\n", "\n", "Lets change the simulations size and see how the neff changes" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "sub_widths = np.linspace(1.5, 3, 3)\n", "n_effs = [ms.mode_solver_semi(plot=False, n_modes=1, sub_width=sub_width).results['n_effs'][0].real for sub_width in sub_widths]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plt.plot(sub_widths, n_effs, '.-')\n", "plt.xlabel('simulation width (um)')\n", "plt.ylabel('neff')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "ds = np.linspace(0.01, 0.02, 3)\n", "n_effs = [ms.mode_solver_semi(plot=False, n_modes=1, y_step=d, x_step=d).results['n_effs'][0].real for d in ds]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plt.plot(ds*1e3, n_effs, '.-')\n", "plt.xlabel('mesh size (nm)')\n", "plt.ylabel('neff')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "d = 0.01\n", "m = ms.mode_solver_semi(plot=False, n_modes=1, y_step=d, x_step=d)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "m.results" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "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 }