Skip to content

Commit

Permalink
Deploying to gh-pages from @ 3b138d0 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
Andeloth committed Feb 21, 2024
1 parent b16aceb commit 7be1cbd
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 22 deletions.
30 changes: 19 additions & 11 deletions _sources/pages/scattering_parameters.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -577,38 +577,46 @@
"source": [
"## Using `gplugins.gmeep.write_sparameters_meep`\n",
"\n",
"An alternative method to the one outlined above is using the gplugins package. The `write_sparameters_meep` function can automate the entire process that we outlined above, but it is less customizable in exchange for its ease of use. This is how we could use it to find the s-parameters for the 2x2 mmi.\n",
"\n",
"NOTE: Currently bugged, will be fixed soon."
"An alternative method to the one outlined above is using the gplugins package. The `write_sparameters_meep` function can automate the entire process that we outlined above, but it is less customizable in exchange for its ease of use. This is how we could use it to find the s-parameters for the 2x2 mmi."
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 36,
"metadata": {},
"outputs": [],
"source": [
"from gplugins.gmeep import write_sparameters_meep\n",
"\n",
"pwd = Path(os.path.abspath(''))\n",
"gds_file = pwd.parent / \"files/mmi2x2.gds\"\n",
"mmi_comp = import_gds(gds_file)\n",
"\n",
"res = 40\n",
"\n",
"sim_is_3D = False\n",
"port_xpos = 17.75\n",
"port_ypos = (0.75 + 0.5) / 2\n",
"port_ysize = 1\n",
"\n",
"mmi_comp = import_gds(gds_file)\n",
"mmi_comp.add_port(name=\"o1\", center=[-port_xpos, -port_ypos], width=port_ysize, orientation=0, cross_section=gf.cross_section.cross_section(width=port_ysize, layer='WG'))\n",
"mmi_comp.add_port(name=\"o2\", center=[-port_xpos, port_ypos], width=port_ysize, orientation=0, cross_section=gf.cross_section.cross_section(width=port_ysize, layer='WG'))\n",
"mmi_comp.add_port(name=\"o3\", center=[port_xpos, -port_ypos], width=port_ysize, orientation=180, cross_section=gf.cross_section.cross_section(width=port_ysize, layer='WG'))\n",
"mmi_comp.add_port(name=\"o4\", center=[port_xpos, port_ypos], width=port_ysize, orientation=180, cross_section=gf.cross_section.cross_section(width=port_ysize, layer='WG'))\n",
"\n",
"sparams = write_sparameters_meep(\n",
" component=mmi_comp,\n",
" port_margin=2,\n",
" port_source_offset=0.5,\n",
" run=False,\n",
" xmargin=2,\n",
" ymargin=2,\n",
" resolution=res,\n",
" extend_ports_length=0,\n",
" port_margin=0,\n",
" port_source_offset=4.5,\n",
" port_monitor_offset=4.5,\n",
" run=True,\n",
" xmargin=0,\n",
" ymargin=1,\n",
" zmargin=2 if sim_is_3D else 0,\n",
" is_3d=sim_is_3D,\n",
" tpml=1,\n",
" tpml=dpml,\n",
" clad_material=\"SiO2\",\n",
" wavelength_start=1.5,\n",
" wavelength_stop=1.6,\n",
Expand Down
4 changes: 2 additions & 2 deletions pages/directional_couplers.html
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,8 @@ <h3>Coupling length and the gap between waveguides<a class="headerlink" href="#c
\]</div>
<p>Because of this difference in propagation constants, the modes travel at different speeds down the waveguide and so the field intensity oscillates between the two waveguides. This is called beating. One beat is equivalent to the coupling length, or cross-over length, and it is the length it takes for all of the power from one waveguide to be coupled into the other. As the gap between the waveguides gets smaller, the beating gets faster since <span class="math notranslate nohighlight">\(\Delta n\)</span> gets larger, making the cross-over length shorter.</p>
<p>This cross-over length <span class="math notranslate nohighlight">\(L\)</span>, that gives 100% power transfer is found with:</p>
<div class="amsmath math notranslate nohighlight" id="equation-40094edd-abfb-409f-b95d-02af80d91724">
<span class="eqno">(2)<a class="headerlink" href="#equation-40094edd-abfb-409f-b95d-02af80d91724" title="Permalink to this equation">#</a></span>\[\begin{align}
<div class="amsmath math notranslate nohighlight" id="equation-c7ff7e43-cdbf-4df6-a89c-e07ab1892966">
<span class="eqno">(2)<a class="headerlink" href="#equation-c7ff7e43-cdbf-4df6-a89c-e07ab1892966" title="Permalink to this equation">#</a></span>\[\begin{align}
L_{\text{cross-over}} = \frac {\lambda}{2\Delta n} \nonumber
\end{align}\]</div>
<p>This is found from determining what length when multiplied by the propagation constants makes the phase difference <span class="math notranslate nohighlight">\(\pi\)</span>:</p>
Expand Down
25 changes: 17 additions & 8 deletions pages/scattering_parameters.html
Original file line number Diff line number Diff line change
Expand Up @@ -748,30 +748,39 @@ <h3>S-Parameters across different Frequencies<a class="headerlink" href="#s-para
<section id="using-gplugins-gmeep-write-sparameters-meep">
<h2>Using <code class="docutils literal notranslate"><span class="pre">gplugins.gmeep.write_sparameters_meep</span></code><a class="headerlink" href="#using-gplugins-gmeep-write-sparameters-meep" title="Permalink to this heading">#</a></h2>
<p>An alternative method to the one outlined above is using the gplugins package. The <code class="docutils literal notranslate"><span class="pre">write_sparameters_meep</span></code> function can automate the entire process that we outlined above, but it is less customizable in exchange for its ease of use. This is how we could use it to find the s-parameters for the 2x2 mmi.</p>
<p>NOTE: Currently bugged, will be fixed soon.</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">gplugins.gmeep</span> <span class="kn">import</span> <span class="n">write_sparameters_meep</span>

<span class="n">pwd</span> <span class="o">=</span> <span class="n">Path</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="s1">''</span><span class="p">))</span>
<span class="n">gds_file</span> <span class="o">=</span> <span class="n">pwd</span><span class="o">.</span><span class="n">parent</span> <span class="o">/</span> <span class="s2">"files/mmi2x2.gds"</span>
<span class="n">mmi_comp</span> <span class="o">=</span> <span class="n">import_gds</span><span class="p">(</span><span class="n">gds_file</span><span class="p">)</span>

<span class="n">res</span> <span class="o">=</span> <span class="mi">40</span>

<span class="n">sim_is_3D</span> <span class="o">=</span> <span class="kc">False</span>
<span class="n">port_xpos</span> <span class="o">=</span> <span class="mf">17.75</span>
<span class="n">port_ypos</span> <span class="o">=</span> <span class="p">(</span><span class="mf">0.75</span> <span class="o">+</span> <span class="mf">0.5</span><span class="p">)</span> <span class="o">/</span> <span class="mi">2</span>
<span class="n">port_ysize</span> <span class="o">=</span> <span class="mi">1</span>

<span class="n">mmi_comp</span> <span class="o">=</span> <span class="n">import_gds</span><span class="p">(</span><span class="n">gds_file</span><span class="p">)</span>
<span class="n">mmi_comp</span><span class="o">.</span><span class="n">add_port</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s2">"o1"</span><span class="p">,</span> <span class="n">center</span><span class="o">=</span><span class="p">[</span><span class="o">-</span><span class="n">port_xpos</span><span class="p">,</span> <span class="o">-</span><span class="n">port_ypos</span><span class="p">],</span> <span class="n">width</span><span class="o">=</span><span class="n">port_ysize</span><span class="p">,</span> <span class="n">orientation</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">cross_section</span><span class="o">=</span><span class="n">gf</span><span class="o">.</span><span class="n">cross_section</span><span class="o">.</span><span class="n">cross_section</span><span class="p">(</span><span class="n">width</span><span class="o">=</span><span class="n">port_ysize</span><span class="p">,</span> <span class="n">layer</span><span class="o">=</span><span class="s1">'WG'</span><span class="p">))</span>
<span class="n">mmi_comp</span><span class="o">.</span><span class="n">add_port</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s2">"o2"</span><span class="p">,</span> <span class="n">center</span><span class="o">=</span><span class="p">[</span><span class="o">-</span><span class="n">port_xpos</span><span class="p">,</span> <span class="n">port_ypos</span><span class="p">],</span> <span class="n">width</span><span class="o">=</span><span class="n">port_ysize</span><span class="p">,</span> <span class="n">orientation</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">cross_section</span><span class="o">=</span><span class="n">gf</span><span class="o">.</span><span class="n">cross_section</span><span class="o">.</span><span class="n">cross_section</span><span class="p">(</span><span class="n">width</span><span class="o">=</span><span class="n">port_ysize</span><span class="p">,</span> <span class="n">layer</span><span class="o">=</span><span class="s1">'WG'</span><span class="p">))</span>
<span class="n">mmi_comp</span><span class="o">.</span><span class="n">add_port</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s2">"o3"</span><span class="p">,</span> <span class="n">center</span><span class="o">=</span><span class="p">[</span><span class="n">port_xpos</span><span class="p">,</span> <span class="o">-</span><span class="n">port_ypos</span><span class="p">],</span> <span class="n">width</span><span class="o">=</span><span class="n">port_ysize</span><span class="p">,</span> <span class="n">orientation</span><span class="o">=</span><span class="mi">180</span><span class="p">,</span> <span class="n">cross_section</span><span class="o">=</span><span class="n">gf</span><span class="o">.</span><span class="n">cross_section</span><span class="o">.</span><span class="n">cross_section</span><span class="p">(</span><span class="n">width</span><span class="o">=</span><span class="n">port_ysize</span><span class="p">,</span> <span class="n">layer</span><span class="o">=</span><span class="s1">'WG'</span><span class="p">))</span>
<span class="n">mmi_comp</span><span class="o">.</span><span class="n">add_port</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s2">"o4"</span><span class="p">,</span> <span class="n">center</span><span class="o">=</span><span class="p">[</span><span class="n">port_xpos</span><span class="p">,</span> <span class="n">port_ypos</span><span class="p">],</span> <span class="n">width</span><span class="o">=</span><span class="n">port_ysize</span><span class="p">,</span> <span class="n">orientation</span><span class="o">=</span><span class="mi">180</span><span class="p">,</span> <span class="n">cross_section</span><span class="o">=</span><span class="n">gf</span><span class="o">.</span><span class="n">cross_section</span><span class="o">.</span><span class="n">cross_section</span><span class="p">(</span><span class="n">width</span><span class="o">=</span><span class="n">port_ysize</span><span class="p">,</span> <span class="n">layer</span><span class="o">=</span><span class="s1">'WG'</span><span class="p">))</span>

<span class="n">sparams</span> <span class="o">=</span> <span class="n">write_sparameters_meep</span><span class="p">(</span>
<span class="n">component</span><span class="o">=</span><span class="n">mmi_comp</span><span class="p">,</span>
<span class="n">port_margin</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span>
<span class="n">port_source_offset</span><span class="o">=</span><span class="mf">0.5</span><span class="p">,</span>
<span class="n">run</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
<span class="n">xmargin</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span>
<span class="n">ymargin</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span>
<span class="n">resolution</span><span class="o">=</span><span class="n">res</span><span class="p">,</span>
<span class="n">extend_ports_length</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span>
<span class="n">port_margin</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span>
<span class="n">port_source_offset</span><span class="o">=</span><span class="mf">4.5</span><span class="p">,</span>
<span class="n">port_monitor_offset</span><span class="o">=</span><span class="mf">4.5</span><span class="p">,</span>
<span class="n">run</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
<span class="n">xmargin</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span>
<span class="n">ymargin</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span>
<span class="n">zmargin</span><span class="o">=</span><span class="mi">2</span> <span class="k">if</span> <span class="n">sim_is_3D</span> <span class="k">else</span> <span class="mi">0</span><span class="p">,</span>
<span class="n">is_3d</span><span class="o">=</span><span class="n">sim_is_3D</span><span class="p">,</span>
<span class="n">tpml</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span>
<span class="n">tpml</span><span class="o">=</span><span class="n">dpml</span><span class="p">,</span>
<span class="n">clad_material</span><span class="o">=</span><span class="s2">"SiO2"</span><span class="p">,</span>
<span class="n">wavelength_start</span><span class="o">=</span><span class="mf">1.5</span><span class="p">,</span>
<span class="n">wavelength_stop</span><span class="o">=</span><span class="mf">1.6</span><span class="p">,</span>
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

0 comments on commit 7be1cbd

Please sign in to comment.